Skip to content

feat(embedding): add Ollama tests and multi-provider support#83

Merged
Siddhant-K-code merged 1 commit into
mainfrom
feat/ollama-embedding-tests-and-provider-registry
May 9, 2026
Merged

feat(embedding): add Ollama tests and multi-provider support#83
Siddhant-K-code merged 1 commit into
mainfrom
feat/ollama-embedding-tests-and-provider-registry

Conversation

@Siddhant-K-code

Copy link
Copy Markdown
Owner

What

Adds unit tests for the Ollama embedding client and wires all CLI commands through the embedding provider registry instead of hardcoding OpenAI.

Why

The Ollama client (pkg/embedding/ollama) shipped without tests. The CLI commands (api, serve, memory) only accepted OpenAI, even though the registry already supported Ollama and Cohere.

Changes

  • 15 unit tests for the Ollama client covering success, errors, empty input, timeouts, batch, and connection failures
  • --embedding-provider flag added to api, serve, and memory commands (accepts openai, ollama, cohere)
  • --embedding-base-url flag for custom endpoints (e.g. http://localhost:11434 for Ollama)
  • Config validation updated to accept ollama and cohere as valid providers
  • EmbeddingConfig.BaseURL field added for config file support

Usage

# Use Ollama for embeddings (no API key needed)
distill api --embedding-provider ollama --embedding-model nomic-embed-text

# Use Cohere
distill api --embedding-provider cohere --openai-key $COHERE_API_KEY

# Config file
embedding:
  provider: ollama
  model: nomic-embed-text
  base_url: http://localhost:11434

Closes #25

- Add 15 unit tests for the Ollama embedding client (mock HTTP server)
- Add --embedding-provider flag to api, serve, and memory commands
- Use the embedding registry instead of hardcoding OpenAI in all commands
- Accept ollama and cohere as valid providers in config validation
- Add base_url field to EmbeddingConfig for custom endpoints

Closes #25

Co-authored-by: Ona <[email protected]>
@Siddhant-K-code Siddhant-K-code added the enhancement New feature or request label May 9, 2026
@Siddhant-K-code Siddhant-K-code merged commit 75e26df into main May 9, 2026
2 checks passed
@Siddhant-K-code Siddhant-K-code deleted the feat/ollama-embedding-tests-and-provider-registry branch May 9, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Ollama and local embedding provider support

1 participant