bugfix: map bedrock tool-call indexes and tool_choice (#3786)

Signed-off-by: Betula-L <6059935+Betula-L@users.noreply.github.com>
Co-authored-by: Betula-L <6059935+Betula-L@users.noreply.github.com>
This commit is contained in:
Betula-L
2026-05-06 04:48:42 -07:00
committed by GitHub
parent 4aba4a9860
commit 6199fe414d
7 changed files with 557 additions and 34 deletions

View File

@@ -178,12 +178,19 @@ func (c *ClaudeToOpenAIConverter) ConvertClaudeRequestToOpenAI(body []byte) ([]b
},
}
} else {
// For other types like "auto", "none", etc.
openaiRequest.ToolChoice = claudeRequest.ToolChoice.Type
// Anthropic's "any" means the model must call at least one tool.
// OpenAI-compatible requests express the same behavior as "required".
if claudeRequest.ToolChoice.Type == "any" {
openaiRequest.ToolChoice = "required"
} else {
// For other types like "auto", "none", etc.
openaiRequest.ToolChoice = claudeRequest.ToolChoice.Type
}
}
// Handle parallel tool calls
openaiRequest.ParallelToolCalls = !claudeRequest.ToolChoice.DisableParallelToolUse
parallelToolCalls := !claudeRequest.ToolChoice.DisableParallelToolUse
openaiRequest.ParallelToolCalls = &parallelToolCalls
}
// Convert thinking configuration if present