feat(extension): add OrcaRouter as a named dense embedding provider - #695
Open
XiaoHuo888-hue wants to merge 1 commit into
Open
feat(extension): add OrcaRouter as a named dense embedding provider#695XiaoHuo888-hue wants to merge 1 commit into
XiaoHuo888-hue wants to merge 1 commit into
Conversation
Add OrcaRouterDenseEmbedding and OrcaRouterFunctionBase mirroring the existing OpenAI/Qwen provider pattern. It reuses the OpenAI-compatible /v1/embeddings endpoint at https://api.orcarouter.ai/v1 with the official openai client (no new dependency) and reads ORCAROUTER_API_KEY from the environment. - python/zvec/extension/orcarouter_function.py: base class with DEFAULT_ORCAROUTER_BASE_URL, key validation, and API call handling - python/zvec/extension/orcarouter_embedding_function.py: OrcaRouterDenseEmbedding with model dimension table and LRU caching - Register both in zvec.extension and top-level zvec exports - Add TestOrcaRouterDenseEmbedding coverage mirroring the OpenAI suite Disclosure: I'm an engineer on the OrcaRouter team. Signed-off-by: XiaoHuo888-hue <jinhao.song@myflashcloud.com>
|
XiaoHuo888-hue seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
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.
Summary
Add OrcaRouter as a named dense-embedding provider in the Python extension layer, mirroring the existing
OpenAIDenseEmbedding/QwenDenseEmbeddingprovider pattern.OrcaRouter is an OpenAI-compatible gateway that exposes a broad catalog of frontier models through a single endpoint (
https://api.orcarouter.ai/v1). It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes.Changes
python/zvec/extension/orcarouter_function.py: newOrcaRouterFunctionBasebase class withDEFAULT_ORCAROUTER_BASE_URL,ORCAROUTER_API_KEYenv-var handling, and embedding API call/response parsing. Reuses the officialopenaiclient (no new dependency).python/zvec/extension/orcarouter_embedding_function.py: newOrcaRouterDenseEmbeddingclass with a model dimension table and LRU caching.python/zvec/extension/__init__.pyandpython/zvec/__init__.py: export the new classes.python/tests/test_embedding.py: addTestOrcaRouterDenseEmbeddingmirroring the OpenAI test suite (init, env key, empty input, success, API error, invalid response, dimension mismatch, callable, custom base URL, real-API integration test).Usage
Validation
ruff checkandruff format --checkpass on all changed files.pytest python/tests/test_embedding.py -k OrcaRouter: 17 passed, 1 skipped (integration test gated behindZVEC_RUN_INTEGRATION_TESTS=1).test_embedding.pyrun — 94 passed, 13 skipped (pre-existing integration tests).OrcaRouterDenseEmbeddingwith a real key againsthttps://api.orcarouter.ai/v1/embeddings(modelopenai/text-embedding-3-small) → HTTP 200, 1536-dim vector returned.Disclosure: I'm an engineer on the OrcaRouter team.