Skip to content
Discussion options

You must be logged in to vote

response_format=json enforces structure after model generation, not during.
For strict JSON:

  1. Set temperature = 0

  2. Use JSON schema hints inside the prompt

  3. Add:

    Output ONLY raw JSON. No explanations.
    
  4. Avoid asking for a mix of code + explanation in the same call

  5. Keep the schema small—large schemas cause drift

This results in nearly perfect JSON-only completions.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zoe-dev1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants