Skip to content
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: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,28 @@ Nested parameters are dictionaries, typed using `TypedDict`, for example:

```python
from openai import OpenAI
from pydantic import BaseModel

client = OpenAI()

response = client.chat.responses.create(
class CalendarEvent(BaseModel):
name: str
date: str
participants: list[str]

response = client.responses.parse(
model="gpt-4o-2024-08-06",
input=[
{"role": "system", "content": "Extract the event information."},
{
"role": "user",
"content": "How much ?",
}
"content": "Alice and Bob are going to a science fair on Friday.",
},
],
model="gpt-4o",
response_format={"type": "json_object"},
text_format=CalendarEvent,
)

event = response.output_parsed
```

## File uploads
Expand Down