Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api/providers/__tests__/azure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test description on line 77 still says "should use default API version if not provided" but this assertion now verifies that apiVersion is omitted. The analogous test on line 101 was renamed to "should omit API version when configured value is blank" -- line 77 should get the same treatment for consistency (e.g. "should omit API version if not provided").

Fix it with Roo Code or mention @roomote and request a fix.

)
})

Expand All @@ -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() }),
)
})
})
Expand Down
4 changes: 2 additions & 2 deletions src/api/providers/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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,
})
}
Expand Down
Loading