Recent updates to OpenAI assistant allows us to have output from Assistant in json mode.
I am getting bad request error:
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Runs with `response_format` of type `json_object` type are only compatible if all tools are type `function`.', 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}
If I try to create an assistant in Python using:
assistant = client.beta.assistants.create(
name=f"Test Assistant",
instructions=<SOME INSTRUCTION>,
model=model_name,
tools=[{"type": "code_interpreter"}],
temperature=0.2,
response_format={"type": "json_object"},
)
It seems you can’t use tool code interpretor if you want to use json_mode as response. I am not sure about why such a restriction exists.