Enable javascript in your browser for better experience. Need to know to enable it? Go here.

Structured output from LLMs

Last updated : Apr 15, 2026
Apr 2026
Adopt ?

Structured output from LLMs is the practice of constraining models to produce responses in a predefined format, such as JSON or a specific programming language class. We continue to see this technique deliver reliable results in production, and we now consider it a sensible default for applications that consume LLM responses programmatically. All major model providers now offer native structured output modes, but implementations differ in the JSON Schema subsets they support, and these APIs continue to evolve rapidly. We recommend using a library such as Instructor or a framework like Pydantic AI to provide a stable abstraction across providers with validation and automatic retries, or Outlines for constrained generation on self-hosted models.

Nov 2025
Trial ?

从LLMs获取结构化输出 是指通过对大语言模型进行约束,使其输出符合预定义格式(如 JSON 或特定的编程类)。这一技术对构建可靠、生产级应用至关重要,它能将 LLM 通常不可预测的文本转化为机器可读、确定性的数据契约。基于我们的生产实践成果,我们将该技术从“评估”阶段提升为“试用”阶段。 相关方法覆盖从简单的提示词格式化、模型原生结构化输出,到更为健壮、借助 OutlinesInstructor 等工具实现的约束解码方式,这些工具通常通过有限状态机来确保输出的合法性。我们已经成功运用这一技术,从各类文档中提取复杂的非结构化数据并转换为结构化的 JSON,以便后续业务逻辑处理。

Apr 2025
Assess ?

从 LLMs 获取结构化输出 是指通过定义的结构模式来约束语言模型的响应。这可以通过指示通用模型以特定格式响应,或者通过微调模型使其“原生”输出例如 JSON 的结构化数据来实现。OpenAI 现在支持结构化输出,允许开发人员提供 JSON Schema、pydantic 或 Zod 对象来约束模型响应。这种能力在函数调用、API 交互和外部集成中尤其有价值,因为这些场景中格式的准确性和一致性至关重要。结构化输出不仅提升了 LLMs 与代码交互的方式,还支持更广泛的使用场景,例如生成用于呈现图表的标记语言。此外,结构化输出已被证明可以减少模型输出中的幻觉现象。

Oct 2024
Assess ?

从 LLMs 获取结构化输出 是指通过定义的结构模式来约束语言模型的响应。这可以通过指示通用模型以特定格式响应,或者通过微调模型使其“原生”输出例如 JSON 的结构化数据来实现。OpenAI 现在支持结构化输出,允许开发人员提供 JSON Schema、pydantic 或 Zod 对象来约束模型响应。这种能力在函数调用、API 交互和外部集成中尤其有价值,因为这些场景中格式的准确性和一致性至关重要。结构化输出不仅提升了 LLMs 与代码交互的方式,还支持更广泛的使用场景,例如生成用于呈现图表的标记语言。此外,结构化输出已被证明可以减少模型输出中的幻觉现象。

Published : Oct 23, 2024

Download the PDF

 

 

 

English | Português 

Sign up for the Technology Radar newsletter

 

 

Subscribe now

Download the PDF

 

 

 

English | Português 

Sign up for the Technology Radar newsletter

 

 

Subscribe now

Visit our archive to read previous volumes