Firstly, thank you for this. It really does need to be added to the documentation. The docs are not clear at all.
It should be noted that all tools must be of type function
when response_format
is of type json_schema
.
This is/was in the documentation in some form but it is not made clear. The documentation at https://platform.openai.com/docs/guides/structured-outputs/introduction makes it sound like you can use it When using function calling
or When using a json_schema response format
but that does not apply to assistants.
I tried implementing json_schema
with tools=[{"type": "file_search"}]
and it is still not a thing. I’ve needed this feature so it’s more like chat completions for a while but right now; I’m having to convince the assistant API to respond with JSON through some kludgery instead, and then dealing with broken JSON output through exception handling.
Ugghhh.