Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ai-data/generative-apis/how-to/use-structured-outputs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ extract = client.chat.completions.create(
response_format={
"type": "json_schema",
"json_schema": {
"name": "VoiceNote",
"schema": VoiceNote.model_json_schema(),
}
},
Expand Down Expand Up @@ -203,6 +204,7 @@ extract = client.chat.completions.create(
response_format={
"type": "json_schema",
"json_schema": {
"name": "VoiceNote",
"schema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -243,4 +245,4 @@ By choosing between JSON mode and Structured outputs with JSON schema, you contr
- **JSON mode** is flexible but less predictable.
- **Structured outputs** provide strict adherence to a predefined schema, ensuring consistency.

Experiment with both methods to determine which best fits your application's requirements.
Experiment with both methods to determine which best fits your application's requirements.