-
-
Notifications
You must be signed in to change notification settings - Fork 667
Update README.md #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update README.md #691
Conversation
Fix tool call example
iBotPeaches
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit I haven't used Chat Completion since Response API came out, but this seems wrong. So can you provide why you think this needs to be different? Is it the case that OpenAI docs are wrong?
I'm looking at this sample
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4.1",
"messages": [
{
"role": "user",
"content": "What is the weather like in Boston today?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}'|
There are differences in the tools schema when moving to the Responses API, acknowledge d here https://platform.openai.com/docs/guides/migrate-to-responses Specifically, the new schema is shown here https://platform.openai.com/docs/guides/function-calling So the README is correct for the Chat Resource. You need a different schema for the Responses resource (no example provided today, except the built-in I hope this helps. |
|
Okay so that was my confusion. You wanted to add an example for function call for Responses API, but edited the Chat completion one on accident? |
|
I guess that's what Emerson (the originator) meant. This is Thomas here Connor, trying to help. |
This reverts commit 3c11934.
|
Sorry for the confusion. My goal was to provide an example of how to use the function tool, but I didn't noticed that it was on the wrong place. I’ve reverted my earlier change and added a new section with the example. Hopefully, this will be useful for other developers. |
|
Thx for the feedback, I did the change. |
|
thanks! |
What:
Description:
Fix tool call example on README