技能 人工智能 DeepSeek 推理模型

DeepSeek 推理模型

v20260902
deepseek-reason
封装 DeepSeek 的 deepseek-reasoner 模型,将思维链推理过程与最终答案分别返回。适用于证明、规划、根因分析、疑难问题排查等多步推理任务,可查看模型思考过程用于审核或验证。通过环境变量读取 API 密钥,不可用时优雅降级。
获取技能
429 次下载
概览

Wraps DeepSeek's reasoning model so ruflo callers can get an explicit chain-of-thought back with the final answer, without having to parse it out of the message content. Same subprocess-invocation shape as the sibling deepseek-chat skill.

When to use

  • Multi-step reasoning tasks: proofs, plans, root-cause analysis, hard bug triage.
  • You want to see the model's thinking (for audit, for training data, or to sanity-check its final answer).
  • You can tolerate the higher latency and token cost of a reasoner vs deepseek-chat.

Algorithm

Implementation: scripts/reason.mjs.

  1. Read DEEPSEEK_API_KEY from env. Degrade gracefully when missing.
  2. POST to /v1/chat/completions with { model: 'deepseek-reasoner', messages, max_tokens? }. Per DeepSeek's docs, temperature/top_p are ignored for reasoner models — this script does not forward them.
  3. Extract choices[0].message.content AND choices[0].message.reasoning_content.
  4. JSON output always includes reasoning; table mode omits it unless --show-reasoning is passed.
  5. reasoningTokens (from usage.completion_tokens_details.reasoning_tokens) is surfaced separately so callers can attribute cost.

Example

node plugins/ruflo-deepseek-harness/scripts/reason.mjs \
  --prompt "Prove that sqrt(2) is irrational." \
  --format table --show-reasoning

Table output shows the reasoning block, then the answer. JSON mode returns:

{
  "status": "ok",
  "model": "deepseek-reasoner",
  "content": "sqrt(2) is irrational because …",
  "reasoning": "Assume for contradiction that sqrt(2) = p/q in lowest terms …",
  "finishReason": "stop",
  "usage": {
    "promptTokens": 14,
    "completionTokens": 812,
    "reasoningTokens": 640,
    "totalTokens": 826
  }
}
信息
Category 人工智能
Name deepseek-reason
版本 v20260902
大小 2.45KB
更新时间 2026-09-05
语言