Skip to content
Draft
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
5 changes: 4 additions & 1 deletion packages/types/src/providers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,10 @@ export const openAiModelInfoSaneDefaults: ModelInfo = {
inputPrice: 0,
outputPrice: 0,
supportsNativeTools: true,
defaultToolProtocol: "native",
// Default to XML for OpenAI Compatible providers since third-party proxies
// have varying levels of support for native tool calling. Users who want
// native tool calling can explicitly enable it in Advanced Settings.
defaultToolProtocol: "xml",
Comment on lines +554 to +557
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change will cause test failures in webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts. Lines 705 and 737 expect defaultToolProtocol to be "native", but this change sets it to "xml". Those tests need to be updated to expect "xml" instead.

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

}

// https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation
Expand Down
8 changes: 5 additions & 3 deletions src/utils/__tests__/resolveToolProtocol.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,15 @@ describe("resolveToolProtocol", () => {
expect(result).toBe(TOOL_PROTOCOL.XML) // Model default wins
})

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