[Groq docs]: set response_format to json_object 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.