starlet/ollama
Ollama provider for starlet.
Ollama is a local LLM runtime that supports many open-source models.
Usage
import starlet
import starlet/ollama
let client = ollama.new("http://localhost:11434")
starlet.chat(client, "qwen3:0.6b")
|> starlet.user("Hello!")
|> starlet.send()
Thinking Mode
For thinking-capable models (DeepSeek-R1, Qwen3), configure thinking:
starlet.chat(client, "deepseek-r1")
|> ollama.with_thinking(ollama.ThinkingEnabled)
|> starlet.user("Solve this step by step...")
|> starlet.send()
Types
Information about an available model.
pub type Model {
Model(name: String, size: String)
}
Constructors
-
Model(name: String, size: String)
Thinking mode configuration for Ollama.
pub type Thinking {
ThinkingEnabled
ThinkingDisabled
ThinkingLow
ThinkingMedium
ThinkingHigh
}
Constructors
-
ThinkingEnabledEnable thinking (boolean mode)
-
ThinkingDisabledDisable thinking
-
ThinkingLowLow reasoning effort (for models that support effort levels)
-
ThinkingMediumMedium reasoning effort
-
ThinkingHighHigh reasoning effort
Values
pub fn list_models(
base_url: String,
) -> Result(List(Model), starlet.StarletError)
Lists available models from the Ollama server.
pub fn new(base_url: String) -> starlet.Client(@internal Ext)
Creates a new Ollama client with the given base URL.
Example: ollama.new("http://localhost:11434")
pub fn thinking(
turn: starlet.Turn(t, f, @internal Ext),
) -> option.Option(String)
Get the thinking content from an Ollama turn (if present).
pub fn with_thinking(
chat: starlet.Chat(t, f, s, @internal Ext),
mode: Thinking,
) -> starlet.Chat(t, f, s, @internal Ext)
Configure thinking mode for thinking-capable models. When not set, the provider’s default applies (enabled for thinking models).