-
Notifications
You must be signed in to change notification settings - Fork 506
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
Handle optional func args in tool calls when set to None
#1211
Conversation
🦋 Changeset detectedLatest commit: 65d0c03 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
nice
@jayeshp19 can you add a changeset? |
It's already added, not sure why It's not detecting.. |
retried and it detected |
@@ -64,13 +64,19 @@ def create_ai_function_info( | |||
inner_type = typing.get_args(arg_info.type)[0] |
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.
fetching the first argument does not work for type definitions like Union[None, str]
or None | str
, where the None is passed as the first argument. The validation should verify if arguments lengths is between 1 and 2 and then take the first matched non-None-type argument.
This PR fixes ValueError when optional function args are set to
None
Related issues:
#1185
#1208