fix: embedding driver honors base_url override and embedding_base_url config (fixes #1212)#1249
Open
BunnyMoth wants to merge 1 commit into
Open
fix: embedding driver honors base_url override and embedding_base_url config (fixes #1212)#1249BunnyMoth wants to merge 1 commit into
BunnyMoth wants to merge 1 commit into
Conversation
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
Fixes #1212. The embedding driver hard-coded 6 cloud providers and
ignored all base_url override paths, forcing self-hosted deployments
to leak content to OpenAI cloud even when a local embedding server
was configured.
Root Cause
The embedding driver cached its URL at init and never consulted
[providers.openai].base_urlor[provider_urls]. Theneeds_v1allowlist also prevented non-listed providers from appending the
correct
/v1/embeddingspath suffix.Changes
Three-tier URL resolution chain (kernel.rs)
All embedding driver init sites now resolve the URL through a
consistent chain:
config.memory.embedding_base_url— new explicit embedding overrideconfig.provider_urls.get(provider)— existing per-provider overrideconfig.default_model.base_urlwhen embedding provider matchesthe LLM provider — the missing link that caused the regression
New
embedding_base_urlfield in MemoryConfig (config.rs)Removed needs_v1 provider allowlist (embedding.rs)
Replaced the hard-coded allowlist with a simple trailing-slash trim.
The driver now trusts the URL the caller supplies, exactly like
OpenAIDriverdoes. Default URLs already carry the correct path suffix.Testing
cargo fmt --all --check— cleancargo clippy --workspace --all-targets -- -D warnings— zero warningscargo test --workspace— 997 tests, 0 failurestest_create_embedding_driver_openai_custom_base_url,test_create_embedding_driver_openai_custom_base_url_no_v1,test_create_embedding_driver_cohere_custom_url,test_create_embedding_driver_unknown_provider_custom_url