Open
Description
As the description says, the model does not respect the tool_choice: { type: "none" }
parameter. For example the following request produces a tool call from the model:
Request:
{
"max_tokens": 4096,
"messages": [
{
"content": "what's the weather in dallas, tx?",
"role": "user"
}
],
"model": "claude-3-5-sonnet-20241022",
"stream": false,
"temperature": 1,
"top_k": 0,
"top_p": 1,
"tools": [
{
"name": "geocoding",
"description": "Geocode a location using the openweathermap.org API",
"input_schema": {
"type": "object",
"properties": {
"q": {
"type": "string",
"description": "City name, state code (only for the US) and country code divided by comma. Please use ISO 3166 country codes. city name, state code, and country code are all required for US cities, and city name and country code are required for all other cities. Do not leave out the 2 letter state code for US cities. For example, to get the location of New York City, you would use 'Chicago,IL,US'. For London, you would use 'London,GB'. You should also make sure that any spaces in city names are URL encoded. Last, make sure there are no spaces between the city name, state code, and country code."
}
},
"required": [
"q"
]
}
},
{
"name": "current_weather",
"description": "Get the current weather for a location using the openweathermap.org API",
"input_schema": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"description": "The latitude of the location to get the current weather for. Decimal from -90 to 90."
},
"lon": {
"type": "number",
"description": "The longitude of the location to get the current weather for. Decimal from -180 to 180."
},
"units": {
"type": "string",
"description": "The units to return the weather in. Can be 'standard', 'metric', or 'imperial'. Standard is Kelvin, metric is Celsius, and imperial is Fahrenheit."
}
},
"required": [
"lat",
"lon",
"units"
]
}
}
],
"tool_choice": {
"type": "none"
}
}
Response:
{
"id": "msg_01Ncv376YEyfGYepnsPjbMGf",
"type": "message",
"role": "assistant",
"model": "claude-3-5-sonnet-20241022",
"content": [
{
"type": "text",
"text": "I'll help you check the weather in Dallas, Texas. Since this is a US city, I'll need to use the proper format with city, state, and country code to get the location first, then get the current weather. I'll show it in Fahrenheit (imperial units) since that's commonly used in the US.\n\nFirst, let's geocode Dallas:"
},
{
"type": "tool_use",
"id": "toolu_012pMoReysmJGQTAiPfrqtbm",
"name": "geocoding",
"input": {
"q": "Dallas,TX,US"
}
}
],
"stop_reason": "tool_use",
"stop_sequence": null,
"usage": {
"input_tokens": 797,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"output_tokens": 134
}
}
Metadata
Metadata
Assignees
Labels
No labels