Skip to content

Fix input type validation when input schema has multiple types #1530

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

duguyue100
Copy link
Contributor

This is a follow-up of #1505, I recently discovered that if the tool's input schema has multiple types while the parsed type is not, the tool calling breaks. The tool calling will return an error:

Argument description has type 'string' but should be '[string, null\]'

This little PR fixes it.

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

I added some tests and refactored the approach.

@albertvillanova albertvillanova merged commit 64a85b3 into huggingface:main Jul 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants