Structured Outputs

Standard AI responses are just text. While useful, they can be hard to analyze programmatically. Structured Outputs force the AI to return data in a strict format (JSON), effectively turning unstructured text into a database.

Why use Structured Outputs?

  • Consistency: Ensure date formats, categories, and numbers are always returned in the same way.
  • Analysis: Easily filter and sort your results in Excel or Sheets after export.
  • Reliability: Eliminate "conversational filler" (e.g., "Sure, here is the answer: ...").

Defining a Schema

When configuring your job, select Structured Output instead of Free Text. You can then define specific fields you want to extract.

Field Types

  • String: Text data (names, short summaries).
  • Number: Numerical data (prices, scores, ratings).
  • Boolean: True/False values (e.g., is_spam , has_email ).
  • Array (Select): Restrict the output to a specific list of options.
    • Example: For a "Sentiment" field, you might allow only: ["Positive", "Negative", "Neutral"].

Example Use Case: Company classification

Input: A company's name and website.

Prompt:

Identify the primary industry, estimated employee count, approximate yearly revenue, and whether they are B2B or B2C for the company listed below.

Company Data:
{csv_data}

Schema:

{
  "industry": "string",
  "employee_count": "number",
  "yearly_revenue": "number",
  "business_model": "string"
}

The output CSV will have three separate columns: industry , employee_cout ,yearly_revenue and business_model , ready for instant filtering.