Skip to content

Fix WebSearchTool validation error #1367

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

Merged

Conversation

albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented May 22, 2025

Fix WebSearchTool validation error when calling to_dict.

Currently, WebSearchTool().to_dict() raises a validation error:

ValueError: Tool validation failed for WebSearchTool:
- _create_duckduckgo_parser: Name 'SimpleResultParser' is undefined.
- _create_duckduckgo_parser: Name 'SimpleResultParser' is undefined.

The issue is caused by the MethodChecker, which does not track class definitions.

This PR ensures that internal class definitions are properly tracked during validation.

Copy link
Collaborator

@aymeric-roucher aymeric-roucher left a comment

Choose a reason for hiding this comment

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

Thank you @albertvillanova !

@albertvillanova albertvillanova merged commit 41b1d7f into huggingface:main May 22, 2025
3 checks passed
@albertvillanova albertvillanova deleted the fix-web-search-tool-to-dict branch May 22, 2025 14:40
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.

2 participants