You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
This is a feature request for the Python library
Describe the feature or improvement you're requesting
It would be great to be able to use data schemas defined as pydantic dataclasses in structured outputs. E.g.
frompydantic.dataclassesimportdataclassfromopenaiimportOpenAIclient=OpenAI()
@dataclassclassCalendarEvent:
name: strdate: strparticipants: list[str]
completion=client.beta.chat.completions.parse(
model="gpt-4o-2024-08-06",
messages=[
{"role": "system", "content": "Extract the event information."},
{"role": "user", "content": "Alice and Bob are going to a science fair on Friday."},
],
response_format=CalendarEvent,
)
event=completion.choices[0].message.parsed
Pydantic dataclasses can be easily transformed into JSON schema via the model_json_schema function.
Additional context
No response
The text was updated successfully, but these errors were encountered:
@9dogs ... Are you able to even run the code from their tutorial with pydanitc?
It returns me an error : AttributeError: 'Completions' object has no attribute 'parse'
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
It would be great to be able to use data schemas defined as pydantic dataclasses in structured outputs. E.g.
Pydantic dataclasses can be easily transformed into JSON schema via the model_json_schema function.
Additional context
No response
The text was updated successfully, but these errors were encountered: