-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
beta.chat.completions.parse is not working with response_format json object or json schema after upgrading to 1.55.3 #1914
Comments
Can you share the |
Doesn't work for me either on class Response(BaseModel):
operations: List[Dict]
explanation: str
completion = client.beta.chat.completions.parse(
model="gpt-4o-2024-08-06",
messages=[
{"role": "system", "content": "You are a data transformation expert that provides precise, actionable JSON responses."},
{"role": "user", "content": prompt}
],
response_format=Response,
)
response = completion.choices[0].message.parsed Returns the following error:
|
@paulhyuk unfortunately arbitrary properties aren't supported in structured outputs yet https://platform.openai.com/docs/guides/structured-outputs#additionalproperties-false-must-always-be-set-in-objects, so you'll need to give a different definition for |
Thanks @RobertCraigie -- does the API support class OperationResponse(BaseModel):
operation: str
parameters: Rename|Drop|Create|FillNa|Datetime |
For me it worked when downgraded openai library to 1.51.0 This is the Basemodel: class FieldExtraction(BaseModel): class Classification(BaseModel): class Classifications(BaseModel): |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
Getting Type error
TypeError: No method for generating JsonSchema for core_schema.type='invalid' (expected: GenerateJsonSchema.invalid_schema)
To Reproduce
Use beta.chat.completions.parse with pydantic object in response_format
Code snippets
No response
OS
windows
Python version
3.11
Library version
1.55.3
The text was updated successfully, but these errors were encountered: