-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Added example notebook for handling function calls with reasoning models #1796
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
Conversation
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.
love the cookbook and the idea! made a few comments overall on how it could be rephrased a bit or restructured, there's things you can take as feedback some others you can ignore it's not a grounded truth! I'm wondering if we couldn't find a more "real" use-cases that'd involve reasoning and function calling (e.g: RAG on policies, mocking up some users and a customer service use-cases where you might need to fetch more information of the user (e.g: payment history in a payment context) based on policy+user information – that basically involves multi turn function calling and reasoning in between) – but also understand that's more work and this is already high quality bar so I'm happy to also approve this with the current use-case
Thanks @tompakeman-oai !
], | ||
"source": [ | ||
"# Let's keep track of the response ids in a naive way, in case we want to reverse the conversation and pick up from a previous point\n", | ||
"response = client.responses.create(input=\"Which of the last four Olympic host cities has the highest average temperature?\", **MODEL_DEFAULTS)\n", |
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.
For readability (avoiding horizontal scroll) on cookbook, might be better to have new line for arguments
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.
Also the question looks like a fact-based one which is more suited for web_search than base knowledge (even if that works and is true, could be misleading, as o3 and o4-mini don't support web search)
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.
Good point - I agree this could be misleading. How would you feel about publishing this now to prioritise speed, but I will come up with a better use case for a v2?
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.
agree!
"More reasoning required, continuing...\n", | ||
"Invoking tool: get_city_uuid({'city': 'Tokyo'})\n", | ||
"More reasoning required, continuing...\n", | ||
"Invoking tool: get_city_uuid({'city': 'Paris'})\n", |
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.
very good example of multiple calls! I'm wondering if 4o wouldn't get it with parallel as it looks very simple and each step doesn't involve reasoning. It could involve reasoning if you got information back from one of the call to define the next one, that's something 4o can't do by themselves.
I also think that 4o wouldn't be perfect to do >~ 10 calls as it'll might loose some in the context/process so that can be enough but worth highlighting the use-cases in the cookbook as text?
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.
As above - I will try and find a more real-world use case for v2 which requires reasoning and has dependencies between the function outputs and reasoning steps
thank you!! |
Summary
This adds a cookbook demonstrating how to make function calls when using Reasoning models such as o4-mini.
When contributing new content, read through our contribution guidelines, and mark the following action items as completed:
We will rate each of these areas on a scale from 1 to 4, and will only accept contributions that score 3 or higher on all areas. Refer to our contribution guidelines for more details.