feat(providers): add openai-compatible embeddings support#2624
feat(providers): add openai-compatible embeddings support#2624badgerbees wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds OpenAI-compatible embeddings support to the provider layer, enabling OpenAI-compat backends (e.g., vLLM-style endpoints) to serve embeddings without forwarding dimensions upstream, while still allowing callers to request a smaller output width via local truncation.
Changes:
- Introduces a new
EmbeddingProviderinterface inpkg/providers. - Implements
/embeddingscalls (query + batch) inopenai_compat.Provider, omittingdimensionsfrom the upstream request and truncating vectors client-side when requested. - Wires embedding methods through the
httpapiHTTP provider facade and adds httptest coverage for the new behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/providers/types.go | Adds EmbeddingProvider interface for embeddings query/batch. |
| pkg/providers/openai_compat/embeddings.go | Implements embeddings request/response handling and local truncation helper. |
| pkg/providers/openai_compat/embeddings_test.go | Adds tests for omitting upstream dimensions and truncation/error behavior. |
| pkg/providers/httpapi_facade.go | Adds compile-time assertion that HTTPProvider satisfies EmbeddingProvider. |
| pkg/providers/httpapi/http_provider.go | Delegates EmbedQuery/EmbedBatch to the OpenAI-compat provider implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This PR has had no activity for 7 days and has been marked as stale. If you are still working on it, please push an update or leave a comment; otherwise it will be closed automatically in 7 days. |
|
This PR has been closed after 14 days of inactivity. If you would like to continue, feel free to reopen it or submit a new PR. |
📝 Description
Add OpenAI-compatible embeddings support to the provider layer so vLLM-style endpoints can serve embeddings without forwarding
dimensionsupstream. The new provider path sendsmodelandinput, truncates vectors locally when a smaller width is requested, and preserves existingextra_bodysettings except fordimensions.🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
N/A
📚 Technical Context (Skip for Docs)
EmbeddingProvider, wires it through the HTTP provider facade, and implements/embeddingscalls in the shared OpenAI-compatible client.🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
Validation passed:
go test ./pkg/providers/...☑️ Checklist