思考模式
用于复杂问题求解的扩展推理。
概述
思考模式(扩展推理)允许模型在生成最终回答之前"大声思考"。模型会产生逐步推理链,从而提高在数学、逻辑和代码分析等复杂任务上的准确性。
使用方法
使用支持推理的模型(如 deepseek-reasoner)时,思考模式会自动激活。推理输出出现在 reasoning_content 字段中:
TypeScript
| 1 | const stream = await client.chat.completions.create({ |
| 2 | model: 'deepseek-reasoner', |
| 3 | messages: [{ role: 'user', content: '证明根号2是无理数' }], |
| 4 | stream: true, |
| 5 | }); |
| 6 | |
| 7 | for await (const chunk of stream) { |
| 8 | const thinking = chunk.choices[0]?.delta?.reasoning_content; |
| 9 | if (thinking) process.stderr.write(thinking); |
| 10 | |
| 11 | const content = chunk.choices[0]?.delta?.content; |
| 12 | if (content) process.stdout.write(content); |
| 13 | } |
推理模型
支持扩展推理的模型包括:
deepseek-reasoner— DeepSeek 专用推理模型claude-opus-4— Anthropic Claude 推理模式o1、o1-mini— OpenAI 推理模型
在 模型页面 筛选推理模型。