-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: recursively apply strict schema constraints for tools_strict=True #11232
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
base: main
Are you sure you want to change the base?
Changes from all commits
d0b225e
a8b85a7
3fc29c4
ae196c7
f09e947
06b2939
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| fixes: | ||
| - | | ||
| Fixed ``tools_strict=True`` in ``OpenAIChatGenerator`` to recursively apply | ||
| ``additionalProperties: false`` and ``required`` to all nested objects in tool | ||
| parameter schemas. Previously only the top-level object was transformed, causing | ||
| OpenAI's strict mode to reject tools with nested parameters. |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for all of the unit tests, but could we also make one integration test that would have failed before this change? Perhaps take a complicated one like
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed a fix where I added test_prepare_api_call_strict_complex_tool; it takes the same schema structure from test_complex_schema_with_defs_and_combinators and puts it thru _prepare_api_call with tools_strict=True Fails on the old code b/c nested objects dont have additionalProperties: false
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right thanks but we should still add an integration test so we can see if the schema is actually accepted by OpenAI. We have other integration tests in this file to see how to structure them to be skipped if an API key is missing.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added test_live_run_strict_nested_tool and test_prepare_api_call_strict_component_tool |
Uh oh!
There was an error while loading. Please reload this page.