test: do tool calls improve with openai input schema style?#692
Draft
test: do tool calls improve with openai input schema style?#692
Conversation
Contributor
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 767af3ec709be0e123d37128 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@jerelmiller has told me that a number of tools just don't get called right by some agents, so my suspicion is that these tools first try to "just generate the tool call", and if that doesn't work apply a step similar to the Vercel SDK's
experimental_repairToolCall, in which they probably try to call the model's variant ofgenerateObjectwith theinputSchema.In the case of OpenAI models, the JSON Schema specification for that kind of call is very restricted, see their documentation.
Most importantly: there are no optional fields - every field has to be
required, andadditionalPropertiesalways needs to befalse.Our schemas currently don't fit these requirements - so let's just try if that improves the situation.
Obviously, this is not a fully functional PR, and tons of tests are still failing, but it should be enough for Jerel to build this locally and try out if the quality of tool calls improves.
Note: there are a lot of additional subtleties, so please inspect the generated schema if it really matches the OpenAI requirements before drawing any conclusions from this 😅