-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[DRAFT] feat: support deepseek-reasoner #8776
base: main
Are you sure you want to change the base?
[DRAFT] feat: support deepseek-reasoner #8776
Conversation
Completed E2E test with real deepseek-reasoner API. Additional notes: deepseek API has undergoing issues due to recent attacks and the generator would fail ungracefully. We might need to add more try-except clauses here and there. |
@@ -348,6 +348,14 @@ def _convert_streaming_chunks_to_chat_message(self, chunk: Any, chunks: List[Str | |||
text = "".join([chunk.content for chunk in chunks]) | |||
tool_calls = [] | |||
|
|||
reasoning_content = None | |||
for chunk in chunks: | |||
if chunk.reasoning_content is not None: |
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.
@LastRemote is this some typo here? Why have the same nested if?
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.
Yes, these are some redundancies. I rushed the code before the vacation without taking a deeper thought, sorry about that. Will fix and add appropriate testing/documentation.
@LastRemote a short reno note helps us make really nice release notes. Would you please add one to this PR?
Looking forward to these updates and let's involve @anakin87 for a final check as well |
For sure. It was meant to be an untested sketch so I kind of rushed it before taking the vacation. Definitely needs some further polishing here and there. |
Sorry for not participating in the discussion... |
I finally found some time to look at this. The primary goal of the changes introduced in this PR is supporting deepseek-reasoner, following their API reference. I am a bit hesitant because I have tried DeepSeek R1 through different inference providers (Together.ai, DeepInfra) and I see that, in different ways, they put the thinking part in the textual In any case, we are not supporting the "official" DeepSeek API at the moment, so let's talk/discuss this topic @vblagoje. |
@anakin87 Sorry for the late reply. I was a bit too busy these weeks.
Yes. I expect this to converge at some point, but the main scope of this PR is to update Btw, my expectation is that the raw format (with |
So in conclusion @LastRemote and @anakin87 we can add reasoning traces directly to text portion of the ChatMessage until some sort of a standard appears? And also have it include these think tags as users can then remove them if needed via simple regex? |
@vblagoje I was thinking something similar: for now, do not change |
My idea is quite the contrary: update |
Yes, fair point @LastRemote - let us sync internally and we'll move this one forward soon. |
@LastRemote for the time being, after an internal discussion, we have decided that it is okay to make a small modification to OpenAIChatGenerator to include thinking in the text. |
@vblagoje Thanks for the reply. It is understandable, although I would still prefer the other way. I will need to re-evaluate what should be done to modify OpenAIChatGenerator without changing the structure of ChatMessage, likely in a lower priority. IMO there is not much to do since the only difference is that P.S. As I mentioned earlier, I am currently using a heavily modified |
Related Issues
Proposed Changes:
Added a reasoning_content field for both ChatMessage and StreamingChunk
How did you test it?
This is not thoroughly tested and should stay as a draft PR.
Notes for the reviewer
Hello, this is a draft PR that adds support for reasoning models, with untested sample code to support deepseek-reasoner style APIs in OpenAIChatGenerator. I will be away for the rest of the week (responses might be delayed), but feel free to take over.
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
and added!
in case the PR includes breaking changes.