Is it possible to specify the JSON Schema version for function calling?

I’ve been getting a ‘BadRequestError: Invalid schema for function…’ and believe it’s due to the fact that I’ve specified my function descriptions in accordance with JSON Schema version Draft 4. I believe OpenAI use Version Draft 8 Patch 1.

I’m wondering if it’s possible to enforce that GPT abide by the Draft 4 version so I don’t get this error? It isn’t an option for me to update to the JSON Schema version.

1 Like

Welcome to the dev forum!

You can try, but I don’t believe it will work well as the model was likely trained on whatever version it’s outputting.

The API isn’t adaptable to a draft, and doesn’t have that many parameters it can take that are acutally passed to the AI in its subset of accepted keys. For features:

You get number, string, boolean, an enum for strings.
You get an array of responses.
Levels can be nested in object.

Last I checked, there was no passing keys like maximum value or such to the AI, despite them not producing an error.

Even “examples”, now accepted by tools, is just written to AI as part of the description. It is just an obfuscation method for a limited language the AI receives as specification for the tool and what it can accept.