fix: use correct client type for Azure embeddings in file processor - #3164
Open
theonlypal wants to merge 1 commit into
Open
fix: use correct client type for Azure embeddings in file processor#3164theonlypal wants to merge 1 commit into
theonlypal wants to merge 1 commit into
Conversation
The OpenAIEmbedder was hardcoded to always use OpenAIClient regardless of the embedding_endpoint_type in the config. This caused Azure embedding requests to fail with 404 errors because: 1. OpenAIClient._prepare_client_kwargs_embedding() uses embedding_endpoint as base_url for AsyncOpenAI 2. For Azure, embedding_endpoint contains the full deployment URL with /embeddings path already included 3. OpenAI SDK appends /embeddings again, resulting in malformed URL Fix: Use LLMClient.create() with the provider_type from embedding config so Azure configs get AzureClient (which handles Azure URLs correctly). Fixes letta-ai#3163
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.
Relevant issues
Fixes #3163 - Azure embedding requests return 404 due to malformed URL construction.
Summary
The
OpenAIEmbedderwas hardcoded to always useOpenAIClientregardless of theembedding_endpoint_typein the config. This caused Azure embedding requests to fail with 404 errors because:OpenAIClient._prepare_client_kwargs_embedding()usesembedding_endpointasbase_urlforAsyncOpenAIembedding_endpointcontains the full deployment URL with/embeddingspath already included/embeddingsagain, resulting in a malformed URL like:https://.../deployments/model/embeddings?api-version=.../embeddingsFix: Use
LLMClient.create()with theprovider_typefrom embedding config so Azure configs getAzureClient(which handles Azure URLs correctly viaAsyncAzureOpenAI).Pre-Submission checklist
tests/directoryType
🐛 Bug Fix
Changes
OpenAIEmbedder.__init__()to useProviderType(embedding_config.embedding_endpoint_type)instead of hardcodedProviderType.openai