Skip to main content

1. Import and initialize

The second import is what makes the namespaces resolve. Pass an empty API key for keyless local mode.

2. Generate text

Generation auto-loads whatever it needs, and downloads the model when options.model names one that is not on disk.

3. Stream it instead

4. Hold a conversation

5. Add speech

A complete ViewModel

And the Compose side:

Next

Managing models

Download, load, and unload

Tool calling

Let the model call your functions

RAG

Answer over your own documents

Error handling

What throws and when