-
Notifications
You must be signed in to change notification settings - Fork 819
Add reasoning content support (for DeepSeek format API) #840
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
base: master
Are you sure you want to change the base?
Add reasoning content support (for DeepSeek format API) #840
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.
Pull Request Overview
Adds support for embedding reasoning_content
segments in both streaming and single-response flows for the DeepSeek-format API.
- Loads
delta.reasoning_content
andmessage.reasoning_content
when available. - Wraps reasoning segments with
[Think]
and[Response]
markers during streaming and in one-shot responses.
Comments suppressed due to low confidence (2)
src/services/apis/custom-api.mjs:42
- [nitpick] Variable names like
with_reasoning
use snake_case, which differs from the project's camelCase convention; consider renaming towithReasoning
, and similarly updatehas_reasoning_start
/has_reasoning_end
tohasReasoningStart
/hasReasoningEnd
.
let with_reasoning = false
src/services/apis/custom-api.mjs:87
- New reasoning_content handling logic is introduced here but lacks accompanying unit tests to validate both streaming and single-response behaviors; consider adding tests for scenarios with and without
reasoning_content
.
const delta_reasoning = data.choices[0]?.delta?.reasoning_content
let has_reasoning_start = false | ||
let has_reasoning_end = false | ||
|
||
const REASONING_START_SIGN = '[Think]\n\n' |
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.
[nitpick] Magic strings for reasoning markers are declared inline; extracting these markers into a shared constants module or configuration will improve maintainability and consistency.
Copilot uses AI. Check for mistakes.
/review |
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here. PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
/improve |
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here. PR Code Suggestions ✨
|
For customAPI, try to load delta.reasoning_content and message.reasoning_content if it exists.
For DeepSeek-R1

For GPT-4o

Currently only delta part (streaming) has been tested (I don't know how to trigger a single-request chat completion with the repo).
I'm not familiar with nodejs. Please help me to improve it if possible, thank you!