I want to have a completion for an api request to openapi (gpt-4), in a json format, or as similar as possible to it.
Thing is, I already tried to put this format in a separate json, tried to use the json format as a parameter (but apparently, it doesn't work for the model I am using), already tried many things. The closest I got was designing it inside the prompt, but the api breaks lines automatically, I have no idea how to remove it (tried the stop: ['\n'], tried a regex, but nothing is working).
Anyone would give me a light? Pretty sure something stupid would solve it, but I ran out of ideas so far...
I am using the gpt-4 model.
Here's the prompt I am using today:
const prompt = `Create a question about ${x}, the answer should be in below format:
{
"title": "Title. Should be...",
"description": "Description. Should have...",
"code_snippet: "Should show as...",
"tags": ["tag1", "tag2", "tag3", "tag4"],
"options": [
{"text": "Opção A", "correct": true},
{"text": "Opção B", "correct": true},
{"text": "Opção C": "correct": true},
{"text": "Opção D": "correct": false},
]
"feedback_title": "should be this...",
"feedback_text": "should be that...",
}`