skyworker
V2EX  ›  Local LLM

使用 dify 编写智能体的时候, 如何让 LLM 节点能够强制输出结构化输出 Schema

  •  
  •   skyworker · Jul 21, 2025 · 1662 views
    This topic created in 319 days ago, the information mentioned may be changed or developed.

    目前在 dify 中,LLM 节点中,设置了结构化输出 Schema ,需要 LLM 能输出一个标准的文档

    { "properties": { "content": { "description": "输出内容 Markdown 文本", "type": "string" } }, "required": [ "content" ], "type": "object" }

    但是每次 LLM 输出结果都很玄学,有时候能根据要求输出,有时候没有输出。(有点像中医)

    有什么好的提示词,能够保证 LLM 按照要求输出结构化输出 Schema ?

    huangfuyingjian
        1
    huangfuyingjian  
       Jul 21, 2025
    最好还是优先使用支持 JSON Schema 的模型,有的模型不支持 JSON Schema 的话,Dify 的处理规则是作为提示词注入的,效果可能会差一些。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1090 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:25 · PVG 07:25 · LAX 16:25 · JFK 19:25
    ♥ Do have faith in what you're doing.