-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support Reasoning via Deepseek and Openrouter API (OpenAI Compatible) #1664
Comments
Hi thanks for opening this! Yeah this is not ideal since the way we currently handle reasoning is directly on the token stream (find begin/end tokens, things like that) which is endpoint agonistic but this would require endpoint specific-code. Not yet sure what the best way to tackle this is, I'm open to suggestions! |
Looks like OpenRouter is pushing a new Reasoning Model Standard: By including the "include_reasoning" parameter to send back reasoning tokens. Its still unclear if its part of the token stream or a separate field in the response. |
After playing around with the include_reasoning parameter in OpenRouter, here's how it works: The request (via OpenAI SDK):
completion.choices[0]:
The response is returned in the reasoning field. Since this is intended to be a new standard (and is deployed across all the Open Router reasoning models), it would be nice if HuggingChat would support this. |
@gururise any idea how to get reasoning back in using streaming? It's not compatible with Open AI's SDK at the very least :/ |
Check my code snippet above. Seems to work on OpenAI SDK, at least for non-streaming. I haven't tested w/streaming. |
The Thinking indicator never shows up if using the Deepseek API or OpenRouter (via OpenAI compatibility):
Config:
The problem is DeekSeek API returns the reasoning in a separate
reasoning_content
field in the response.As far as I can tell, none of the three existing methods will work to read this extra field in the response.
Example streaming response:
Please add support for DeepSeek API and OpenRouter API by adding an additional parameter to parse an extra field in the response for reasoning.
The text was updated successfully, but these errors were encountered: