-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix: #2155 DeepSeek reasoning_content missing in tool call messages #2328
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5dbdcc302a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
5dbdcc3 to
f8c3a0f
Compare
|
@codex review again |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
- Add pending_reasoning_content tracking for DeepSeek models - Extract reasoning content from summary field in reasoning items - Apply reasoning_content to assistant messages with tool_calls - Works for both LiteLLM and OpenAI ChatCompletions paths Fixes openai#2155
f8c3a0f to
c7fddce
Compare
|
can you fix the lint issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df5e138c48
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
can you fix the mypy error? |
This PR fixes issue #2155 (400 error on tool calls due to missing
reasoning_contentin reconstructed assistant messages.)Root Cause: When DeepSeek returns a response with
reasoning_contentandtool_calls, the SDK converts it to:ResponseReasoningItem(stores reasoning insummaryfield)ResponseFunctionToolCall(stores tool call)On the next API call,
Converter.items_to_messages()reconstructs the assistant message with tool calls, but was only handling reasoning content for Anthropic/Claude models (via thinking blocks), not DeepSeek.Solution: The fix follows the same pattern as Anthropic's thinking blocks but uses DeepSeek's
reasoning_contentfield instead. It:summaryfield when processing reasoning items for DeepSeek modelspending_reasoning_contentChecks
make lintandmake format(linter shows only import resolution warnings, not code issues)Note: The fix works for both code paths:
LitellmModelwithmodel="deepseek/deepseek-reasoner"OpenAIChatCompletionsModelwithmodel="deepseek-reasoner"and DeepSeek's OpenAI-compatible endpoint