Add an ollama provider for local models
Thin constructor over the existing OpenAI-compatible path, same shape as litellm/openrouter: NewOllamaProvider(baseURL) defaults to Ollama's local endpoint (http://localhost:11434/v1) and needs no API key, since Ollama doesn't authenticate requests. Also covers other local servers that share Ollama's OpenAI-compatible endpoint shape (LM Studio, llama.cpp's server, vLLM).
This commit is contained in:
1 parent
897643db18
commit
3b5aadb31f
4 files changed
+84
-12
No files matched your search
+3
-2
@@ -59,8 +59,8 @@ required pieces are inside `inputs`; everything in `deps` is optional;
|
||||
The four mandatory pieces:
|
||||
|
||||
* **`llm.LLMProvider`** (in `RuntimeInputs.Provider`) — a streaming
|
||||
chat client (Anthropic / OpenAI / Gemini / LiteLLM / OpenRouter, or
|
||||
your own).
|
||||
chat client (Anthropic / OpenAI / Gemini / LiteLLM / OpenRouter /
|
||||
Ollama, or your own).
|
||||
* **`tool.Registry`** (in `RuntimeInputs.Tools`) — the tools the LLM
|
||||
may invoke. Each tool implements `tool.Tool`.
|
||||
* **`session.Session`** (in `RuntimeInputs.Session`) — append-only
|
||||
@@ -392,6 +392,7 @@ Each provider has its own constructor. All return an `llm.LLMProvider`.
|
||||
| Gemini | `gemini.NewGeminiProvider(ctx, apiKey)` | takes `context.Context` |
|
||||
| LiteLLM | `litellm.NewLiteLLMProvider(apiKey, baseURL)` | `baseURL` required (self-hosted) |
|
||||
| OpenRouter | `openrouter.NewOpenRouterProvider(apiKey, baseURL)` | `baseURL == ""` → OpenRouter's public endpoint |
|
||||
| Ollama | `ollama.NewOllamaProvider(baseURL)` | `baseURL == ""` → `http://localhost:11434/v1`; no API key |
|
||||
|
||||
The provider you pass on `RuntimeInputs.Provider` only needs to match the
|
||||
provider prefix in `AgentSpec.Model` — `runtime.BuildRuntime` parses
|
||||
|
||||
Reference in new issue
Block a user