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
It would be nice for OpenAI to support all schemas, as there are lots of validations baked into Zod schemas that are really convenient and having to work around this and strip them out while passing them to the API is tedious and weakens the power of the almighty Zod.
To Reproduce
pass this schema via zodResponseFormat(mySchema, 'schema') to the new structure outputs endpoint with the sdk.
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
There is currently an issue when passing a Zod schema containg z.ZodStrings with patterns the new gpt4o structure outputs API with the NodeJS library.
For instance:
const MySchema = z.object({ myString: z.string().includes('my-pattern') })
results in the following error:
BadRequestError: 400 Invalid schema for response_format 'my-schema': In context=('properties', 'myString'), 'pattern' is not permitted
I have temporarily fixed this by wrapping all schemas passed to this endpoint with the following recursive removal code below.
It would be nice for OpenAI to support all schemas, as there are lots of validations baked into Zod schemas that are really convenient and having to work around this and strip them out while passing them to the API is tedious and weakens the power of the almighty Zod.
To Reproduce
pass this schema via
zodResponseFormat(mySchema, 'schema')
to the new structure outputs endpoint with the sdk.const MySchema = z.object({ myString: z.string().includes('my-pattern') })'
Code snippets
No response
OS
macOS
Node version
Node v18.18.2
Library version
openai v4.55.0
The text was updated successfully, but these errors were encountered: