feat: implement reasoning content passback for chat completions#72
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix DeepSeek OpenAI-compatible tool-call follow-up failures in thinking mode.
DeepSeek Chat Completions may return
reasoning_contenttogether with tool calls, and requires thatreasoning_contentbe passed back in the next API request. The conversation tool loop previously only preserved visible assistant content, so DeepSeek tool follow-up requests could fail withreasoning_content in the thinking mode must be passed back to the API.This change adds a route capability for
reasoning_contentpassback, stores streamed reasoning content, and includes it only for DeepSeek Chat Completions assistant tool-call messages.Change type
Affected areas
Verification
cd backend && go test ./internal/application/channelcd backend && go test ./internal/application/conversationcd backend && go test ./internal/infra/llmcd backend && go test ./...git diff --checkScreenshots, API examples, or logs
Before fix, DeepSeek tool follow-up requests could fail with:
Configuration, migration, and compatibility notes
No config changes, database migrations, or deployment changes are required.
The new
reasoning_contentpassback is scoped to DeepSeek routes using the OpenAI Chat Completions protocol. Other providers and protocols keep their existing request behavior.Documentation
Security and privacy
Checklist
.pycfiles,.envfiles, and local storage data are not committed.