Output Format Specifications
What you'll learn: How to explicitly guide a language model's response structure by requesting specific output formats.
When working with LLMs, you don't just tell the model what to generate—you can also specify exactly how to format the response. Output format specifications are explicit instructions that define the structure of the model's answer: lists, JSON objects, tables, markdown, or any other structured format.
Why Format Specifications Matter
Think of it like ordering at a restaurant. Saying "I want chicken" might get you anything from soup to a sandwich. But saying "I want grilled chicken breast, sliced, on a bed of greens" gives the chef precise instructions. Similarly, without format specifications, the model might respond with a paragraph when you need a bulleted list, or prose when you need parseable JSON.
How to Specify Output Formats
Be explicit in your prompt. Instead of:
"List the planets"
Use:
"List the planets in our solar system. Format your response as a numbered list."
For structured data:
"Extract the person's name, age, and city. Return the result in JSON format with keys: 'name', 'age', 'city'."
For tables:
"Compare Python and Java. Present your answer as a markdown table with columns: Feature, Python, Java."
Common Format Requests
- Lists: "as a bulleted list", "as a numbered list"
- JSON: "in valid JSON format with the following schema..."
- Tables: "as a markdown table", "in CSV format"
- Code blocks: "in a Python code block with triple backticks"
- Structured text: "using headers and subheaders"
Key Takeaway: Explicitly requesting output formats (lists, JSON, tables, markdown) in your prompts ensures the model's response matches your downstream processing needs and improves reliability.