Skip to content

Commit 8dd2c43

Browse files
Merge pull request #4321 from santiagxf/santiagxf/structure-outputs
feat: structured outputs
2 parents 47cb819 + a63d03e commit 8dd2c43

File tree

10 files changed

+1361
-0
lines changed

10 files changed

+1361
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: How to use structured outputs for chat models
3+
titleSuffix: Azure AI Foundry
4+
description: Learn how to use structure outputs with chat completions with Azure AI model inference
5+
manager: scottpolly
6+
author: msakande
7+
reviewer: santiagxf
8+
ms.service: azure-ai-model-inference
9+
ms.topic: how-to
10+
ms.date: 1/21/2025
11+
ms.author: mopeakande
12+
ms.reviewer: fasantia
13+
ms.custom: references_regions
14+
zone_pivot_groups: azure-ai-inference-samples
15+
---
16+
17+
# How to use structured outputs for chat models
18+
19+
20+
::: zone pivot="programming-language-python"
21+
22+
[!INCLUDE [python](../includes/use-structured-outputs/python.md)]
23+
::: zone-end
24+
25+
26+
::: zone pivot="programming-language-javascript"
27+
28+
[!INCLUDE [javascript](../includes/use-structured-outputs/javascript.md)]
29+
::: zone-end
30+
31+
32+
::: zone pivot="programming-language-java"
33+
34+
[!INCLUDE [java](../includes/use-structured-outputs/java.md)]
35+
::: zone-end
36+
37+
38+
::: zone pivot="programming-language-csharp"
39+
40+
[!INCLUDE [csharp](../includes/use-structured-outputs/csharp.md)]
41+
::: zone-end
42+
43+
44+
::: zone pivot="programming-language-rest"
45+
46+
[!INCLUDE [rest](../includes/use-structured-outputs/rest.md)]
47+
::: zone-end
48+
49+
## Related content
50+
51+
* [Use embeddings models](use-embeddings.md)
52+
* [Use image embeddings models](use-image-embeddings.md)
53+
* [Use reasoning models](use-chat-reasoning.md)
54+
* [Azure AI Model Inference API](.././reference/reference-model-inference-api.md)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: How to use structured outputs for chat models with Azure AI model inference
3+
titleSuffix: Azure AI Foundry
4+
description: Learn how to use structured outputs with chat completions with Azure AI model inference
5+
manager: scottpolly
6+
author: msakande
7+
reviewer: santiagxf
8+
ms.service: azure-ai-model-inference
9+
ms.topic: how-to
10+
ms.date: 1/21/2025
11+
ms.author: mopeakande
12+
ms.reviewer: fasantia
13+
zone_pivot_groups: azure-ai-inference-samples
14+
---
15+
16+
> [!NOTE]
17+
> This example is not available in the selected language.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
manager: nitinme
3+
ms.service: azure-ai-model-inference
4+
ms.topic: include
5+
ms.date: 1/31/2025
6+
ms.author: fasantia
7+
author: santiagxf
8+
---
9+
10+
[!INCLUDE [Feature preview](~/reusable-content/ce-skilling/azure/includes/ai-studio/includes/feature-preview.md)]
11+
12+
When working with software, it's more challenging to parse free-form text outputs coming from language models. Structured outputs, like JSON, provide a clear format that software routines can read and process. This article explains how to use structured outputs to generate specific JSON schemas with the chat completions API with models deployed to Azure AI model inference in Azure AI services.
13+
14+
Typical scenarios of structured outputs include:
15+
16+
> [!div class="checklist"]
17+
> * You need to extract specific information from a prompt and such information can be described as an schema with specific keys and types.
18+
> * You need to parse information contained in the prompts.
19+
> * You are using the model to control a workflow in your application where you can benefit from more rigid structures.
20+
> * You are using the model as a zero-shot or few-shot learner.
21+
22+
## Prerequisites
23+
24+
To use structured outputs with chat completions models in your application, you need:
25+
26+
[!INCLUDE [how-to-prerequisites](../how-to-prerequisites.md)]
27+
28+
* A chat completions model deployment with JSON and structured outputs support. If you don't have one read [Add and configure models to Azure AI services](../../how-to/create-model-deployments.md).
29+
30+
* You can check which models support structured outputs by checking the column **Response format** in the [Models](../../concepts/models.md) article.
31+
32+
* This article uses `gpt-4o`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: How to use structured outputs for chat models with Azure AI model inference
3+
titleSuffix: Azure AI Foundry
4+
description: Learn how to use structured outputs with chat completions with Azure AI model inference
5+
manager: scottpolly
6+
author: msakande
7+
reviewer: santiagxf
8+
ms.service: azure-ai-model-inference
9+
ms.topic: how-to
10+
ms.date: 1/21/2025
11+
ms.author: mopeakande
12+
ms.reviewer: fasantia
13+
zone_pivot_groups: azure-ai-inference-samples
14+
---
15+
16+
> [!NOTE]
17+
> This example is not available in the selected language.

0 commit comments

Comments
 (0)