Commit Graph

2 Commits

Author SHA1 Message Date
Devin AI
d826b0ab52 Fix #5878: Preserve reasoning_content from DeepSeek thinking mode in conversation history
DeepSeek V4 models return reasoning_content alongside content when in thinking
mode. The API requires this field to be passed back in subsequent requests.
Previously, LLM.call() discarded reasoning_content and only returned the content
string, causing a 400 error on follow-up calls.

Changes:
- LLM.call(): Extract and store reasoning_content from the response message
- CrewAgentExecutor._format_msg(): Accept optional reasoning_content parameter
- CrewAgentExecutor._invoke_loop(): Include reasoning_content in assistant
  messages added to the conversation history

Tests added for:
- LLM storing reasoning_content from responses
- LLM returning None when reasoning_content is absent
- LLM resetting reasoning_content between calls
- Executor _format_msg including/excluding reasoning_content appropriately
- End-to-end invoke loop preserving reasoning_content in message history

Co-Authored-By: João <joao@crewai.com>
2026-05-21 05:10:38 +00:00
Thiago Moretto
4afb022572 fix LiteLLM callback replacement 2024-11-12 15:04:57 -03:00