Files
crewAI/lib/crewai/tests
Devin AI 1fc133acc3 Fix #4509: Strip markdown code-block fences from LLM JSON responses in Converter
When LLMs return JSON wrapped in markdown code blocks (e.g. ```json...```),
the Converter.to_pydantic() method failed to parse the response, causing
Pydantic validation errors when saving to long-term memory.

Changes:
- Add _strip_markdown_fences() helper to remove markdown code-block delimiters
- Apply fence stripping before model_validate_json() in both function-calling
  and non-function-calling paths of Converter.to_pydantic()
- Add handle_partial_json() fallback in the function-calling path
- Apply fence stripping in convert_to_model() before json.loads()
- Add 11 tests covering the fix

Co-Authored-By: João <joao@crewai.com>
2026-02-18 13:18:51 +00:00
..
2026-02-13 21:34:37 -03:00
2025-10-20 14:10:19 -07:00
2025-12-04 16:53:19 -05:00
2026-02-13 21:34:37 -03:00
2026-02-13 21:34:37 -03:00
2025-10-20 14:10:19 -07:00
2026-02-13 21:34:37 -03:00
2025-12-04 13:34:29 -08:00
2025-12-05 13:23:26 -05:00
2025-10-20 14:10:19 -07:00
2026-02-13 21:34:37 -03:00
2025-12-01 18:56:56 -05:00
2025-10-20 14:10:19 -07:00
2025-10-20 14:10:19 -07:00
2025-10-20 14:10:19 -07:00