Groq JSON mode: use response_format for reliable structured output
set response_format to json_object in the chat completions request to get the model to return valid JSON.
[Groq docs]: set responseformat to jsonobject in the chat completions request to get the model to return valid JSON. Describe the schema in the instructions so the keys are consistent. Validate the response parses before using it: even in JSON mode, retry the call if parsing fails rather than repairing the string by hand. Keep the requested object small: huge schemas raise the chance of truncation at the max output token limit.
Context: Parsing free-text model output breaks. Ask Groq for JSON directly.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.