跳到主要内容Skip to main content

结构化输出Structured Output

Structured Output

  • 智能体Agents
  • 第三站 · 用深Station 3 · Going Deeper
解决什么问题What problem it solves

让模型的回答是严格的格式(JSON 等),而不是一段散文。Make the model's answer a strict format (JSON and the like) rather than a paragraph of prose.

这是什么What it is

约束模型输出为机器可解析的结构,供程序直接使用。

Constraining the model to output machine-parsable structure that a program can consume directly.

为什么需要知道Why it matters

工具调用的前提。没有它,模型没法可靠地告诉程序「该调什么、传什么参数」。A precondition for tool calling. Without it a model cannot reliably tell a program what to call or which arguments to pass.

出处Sources
  • OpenAI 结构化输出指南OpenAI Structured Outputs Guide ↗
  • Pydantic AI 结构化输出Pydantic AI: Output ↗