flâneur

GPT-4o doesn't consistently respect JSON schema on tool use - API / Bugs - OpenAI Developer Forum

community.openai.com · 165 words · saved by 1 readers

HOWEVER, I noticed 4o does not consistently respect the JSON schema. For example, if it chooses to return markdown, it will completely ignore the required json schema. GPT-4 Turbo on the other hand does this very consistently, even when returning markdown, it will return the markdown content in the required JSON field. Does anyone else experienced this? Yes, I just experienced that as well - where gpt-4o does not respect the JSON mode requirement. I have similar results, using the same instructions across gpt3.5-1106, gpt4turbo, and gpt4o, only gpt4o is consisently bad at JSON output, I dont use function calling and instead do JSON output schema instructions, and its pretty bad. usually using the json schema instructions itself instead of the intended JSON structure. I used to get this but no more what do your schema instructions look like? This format works for me Where baz an array and bat an enum Im just giving it 2 simple keys like so: { “answer”: string, “sources”: } Note, i also

May 17, 2024, 11:19pm 7 I find that using Typescript to define a JSON Schema is much easier than providing it JSON to follow. For example, this works flawlessly for me: Now consider the following TypeScript Interface for the JSON schema: interface Basics { name: string; summary: string; } Write the basics section according to the Basics schema. On the response, include only the JSON. Then, I do some checks after the output has been received: def clean_json_output(output): output = output.strip() if output.startswith("```json"): output = output[7:] if output.endswith("```"): output =…

saved by

related reading