Assistants API - Why is JSON mode not available when using file search / code interpreter?

Seems kinda unnecessary—what about using file search / code interpreter prevents the API from constraining responses to JSON?


Why openai.BadRequestError: Error code: 400 - {'error': {'message': 'Runs with response_formatof typejson_objecttype are only compatible if all tools are typefunction.', 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}?

Imagine the AI has to write raw python code to the python tool. However there is a token run supervisor that only allows valid JSON token sequences to be generated…

I’m sure it could be made to work by OpenAI, manually inspecting the tool call token sequence in parallel generations or something, but response_format={"type": "json_object"} can simply be made redundant by the instructions necessary anyway to produce reliable validate-capable JSON output.

Why not file search though? RAG and return JSON seems reasonable.

I made an assistant called “JSON Fixer”. It takes invalid JSON and returns valid JSON. I run it after I run my other assistant that does file search. lolz.