Should I use Assistants API to save system instructions instead of Chat Completions? Need to use response_type = json_output

Hi I want to give instructions to a model: {“role”: “system”, “content”: “I’m going to give you a pair of restaurants. Can you let me know if they are the same restaurant or different? They might have the same name but different address. Structure json: { isSame } with boolean values: true or false”}

I am currently using Chat Completions, but it seems like repetitive to keep giving each request to the model this pair of instructions.

Should I use Assistants API for this? Creating separate threads, adding messages, and running the thread seems like an overkill for my use case.

I also want to know if the Assistants API supports response_type = json_output!

Thank you <3

Hi Vaibhav

For now Assistants API don’t support response_type = json_output. You can try to set instructions to get json in the system prompt, though bear in mind as of now the API is in beta and it is not production ready. One of the implications of this it is difficult to impossible to have Assistant following your instructions and have predictable output.

yes, completions does support json response,
use
“response-format”: {“type”: “json_object”},

remember in the isntructions to add that you need the response as Json

Another tip is that you can end the last message with

"JSON Object: "

so it knows you expect a json object (try it on the playground

A good tip is to include an example response in the prompt

2 Likes