mirror of
https://github.com/deepseek-ai/DeepSeek-R1.git
synced 2026-11-05 00:47:42 +00:00
[GH-ISSUE #360] 无法强制指定模型进入思维模式 <think> #280
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepSeek-R1#280
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jiumingzhijium on GitHub (Feb 10, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/360
在调用 deepseek-r1 的 api 时,模型总是会绕过思维模式,将 temperature 设置为0.6,在 prompt 最加入 也无法让模型在时回答带有 think
@Alphayellowcat commented on GitHub (Feb 10, 2025):
访问样例
r1的temperature其实并没有启用。我怀疑你没有修改代码把返回数据中的reasoning_content取出来。我写了一个简单样例,你可以参考一下:
@ariesfish commented on GitHub (Feb 11, 2025):
提示词加上输出格式,可以大幅提高思考概率
@jiumingzhijium commented on GitHub (Feb 11, 2025):
在使用代码时,我遇到了数据格式错误的提示,'ChoiceDelta' object has no attribute 'reasoning_content'
你: 非 飞机为什么会飞
是否显示思考过程?(y/n): y
思考过程:
发生错误:
'ChoiceDelta' object has no attribute 'reasoning_content'
我尝试打印 delta 得到的结果是这样的:Delta dict: {'content': '', 'function_call': None, 'refusal': None, 'role': 'assistant', 'tool_calls': None},没有 reasoning_content
@Alphayellowcat commented on GitHub (Feb 11, 2025):
我复现的时候时正常输出的,先显示“思考过程”再显示“最终答案”。
我想了一下可能是你环境里openai的包版本不对,导致找不到 reasoning_content 属性?
先试试
我这显示的version是1.60.0,如果不一样你可以试试重装
@jiumingzhijium commented on GitHub (Feb 11, 2025):
我发现这个错误和调用模型的方式有关,我升级了openai到1.60.0,还是会出现问题
由于官方的 api 调用目前不可用,我使用了 openrouter 里面的 R1 模型,这是会出现'ChoiceDelta' object has no attribute 'reasoning_content',当使用阿里的 R1 模型时,就没有问题
我不理解相同的模型为什么会返回格式不一致
请问你这里使用的是哪里调用的 R1 模型
@jiumingzhijium commented on GitHub (Feb 11, 2025):
我找到原因了,是 openrouter 调用 R1 推理模型的坑:openrouter 返回数据不会默认包含 reasoning 字段(这里面是 R1 的推理过程),在调用 api 需要增加"include_reasoning": True,才能返回 reasoning 字段
@Alphayellowcat commented on GitHub (Feb 11, 2025):
我用的deepseek官方的api,按照官方文档改的。
找到问题就行。
@github-actions[bot] commented on GitHub (Mar 24, 2025):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!
@github-actions[bot] commented on GitHub (Apr 29, 2025):
false