Second Quick Fix for Azure Foundry (#11374)

This commit is contained in:
Danger Mouse 2026-02-10 17:39:55 +00:00 committed by GitHub
parent b971fe1a63
commit 4438fdadc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -74,14 +74,14 @@ describe("AzureHandler", () => {
expect(handlerWithoutModel.getModel().id).toBe("")
})
it("should use default API version if not provided", () => {
it("should omit API version if not provided", () => {
const handlerWithoutVersion = new AzureHandler({
...mockOptions,
azureApiVersion: undefined,
})
expect(handlerWithoutVersion).toBeInstanceOf(AzureHandler)
expect(mockCreateAzure).toHaveBeenLastCalledWith(
expect.objectContaining({ apiVersion: "2025-04-01-preview" }),
expect.not.objectContaining({ apiVersion: expect.anything() }),
)
})
@ -98,14 +98,14 @@ describe("AzureHandler", () => {
)
})
it("should use default API version when configured value is blank", () => {
it("should omit API version when configured value is blank", () => {
new AzureHandler({
...mockOptions,
azureApiVersion: " ",
})
expect(mockCreateAzure).toHaveBeenLastCalledWith(
expect.objectContaining({ apiVersion: "2025-04-01-preview" }),
expect.not.objectContaining({ apiVersion: expect.anything() }),
)
})
})

View file

@ -2,7 +2,7 @@ import { Anthropic } from "@anthropic-ai/sdk"
import { createAzure } from "@ai-sdk/azure"
import { streamText, generateText, ToolSet } from "ai"
import { azureModels, azureDefaultModelInfo, azureOpenAiDefaultApiVersion, type ModelInfo } from "@roo-code/types"
import { azureModels, azureDefaultModelInfo, type ModelInfo } from "@roo-code/types"
import type { ApiHandlerOptions } from "../../shared/api"
@ -46,7 +46,7 @@ export class AzureHandler extends BaseProvider implements SingleCompletionHandle
this.provider = createAzure({
resourceName: options.azureResourceName ?? "",
apiKey: options.azureApiKey, // Optional — Azure supports managed identity / Entra ID auth
...(apiVersion ? { apiVersion } : { apiVersion: azureOpenAiDefaultApiVersion }),
...(apiVersion ? { apiVersion } : {}),
headers: DEFAULT_HEADERS,
})
}