Closed jayeshp19 closed 1 week ago
It seems there's bug on anthropic side. we have to explicitly specify in the system prompt to use parallel tool calls.
result = anthropic.Client(api_key=api_key).messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
system="You are a weather assistant. You will provide weather information for a given location. You can use multiple tool calls at once.",
messages=messages,
tools=tools,
tool_choice={
"type": "auto",
"disable_parallel_tool_use": False
},
)
gives
Message(id='msg_01XM7G2QLkqjcjBvbFms2Z3i', content=[TextBlock(text="I'll check the weather for both London and New York for you.", type='text')],
ToolUseBlock(id='toolu_01THRx1ZePpp0tadzPGQG74', input={'location': 'London'}, name='get_weather', type='tool_use'),
ToolUseBlock(id='toolu_01Tt6GahcRDXeKXedH2YHr9', input={'location': 'New York'}, name='get_weather', type='tool_use'),
model='claude-3-5-sonnet-20241022', role='assistant', stop_reason='tool_use', stop_sequence=None, type='message', usage=Usage(input_tokens=432, output_tokens=105))
cc: @davidzhao
Thanks @jayeshp19 !
anthropic breaks if there are multiple tool calls,
steps to reproduce:
stream logs:
CC : @theomonnom @davidzhao