- Python
- Bash
Enable JSON mode
Configure JSON mode in Serverless Inference to get structured JSON output from model responses for easier parsing.
Enabling JSON mode instructs the model to return the response in a valid JSON format. However, the response’s schema may not be consistent or adhere to a particular structure. For consistent structured JSON responses, we recommend using structured output when possible.
To enable JSON mode, specify it as the “response_format” in the request: