Commit Graph

2 Commits

Author SHA1 Message Date
Devin AI
1b75090dc2 Address code review feedback: enhance sanitize_tools with better documentation, error handling, and type validation
- Add comprehensive docstring with Args, Returns, and Example sections
- Implement try-catch error handling with logging for unexpected scenarios
- Add stronger type validation for dictionary values
- Include logging for debugging when non-dict objects are filtered
- Add type annotations for better maintainability and IDE support
- Add parameterized tests for better coverage and organization
- Add performance tests for large datasets
- Add tests for invalid dict value types and error handling scenarios

Addresses feedback from joaomdmoura and mplachta on PR #3044

Co-Authored-By: João <joao@crewai.com>
2025-06-21 16:38:19 +00:00
Devin AI
b2bda39e56 Fix Pydantic validation error in LLMCallStartedEvent when TokenCalcHandler in tools list
- Add model_validator to sanitize tools list before validation
- Filter out non-dict objects like TokenCalcHandler from tools list
- Preserve dict tools while removing problematic objects
- Add comprehensive test coverage for the fix and edge cases
- Resolves issue #3043

Co-Authored-By: João <joao@crewai.com>
2025-06-21 16:33:22 +00:00