Commit Graph

2 Commits

Author SHA1 Message Date
Devin AI
fd5cd14eb0 Fix lint issue: remove unused pytest import
Co-Authored-By: Jo\u00E3o <joao@crewai.com>
2025-07-19 22:59:52 +00:00
Devin AI
b7cb0186bd Fix LLMGuardrailResult JSON parsing with trailing characters
- Extract robust JSON cleaning logic into shared clean_json_from_text() function
- Update LiteAgent to use clean_json_from_text() before model_validate_json()
- Add comprehensive test cases for JSON with trailing characters, markdown formatting, and prefixes
- Fixes GitHub issue #3191 where valid JSON failed to parse due to trailing text
- Maintains backward compatibility with existing JSON parsing behavior

Co-Authored-By: Jo\u00E3o <joao@crewai.com>
2025-07-19 22:56:22 +00:00