Skip to content

Support full JSON Schema types in structured outputs response_format #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 18 additions & 1 deletion src/openai/resources/chat/completions/completions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import inspect
Expand Down Expand Up @@ -163,6 +162,24 @@ class MathResponse(BaseModel):
print("answer: ", message.parsed.final_answer)
```
"""
response_format = {
"type": "json_schema",
"json_schema": {
"name": "string_list_wrapper",
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {"type": "string"}
}
},
"required": ["items"],
"additionalProperties": False
}
}
}

_validate_input_tools(tools)

extra_headers = {
Expand Down