Skip to content

feat: EmbeddingClient with Ollama and OpenAI providers#25

Merged
jordanpartridge merged 3 commits intomainfrom
feat/24-embedding-client
Apr 6, 2026
Merged

feat: EmbeddingClient with Ollama and OpenAI providers#25
jordanpartridge merged 3 commits intomainfrom
feat/24-embedding-client

Conversation

@jordanpartridge
Copy link
Copy Markdown
Contributor

Summary

  • EmbeddingClient contract with embed() and embedBatch()
  • OllamaEmbeddings — Saloon connector calling POST /api/embed
  • OpenAiEmbeddings — Saloon connector calling POST /v1/embeddings with Bearer auth (works with any OpenAI-compatible API)
  • NullEmbeddings — stub for testing or disabled embedding
  • Config-driven provider selection via config/vector.php (ollama, openai, none)
  • VectorServiceProvider binds the correct implementation based on config

New files

src/Contracts/EmbeddingClient.php
src/Embeddings/OllamaConnector.php
src/Embeddings/OllamaEmbeddings.php
src/Embeddings/OpenAiConnector.php
src/Embeddings/OpenAiEmbeddings.php
src/Embeddings/NullEmbeddings.php
src/Embeddings/Requests/OllamaEmbedRequest.php
src/Embeddings/Requests/OpenAiEmbedRequest.php

Test plan

  • 176 tests pass (16 skipped contract tests needing live Qdrant)
  • 42 new embedding tests covering success, failure, empty input, malformed responses
  • Service provider resolution tests for all 3 providers + unknown
  • Pint clean

Closes #24

Introduces a provider-agnostic embedding layer so consumers don't need
to roll their own HTTP clients for generating vector embeddings.

- EmbeddingClient contract: embed() and embedBatch()
- OllamaEmbeddings: Saloon connector calling POST /api/embed
- OpenAiEmbeddings: Saloon connector calling POST /v1/embeddings
  with Bearer auth (works with any OpenAI-compatible API)
- NullEmbeddings: stub for testing / disabled embedding
- Config-driven provider selection via config/vector.php
- VectorServiceProvider binds the correct implementation

Closes #24
Cover Qdrant::listCollections() and ListCollectionsRequest — the only
two gaps preventing the --min=100 coverage gate from passing.
@jordanpartridge jordanpartridge merged commit 47d1db3 into main Apr 6, 2026
2 checks passed
@jordanpartridge jordanpartridge deleted the feat/24-embedding-client branch April 6, 2026 20:13
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.

feat: add EmbeddingClient contract with Ollama and OpenAI providers

1 participant