**fix(translator): remove input_examples from tool schema in Gemini-Claude requests**
This commit is contained in:
Luis Pater
2025-11-18 11:27:48 +08:00
parent db2d22c978
commit e5e985978d
2 changed files with 2 additions and 0 deletions

View File

@@ -128,6 +128,7 @@ func ConvertClaudeRequestToCLI(modelName string, inputRawJSON []byte, _ bool) []
tool, _ := sjson.Delete(toolResult.Raw, "input_schema") tool, _ := sjson.Delete(toolResult.Raw, "input_schema")
tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema)
tool, _ = sjson.Delete(tool, "strict") tool, _ = sjson.Delete(tool, "strict")
tool, _ = sjson.Delete(tool, "input_examples")
var toolDeclaration any var toolDeclaration any
if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil { if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil {
tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration) tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration)

View File

@@ -121,6 +121,7 @@ func ConvertClaudeRequestToGemini(modelName string, inputRawJSON []byte, _ bool)
tool, _ := sjson.Delete(toolResult.Raw, "input_schema") tool, _ := sjson.Delete(toolResult.Raw, "input_schema")
tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema)
tool, _ = sjson.Delete(tool, "strict") tool, _ = sjson.Delete(tool, "strict")
tool, _ = sjson.Delete(tool, "input_examples")
var toolDeclaration any var toolDeclaration any
if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil { if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil {
tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration) tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration)