Skip to content

feat: Ollama embedding support - #127

Closed
TerminalGravity wants to merge 1 commit into
mainfrom
feat/ollama-embeddings
Closed

feat: Ollama embedding support#127
TerminalGravity wants to merge 1 commit into
mainfrom
feat/ollama-embeddings

Conversation

@TerminalGravity

@TerminalGravity TerminalGravity commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #6

Adds Ollama as a third embedding provider alongside local (Xenova) and OpenAI.

Changes

  • OllamaEmbeddingProvider class using Ollama's /api/embed endpoint
  • Native batch embedding support (single API call for multiple texts)
  • Configurable: base URL, model name, dimensions
  • Defaults: nomic-embed-text (768 dims) on localhost:11434
  • Env vars: EMBEDDING_PROVIDER=ollama, OLLAMA_BASE_URL, OLLAMA_EMBED_MODEL
  • Updated config types, timeline-db, and onboard-project tool
  • 3 new unit tests for the Ollama provider factory

Usage

# Just set the env var (Ollama must be running)
EMBEDDING_PROVIDER=ollama preflight

# Or in .preflight.json
{ "embeddings": { "provider": "ollama" } }

# Custom model
OLLAMA_EMBED_MODEL=mxbai-embed-large preflight

Zero external API keys needed — perfect for local-first users.

@TerminalGravity
TerminalGravity force-pushed the feat/ollama-embeddings branch from f6b104e to 77a41b2 Compare March 6, 2026 13:56

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition — clean implementation, native batch support, and sensible defaults (nomic-embed-text, localhost:11434). A couple thoughts:

  1. Dimension mismatch handling — if someone switches between providers mid-project (e.g. local → ollama), the stored embeddings will have different dimensions. Might be worth a warning or migration note in the docs.

  2. Timeout/retry — the Ollama fetch calls don't have a timeout. If the local server is down, these will hang. Consider an AbortController with a reasonable timeout (10-15s).

  3. Relation to #81 — this overlaps significantly with PR #81 (feat: add Ollama as local embedding provider). Are these meant to supersede it, or should one be closed?

Otherwise looking good. Would approve once the overlap with #81 is clarified.

@TerminalGravity
TerminalGravity force-pushed the feat/ollama-embeddings branch 5 times, most recently from 422cbb9 to 3578df1 Compare March 7, 2026 20:15
- Add OllamaEmbeddingProvider class using /api/embed endpoint
- Support batch embeddings natively via Ollama's input array
- Configurable base URL, model, and dimensions
- Default: nomic-embed-text (768 dims) on localhost:11434
- Update config types, env var loading, and factory
- Add tests for Ollama provider creation
- Update README with Ollama docs

Closes #6
@TerminalGravity
TerminalGravity force-pushed the feat/ollama-embeddings branch from 3578df1 to 9334518 Compare March 7, 2026 22:45
@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Superseded by #148.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ollama embedding support

1 participant