Skip to content

Commit

Permalink
Fix the bug where claude tool_choice does not support "tool_choice": …
Browse files Browse the repository at this point in the history
…{"type": "any"}
  • Loading branch information
yym68686 committed Sep 4, 2024
1 parent 7f8be8f commit 0ce2715
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions request.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ async def get_vertex_claude_payload(request, engine, provider):
payload["tool_choice"] = {
"type": "auto"
}
if payload["tool_choice"]["type"] == "any":
payload["tool_choice"] = {
"type": "any"
}
if payload["tool_choice"]["type"] == "function":
payload["tool_choice"] = {
"type": "tool",
Expand Down Expand Up @@ -746,6 +750,10 @@ async def get_claude_payload(request, engine, provider):
payload["tool_choice"] = {
"type": "auto"
}
if payload["tool_choice"]["type"] == "any":
payload["tool_choice"] = {
"type": "any"
}
if payload["tool_choice"]["type"] == "function":
payload["tool_choice"] = {
"type": "tool",
Expand Down

0 comments on commit 0ce2715

Please sign in to comment.