mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: disable native tools for Gemini models in OpenAI compatible provider
When using Gemini models via OpenAI Compatible provider, they do not support native OpenAI tool calling format and require XML-style tool calls instead. This fix detects Gemini models by their model ID and disables supportsNativeTools to force XML protocol. Fixes #9385
This commit is contained in:
parent
18c4d1ac41
commit
2625f33d42
1 changed files with 8 additions and 1 deletions
|
|
@ -314,7 +314,14 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
|
|||
|
||||
override getModel() {
|
||||
const id = this.options.openAiModelId ?? ""
|
||||
const info = this.options.openAiCustomModelInfo ?? openAiModelInfoSaneDefaults
|
||||
let info = this.options.openAiCustomModelInfo ?? openAiModelInfoSaneDefaults
|
||||
|
||||
// Gemini models don't support native OpenAI tool calling format when accessed via OpenAI Compatible endpoints
|
||||
// They require XML-style tool calls instead
|
||||
if (id.toLowerCase().includes("gemini")) {
|
||||
info = { ...info, supportsNativeTools: false }
|
||||
}
|
||||
|
||||
const params = getModelParams({ format: "openai", modelId: id, model: info, settings: this.options })
|
||||
return { id, info, ...params }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue