Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit df411c0

Browse files
committed
fix: default OpenAI Compatible provider to XML protocol for better third-party proxy compatibility
1 parent 2bb3755 commit df411c0

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

packages/types/src/providers/openai.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,10 @@ export const openAiModelInfoSaneDefaults: ModelInfo = {
551551
inputPrice: 0,
552552
outputPrice: 0,
553553
supportsNativeTools: true,
554-
defaultToolProtocol: "native",
554+
// Default to XML for OpenAI Compatible providers since third-party proxies
555+
// have varying levels of support for native tool calling. Users who want
556+
// native tool calling can explicitly enable it in Advanced Settings.
557+
defaultToolProtocol: "xml",
555558
}
556559

557560
// https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation

src/utils/__tests__/resolveToolProtocol.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,15 @@ describe("resolveToolProtocol", () => {
376376
expect(result).toBe(TOOL_PROTOCOL.XML) // Model default wins
377377
})
378378

379-
it("should use native tools for OpenAI compatible provider with default model info", () => {
379+
it("should use XML for OpenAI compatible provider with default model info", () => {
380380
const settings: ProviderSettings = {
381381
apiProvider: "openai",
382382
}
383-
// Using the actual openAiModelInfoSaneDefaults to verify the fix
383+
// OpenAI Compatible defaults to XML protocol since third-party proxies
384+
// have varying levels of support for native tool calling.
385+
// Users who want native can explicitly enable it in Advanced Settings.
384386
const result = resolveToolProtocol(settings, openAiModelInfoSaneDefaults)
385-
expect(result).toBe(TOOL_PROTOCOL.NATIVE) // Should use native tools by default
387+
expect(result).toBe(TOOL_PROTOCOL.XML) // Should use XML by default for better compatibility
386388
})
387389
})
388390
})

webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ describe("useSelectedModel", () => {
702702
expect(result.current.id).toBe("gpt-4o")
703703
expect(result.current.info).toEqual(openAiModelInfoSaneDefaults)
704704
expect(result.current.info?.supportsNativeTools).toBe(true)
705-
expect(result.current.info?.defaultToolProtocol).toBe("native")
705+
// OpenAI Compatible defaults to XML for better third-party proxy compatibility
706+
expect(result.current.info?.defaultToolProtocol).toBe("xml")
706707
})
707708

708709
it("should merge native tool defaults with custom model info", () => {
@@ -734,7 +735,8 @@ describe("useSelectedModel", () => {
734735
}
735736
expect(result.current.info).toEqual({ ...nativeToolDefaults, ...customModelInfo })
736737
expect(result.current.info?.supportsNativeTools).toBe(true)
737-
expect(result.current.info?.defaultToolProtocol).toBe("native")
738+
// OpenAI Compatible defaults to XML for better third-party proxy compatibility
739+
expect(result.current.info?.defaultToolProtocol).toBe("xml")
738740
})
739741

740742
it("should allow custom model info to override native tool defaults", () => {

0 commit comments

Comments
 (0)