Replies: 3 comments 12 replies
-
|
@mlynch I've written up a short guide on how to improve tool calling with the AI SDK: https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling#prompt-engineering-with-tools Automatic retries when the parsing fails are planned (no timeline yet) |
Beta Was this translation helpful? Give feedback.
-
|
It happened to me when I set the whole z.object to optional, if you do so, try removing it (or if you have a nested optional on the parameters) and check if it works. |
Beta Was this translation helpful? Give feedback.
-
|
@lgrammel I'm asking this here as it's the most related topic I've found. But do you know how I can handle these zod validation errors in tools calls with streamUi? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using tool/function calling to modify a data structure (using gpt-4o). My tool has a number of parameters, such as
labelanddescriptionof a new item to add to the structure. Often, the tool will be called with missing fields as required by the zod schema, causing a runtime error. I am unsure what to do in this situation. I would think the model just wouldn't call my tool if it wasn't able to provide the required parameters, yet it does. I'm really at a loss about how to handle this scenario or even how error handling works in this case.Any advice?
Beta Was this translation helpful? Give feedback.
All reactions