Skip to content

Commit 202fe97

Browse files
Merge pull request #914 from mrbullwinkle/mrb_10_18_2024_structured_outputs_batch
[Azure OpenAI] Batch structured outputs support
2 parents 6fde963 + cb65314 commit 202fe97

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

articles/ai-services/openai/how-to/batch.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ manager: nitinme
66
ms.service: azure-ai-openai
77
ms.custom: references_regions
88
ms.topic: how-to
9-
ms.date: 10/14/2024
9+
ms.date: 10/18/2024
1010
author: mrbullwinkle
1111
ms.author: mbullwin
1212
recommendations: false
@@ -67,19 +67,15 @@ Refer to the [models page](../concepts/models.md) for the most up-to-date inform
6767

6868
API support was first added with `2024-07-01-preview`. Use `2024-10-01-preview` to take advantage of the latest features.
6969

70-
### Not supported
70+
### Feature support
7171

7272
The following aren't currently supported:
7373

7474
- Integration with the Assistants API.
7575
- Integration with Azure OpenAI On Your Data feature.
7676

7777
> [!NOTE]
78-
> There is a known issue with Azure OpenAI global batch and [structured outputs](./structured-outputs.md). Currently, lines in your jsonl file with structured output requests will fail with the following error message written to the error file:
79-
>
80-
> ***response_format value as json_schema is enabled only for api versions 2024-08-01-preview and later***.
81-
>
82-
>This error will occur even when your code targets the latest preview APIs which support structured outputs. Once the issue is resolved, this page will be updated.
78+
> Structured outputs is now supported with Global Batch when used in conjunction with API version `2024-08-01-preview` or later. Use `2024-10-01-preview` for the latest features.
8379
8480
### Global batch deployment
8581

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Structured outputs make a model follow a [JSON Schema](https://json-schema.org/o
1818

1919
> [!NOTE]
2020
> * Currently structured outputs is not supported on [bring your own data](../concepts/use-your-data.md) scenario.
21-
>
22-
> * There is a known issue blocking structured outputs support for [global batch](batch.md).
21+
22+
2323

2424
## Supported models
2525

articles/ai-services/openai/includes/batch/batch-python.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ Like [fine-tuning](../../how-to/fine-tuning.md), global batch uses files in JSON
5555
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/ai-services/openai/media/how-to/generated-seattle.png"}}]}],"max_tokens": 1000}}
5656
```
5757

58+
# [Structured outputs](#tab/structured-outputs)
59+
60+
```json
61+
{"custom_id": "task-0", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "Extract the event information."}, {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."}], "response_format": {"type": "json_schema", "json_schema": {"name": "CalendarEventResponse", "strict": true, "schema": {"type": "object", "properties": {"name": {"type": "string"}, "date": {"type": "string"}, "participants": {"type": "array", "items": {"type": "string"}}}, "required": ["name", "date", "participants"], "additionalProperties": false}}}}}
62+
```
63+
5864
---
5965

6066
The `custom_id` is required to allow you to identify which individual batch request corresponds to a given response. Responses won't be returned in identical order to the order defined in the `.jsonl` batch file.

articles/ai-services/openai/includes/batch/batch-rest.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Like [fine-tuning](../../how-to/fine-tuning.md), global batch uses files in JSON
4444
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/ai-services/openai/media/how-to/generated-seattle.png"}}]}],"max_tokens": 1000}}
4545
```
4646

47+
# [Structured outputs](#tab/structured-outputs)
48+
49+
```json
50+
{"custom_id": "task-0", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "Extract the event information."}, {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."}], "response_format": {"type": "json_schema", "json_schema": {"name": "CalendarEventResponse", "strict": true, "schema": {"type": "object", "properties": {"name": {"type": "string"}, "date": {"type": "string"}, "participants": {"type": "array", "items": {"type": "string"}}}, "required": ["name", "date", "participants"], "additionalProperties": false}}}}}
51+
```
52+
4753
---
4854

4955
The `custom_id` is required to allow you to identify which individual batch request corresponds to a given response. Responses won't be returned in identical order to the order defined in the `.jsonl` batch file.

articles/ai-services/openai/includes/batch/batch-studio.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ Like [fine-tuning](../../how-to/fine-tuning.md), global batch uses files in JSON
4444
{"custom_id": "request-1", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": [{"type": "text", "text": "What’s in this image?"},{"type": "image_url","image_url": {"url": "https://raw.githubusercontent.com/MicrosoftDocs/azure-docs/main/articles/ai-services/openai/media/how-to/generated-seattle.png"}}]}],"max_tokens": 1000}}
4545
```
4646

47+
# [Structured outputs](#tab/structured-outputs)
48+
49+
```json
50+
{"custom_id": "task-0", "method": "POST", "url": "/chat/completions", "body": {"model": "REPLACE-WITH-MODEL-DEPLOYMENT-NAME", "messages": [{"role": "system", "content": "Extract the event information."}, {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."}], "response_format": {"type": "json_schema", "json_schema": {"name": "CalendarEventResponse", "strict": true, "schema": {"type": "object", "properties": {"name": {"type": "string"}, "date": {"type": "string"}, "participants": {"type": "array", "items": {"type": "string"}}}, "required": ["name", "date", "participants"], "additionalProperties": false}}}}}
51+
```
52+
53+
4754
---
4855

4956
The `custom_id` is required to allow you to identify which individual batch request corresponds to a given response. Responses won't be returned in identical order to the order defined in the `.jsonl` batch file.

0 commit comments

Comments
 (0)