Polyglot \ Output Modes
JSON Mode
Learn how to use JSON mode in Polyglot for structured LLM responses.
JSON mode instructs the model to return responses formatted as valid JSON objects. This is useful when you need structured data that can be easily processed by your application.
Basic JSON Generation
Structuring JSON Responses with Instructions
For best results, include clear instructions about the expected JSON structure:
Provider-Specific JSON Options
Some providers offer additional options for JSON mode:
When to Use JSON Mode
JSON mode is ideal for:
- Extracting structured data (lists, records, etc.)
- API responses that need to be machine-readable
- Generating data for web applications
- Creating datasets