Add OpenAI API embedder behind optional extra - #13
Merged
AshwinUgale merged 1 commit intoAug 26, 2026
Conversation
Signed-off-by: Dawn-OuYang <Dawn-OuYang@users.noreply.github.com>
Owner
|
Thanks for this, @Dawn-OuYang — really clean work. Lazy-importing the OpenAI SDK keeps the default install and tests keyless, reusing the existing content-hash cache gives hosted embeddings free dedup across a sweep, and the injected-fake-client tests cover the adapter without a real key. Docs and CHANGELOG updates appreciated too. Merging now — thanks again! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title:
Add OpenAI API embedder behind optional extra
Body:
Closes #10
This adds the first hosted API embedder backend for Retrieval Lab. The new
api:<model>selector currently targets OpenAI embedding models and keeps the defaultinstall keyless by importing the OpenAI SDK only when the API embedder is selected.
Changes:
OpenAIEmbedderinretrieval_lab.embedding.api.[api-embed]extra with the OpenAI SDK dependency.--embed-models api:<model>andgeometry --embed-model api:<model>through the CLI.EmbeddingCachecontent-hash cache for hosted embeddings.OPENAI_API_KEY, and provider availability/rate-limit caveats.CHANGELOG.md.Duplicate check:
#10; only an unrelated Dependabot PR is open.api-embed,OpenAIEmbedder, and hosted embedding; no duplicate PR found.Validation:
python -m pytest -qruff check src testsgit diff --checkpython -m py_compile src/retrieval_lab/embedding/api.py src/retrieval_lab/embedding/__init__.py src/retrieval_lab/cli.py tests/test_embedding.py tests/test_cli.pyNote:
ruff format --check src testswas not used as a gate here because the latest local Ruffwants to reformat many pre-existing files outside this patch. This PR leaves unrelated
formatting untouched.