Skip to main content
CheckThat AI supports structured outputs that ensure your API responses follow a specific schema. This feature is particularly useful for data extraction, classification tasks, and when you need consistent, parseable output formats.
Structured outputs work with all supported models and can be combined with claim refinement and fact-checking capabilities for verified, structured data extraction.

Overview

Structured outputs allow you to:
  • Ensure consistent response formats across all API calls with type safety
  • Extract specific data fields from unstructured text reliably
  • Validate responses against predefined Pydantic models or JSON schemas
  • Simplify parsing by receiving guaranteed, type-safe structures
  • Combine with claim refinement for iteratively improved accuracy
  • Integrate evaluation metrics for quality assurance
The recommended approach is using the parse() method with Pydantic models for full type safety and validation:

Alternative: JSON Schema Format

You can also use JSON schema format directly with the regular create() method:

Response Format

Structured Output Response

Advanced Examples

Data Extraction from Text

Extract multiple data points from complex text:

Fact-Checking with Structured Output

Combine CheckThat AI’s fact-checking capabilities with structured outputs:

Schema Validation

CheckThat AI validates all structured outputs against your JSON schema:

Best Practices

Keep schemas focused and specific:
  • Define clear, descriptive property names
  • Use enums for categorical data to ensure consistency
  • Set appropriate constraints (min/max values, string lengths)
  • Include descriptions for complex fields
Example of a well-designed schema:
Optimize for speed and accuracy:
  • Use simpler schemas for faster processing
  • Avoid deeply nested objects when possible
  • Set reasonable array size limits
  • Consider model capabilities when designing schemas
Token efficiency:
  • Shorter property names reduce token usage
  • Use enums instead of free-form text where possible
  • Balance between structure detail and token cost
Handle validation failures gracefully:

Common Use Cases

Data Extraction

Extract structured information from unstructured text, documents, or web content.

Content Classification

Categorize content with consistent taxonomies and confidence scores.

Fact-Check Reports

Generate standardized fact-checking reports with evidence and sources.

Survey Analysis

Process survey responses into structured data for analysis.
Schema Complexity: Very complex schemas with deep nesting or many constraints may impact response time and accuracy. Start simple and iterate based on your needs.
Testing Schemas: Test your JSON schemas with sample data before deploying to production. Use online JSON schema validators to ensure your schemas are well-formed.