Skip to content

Commit cb914d7

Browse files
Merge pull request #1646 from mrbullwinkle/mrb_11_20_2024_structured_outputs
[Azure OpenAI] Structured outputs update
2 parents 7aedf51 + 6696ec1 commit cb914d7

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

articles/ai-services/openai/how-to/structured-outputs.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: cognitive-services
66
manager: nitinme
77
ms.service: azure-ai-openai
88
ms.topic: how-to
9-
ms.date: 08/28/2024
9+
ms.date: 11/20/2024
1010
author: mrbullwinkle
1111
ms.author: mbullwin
1212
recommendations: false
@@ -23,11 +23,12 @@ Structured outputs make a model follow a [JSON Schema](https://json-schema.org/o
2323

2424
## Supported models
2525

26-
Currently only `gpt-4o` version: `2024-08-06` supports structured outputs.
26+
- `gpt-4o-mini` version: `2024-07-18`
27+
- `gpt-4o` version: `2024-08-06`
2728

2829
## API support
2930

30-
Support for structured outputs was first added in API version `2024-08-01-preview`.
31+
Support for structured outputs was first added in API version `2024-08-01-preview`. It is available in the latest preview APIs as well as the latest GA API: `2024-10-21`.
3132

3233
## Getting started
3334

@@ -53,7 +54,7 @@ token_provider = get_bearer_token_provider(
5354
client = AzureOpenAI(
5455
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
5556
azure_ad_token_provider=token_provider,
56-
api_version="2024-08-01-preview"
57+
api_version="2024-10-21"
5758
)
5859

5960

@@ -133,7 +134,7 @@ from openai import AzureOpenAI
133134
client = AzureOpenAI(
134135
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
135136
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
136-
api_version="2024-08-01-preview"
137+
api_version="2024-10-21"
137138
)
138139

139140

@@ -203,7 +204,7 @@ name='Science Fair' date='Friday' participants=['Alice', 'Bob']
203204
`response_format` is set to `json_schema` with `strict: true` set.
204205

205206
```bash
206-
curl -X POST https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_MODEL_DEPLOYMENT_NAME/chat/completions?api-version=2024-08-01-preview \
207+
curl -X POST https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_MODEL_DEPLOYMENT_NAME/chat/completions?api-version=2024-10-21 \
207208
-H "api-key: $AZURE_OPENAI_API_KEY" \
208209
-H "Content-Type: application/json" \
209210
-d '{
@@ -294,7 +295,7 @@ from openai import AzureOpenAI
294295
client = AzureOpenAI(
295296
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
296297
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
297-
api_version="2024-08-01-preview"
298+
api_version="2024-10-21"
298299
)
299300

300301

@@ -329,7 +330,7 @@ from openai import AzureOpenAI
329330
client = AzureOpenAI(
330331
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
331332
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
332-
api_version="2024-08-01-preview"
333+
api_version="2024-10-21"
333334
)
334335

335336
class GetDeliveryDate(BaseModel):
@@ -354,7 +355,7 @@ print(response.model_dump_json(indent=2))
354355
# [REST](#tab/rest)
355356

356357
```bash
357-
curl -X POST https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_MODEL_DEPLOYMENT_NAME/chat/completions?api-version=2024-08-01-preview \
358+
curl -X POST https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_MODEL_DEPLOYMENT_NAME/chat/completions?api-version=2024-10-21 \
358359
-H "api-key: $AZURE_OPENAI_API_KEY" \
359360
-H "Content-Type: application/json" \
360361
-d '{

0 commit comments

Comments
 (0)