feat(ai): add support for Ollama AI provider configuration

* Update README with Ollama integration details
* Add Ollama configuration to example YAML files
* Implement Ollama provider in AI factory
* Add tests for Ollama provider functionality
* Enhance config validation for Ollama settings
This commit is contained in:
Hein
2026-03-25 12:26:31 +02:00
parent ad05a9e228
commit c8ca272b03
12 changed files with 182 additions and 3 deletions

View File

@@ -16,8 +16,9 @@ A Go MCP server for capturing and retrieving thoughts, memory, and project conte
- Go — MCP server over Streamable HTTP
- Postgres + pgvector — storage and vector search
- LiteLLM — primary AI provider (embeddings + metadata extraction)
- LiteLLM — primary hosted AI provider (embeddings + metadata extraction)
- OpenRouter — default upstream behind LiteLLM
- Ollama — supported local or self-hosted OpenAI-compatible provider
## Tools
@@ -48,6 +49,7 @@ Config is YAML-driven. Copy `configs/config.example.yaml` and set:
- `database.url` — Postgres connection string
- `auth.keys` — API keys for MCP endpoint access
- `ai.litellm.base_url` and `ai.litellm.api_key` — LiteLLM proxy
- `ai.ollama.base_url` and `ai.ollama.api_key` — Ollama local or remote server
See `llm/plan.md` for full architecture and implementation plan.
@@ -72,7 +74,35 @@ Notes:
- The app uses `configs/docker.yaml` inside the container.
- `OB1_LITELLM_BASE_URL` overrides the LiteLLM endpoint, so you can retarget it without editing YAML.
- `OB1_OLLAMA_BASE_URL` overrides the Ollama endpoint for local or remote servers.
- The base Compose file uses `host.containers.internal`, which is Podman-friendly.
- The Docker override file adds `host-gateway` aliases so Docker can resolve the same host endpoint.
- Database migrations `001` through `005` run automatically when the Postgres volume is created for the first time.
- `migrations/006_rls_and_grants.sql` is intentionally skipped during container bootstrap because it contains deployment-specific grants for a role named `amcs_user`.
## Ollama
Set `ai.provider: "ollama"` to use a local or self-hosted Ollama server through its OpenAI-compatible API.
Example:
```yaml
ai:
provider: "ollama"
embeddings:
model: "nomic-embed-text"
dimensions: 768
metadata:
model: "llama3.2"
temperature: 0.1
ollama:
base_url: "http://localhost:11434/v1"
api_key: "ollama"
request_headers: {}
```
Notes:
- For remote Ollama servers, point `ai.ollama.base_url` at the remote `/v1` endpoint.
- The client always sends Bearer auth; Ollama ignores it locally, so `api_key: "ollama"` is a safe default.
- `ai.embeddings.dimensions` must match the embedding model you actually use, or startup will fail the database vector-dimension check.