Support for reasoning_content in API#3202
Conversation
c3a3d81 to
cd0af57
Compare
…esponse behavior.
cd0af57 to
d856124
Compare
|
Good work! It works for me. :D |
…model, also handle first response while separating reasoning.
Ok |
|
Also looking at the unit test failures. |
|
@zhaochenyang20 addressed your comment. |
|
@shuaills This is related to your work? Could you review this? Thnaks! |
|
I found a problem. When I use Can the function implemented as
|
|
I will review this @zhaochenyang20 |
Now maybe it makes sense to add a check for Edit: ah, i think I see what you mean now @xihuai18 , you'd like to bring back the This makes sense to me, I'll take a look at the change today. |
…using the given `--reasoning-parser`. Also allow disabled reasoning parsing on a per-request basis using `req.separate_reasoning`. Finally preference a reasoning parser supplied at server startup over detecting the parser using `req.model`.
|
@zhaochenyang20 @xihuai18 @shuaills take a look |
|
Thanks. I will remind shuai |
shuaills
left a comment
There was a problem hiding this comment.
Thanks for this PR, overall it looks great. And there are a few points need to change.
- there's no need to use two flags; it's redundant. Parameters can be passed in the request instead.
- the code could be written in a more Pythonic style. I've marked one instance.
- please format the documentation as a Jupyter notebook, similar to the tool call documentation.
- this should support both native API and offline engine.
- Xihuai @xihuai18 has submitted a similar PR. I think you could join the Slack channel to work on this together - he's done some excellent work.
| @@ -0,0 +1,141 @@ | |||
| # Reasoning Parser | |||
There was a problem hiding this comment.
Can you move this under Advanced Features and make it an ipynb?
There was a problem hiding this comment.
This is a good idea, though it increases the scope of this PR
further and i'd really like to get this merged asap to get Microsoft internal branch back in sync with main.
Would you consider a follow up task for this @shuaills ?
There was a problem hiding this comment.
@xihuai18 has done it. Can we discuss this on slack? https://slack.sglang.ai/
| :maxdepth: 1 | ||
|
|
||
| deepseek.md | ||
| reasoning_parser.md |
There was a problem hiding this comment.
move this under Advanced Features
| if ( | ||
| separate_reasoning != False | ||
| and (parse_reasoning or separate_reasoning) | ||
| and (reasoning_parser or is_reasoning_model(model)) | ||
| ): |
There was a problem hiding this comment.
if (
separate_reasoning and
(reasoning_parser or is_reasoning_model(model))
):
There was a problem hiding this comment.
Working on which part? Happy to merge a PR you make into the brush on my fork, but it would be good to understand what we're trying to achieve.
There was a problem hiding this comment.
Can you enter https://slack.sglang.ai/ and we talk about it ? @tot0
If sglang would rather not have the option to force reasoning parsing at startup then it gets much simpler. If sglang prefers the
|
|
Hey, just wanted to check—do we actually need separate_reasoning? It’s not supported by DeepSeek API, and I’m having a bit of trouble seeing the use case for it. |
see the docs in #4000 |
I’ve gone through the PR, but I’m still unclear about the specific scenarios where separate_reasoning=False would be appropriate. That said, it’s totally fine to have this setting available. |
The original reason for In #4000 the current default behavior is |
|
SGTM. It makes sense. Thanks. |
I agree with this suggestion |
Could you suggest a param name and I will implement it quickly today? |
And I think set default mode as not separating and add a param to force separating is more reasonable. @tot0 Can you accept this plan? |
As a new PR maybe. |
|
Superseded by #4000 |
The last commit on #4001 has a suggested param name, and the rest of the changes to allow changing the default value of |
Not sure if it's how folks want this done, but it works for me :)
Sorry I don't have time to add unit tests right now, if the general implementation is acceptable I can look at how to add the unit tests soon.I found the time to implement unittests!
#3043
Motivation
Some people wanted the
reasoning_contentfunctionality like DeepSeeks API.Modifications
Added a reasoning parser to /chat/completions API similar to Tool parsing.
Checklist