fix: route Azure embed requests through deployment endpoint#12598
Open
rodboev wants to merge 1 commit into
Open
fix: route Azure embed requests through deployment endpoint#12598rodboev wants to merge 1 commit into
rodboev wants to merge 1 commit into
Conversation
2c13ca2 to
fbd37f1
Compare
fbd37f1 to
fe2af65
Compare
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.
Fixes #12554
Summary
Azure OpenAI embed requests can 404 because
_getEmbedEndpointchecksapiType === "azure"while the Azure adapter setsapiType: "azure-openai". The strict check misses the Azure deployment route, so embed requests go to/embeddingsinstead of/openai/deployments/{deployment}/embeddings?api-version={version}. This change follows the Azure routing pattern already used by_getEndpointfor chat requests.Root cause
core/llm/llms/OpenAI.ts:708used strict equality for the embed endpoint, butAzure.ts:17setsapiType: "azure-openai". The condition never matched, so Azure OpenAI embeddings skipped the deployment path.azure-foundryshould still use the plainembeddingspath, so the fix distinguishesazureandazure-openaifrom other Azure-flavoredapiTypevalues.Changes
core/llm/llms/OpenAI.ts: routeazureandazure-openaiembed requests throughopenai/deployments/{deployment}/embeddings, while keepingazure-foundryon the plainembeddingspathcore/llm/llms/OpenAI.vitest.ts: add coverage for both Azure OpenAI deployment routing and Azure Foundry plain-path routingcore/llm/llms/OpenAI-compatible.vitest.ts: update the Azure subclass expectation to cover the deployment embed URLScope note
This PR no longer changes generic webview error logging. The related
webviewProtocol.tsstringify guard is handled separately in #12589, so this branch stays focused on Azure embedding endpoint routing.What this doesn't change
The chat/completions routing (
_getEndpoint) and Responses API gate (canUseOpenAIResponses) are already correct for Azure and untouched. No model selection, parameter conversion, streaming logic, or generic webview error handling is modified.Checklist
Screen recording or screenshot
N/A, provider endpoint routing fix covered by tests.
Tests
Attempted locally:
cd core && npx vitest run llm/llms/OpenAI.vitest.ts llm/llms/OpenAI-compatible.vitest.tsBlocked before test collection because the local checkout is running Node
v24.15.0while.nvmrcrequiresv20.20.1, andsqlite3has no native binding for the active Node version. The command failed withCould not locate the bindings file ... sqlite3 ... compiled\24.15.0\win32\x64\node_sqlite3.node.