技能 人工智能 DeepSeek 对话补全

DeepSeek 对话补全

v20260902
deepseek-chat
通过 OpenAI 兼容接口调用 DeepSeek 的 deepseek-chat 模型,实现单轮对话补全。适合摘要、信息抽取和快速分类等非推理任务,支持 JSON 输出、环境变量读取 API 密钥,并在接口不可用时优雅降级。
获取技能
477 次下载
概览

Wraps DeepSeek's chat/completions endpoint in the same subprocess-invocation shape as the other ruflo-*-harness skills (see ruflo-metaharness's harness-score for the reference). No library import on ruflo's boot path.

When to use

  • You want a cheap, fast completion from a non-reasoning model.
  • The task fits in a single request/response — no multi-turn context.
  • You want the raw content back as JSON so downstream tooling can consume it.
  • For reasoning-heavy tasks (proofs, multi-step planning, hard debugging), use deepseek-reason instead — same plugin, different model.

Algorithm

Implementation: scripts/chat.mjs.

  1. Read DEEPSEEK_API_KEY from env. If missing, emit { status: 'degraded', reason: 'DEEPSEEK_API_KEY is not set', ... } and exit 0 (ADR-150-style graceful degradation).
  2. POST to https://api.deepseek.com/v1/chat/completions with { model, messages, temperature?, max_tokens? }. 60s hard timeout.
  3. Extract choices[0].message.content and usage counters.
  4. --format table prints only the content (for piping); --format json (default) returns the full envelope.
  5. --alert-on-error exits 1 on any degraded/error status (CI-friendly).

Example

node plugins/ruflo-deepseek-harness/scripts/chat.mjs \
  --prompt "In one sentence: what is HNSW?" \
  --temperature 0.2

Sample output:

{
  "status": "ok",
  "model": "deepseek-chat",
  "content": "HNSW is a graph-based approximate nearest neighbor …",
  "finishReason": "stop",
  "usage": { "promptTokens": 12, "completionTokens": 34, "totalTokens": 46 }
}
信息
Category 人工智能
Name deepseek-chat
版本 v20260902
大小 2.21KB
更新时间 2026-09-05
语言