Hi, I’m using function calling with tool_choice
set to required
.
Model: gpt-4o-0806
A sample request:
{
"messages": [
{
"role": "user",
"content": "What is 1+1"
}
],
"model": "gpt-4o-0806",
"temperature": 0,
"tool_choice": "required",
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string"
},
"unit": {
"type": "string",
"enum": [
"c",
"f"
]
}
},
"required": [
"location",
"unit"
],
"additionalProperties": false
}
}
},
{
"type": "function",
"function": {
"name": "get_stock_price",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"symbol": {
"type": "string"
}
},
"required": [
"symbol"
],
"additionalProperties": false
}
}
}
]
}
Response:
{
"choices": [
{
"content_filter_results": {},
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"location\":\"New York\",\"unit\":\"c\"}",
"name": "get_weather"
},
"id": "call_3AttvQPe3fm6QHplq6th27jq",
"type": "function"
}
]
}
}
]
}
Model is making up values for required parameters, please advise how to solve the problem?