Skip to content

文本生成

DeepSeek 文本生成适合聊天、写作、总结、改写、分类、抽取、客服回复和知识库问答。

基础文本生成

json
{
  "model": "deepseek-v4.5-chat",
  "messages": [
    { "role": "user", "content": "Write a product description in fewer than 100 words" }
  ]
}

长文本总结

json
{
  "model": "deepseek-v4.5-chat",
  "messages": [
    {
      "role": "system",
      "content": "You are a document summarization assistant. Preserve key facts, amounts, dates, responsible parties, and risks."
    },
    {
      "role": "user",
      "content": "Summarize the following contract content: ..."
    }
  ]
}

分类与抽取

json
{
  "model": "deepseek-v4.5-chat",
  "temperature": 0,
  "messages": [
    {
      "role": "user",
      "content": "Classify the text as complaint, inquiry, or praise. Text: I paid, but the order has not arrived."
    }
  ]
}

最佳实践

  • 通用文本任务优先用 deepseek-v4.5-chat
  • 分类和抽取降低 temperature
  • 长文档先切分再总结
  • 输出 JSON 时配合服务端校验
  • 大批量任务记录 token 和成本