Skip to main content

Extraction schemas

File: config/agents/schemas/*.yaml

The shape llm.extract must produce, as JSON Schema written in YAML. A prompt names one; the model is asked for structured output against it, and output that breaks it fails the run (see Writing a workflow). Any JSON Schema the model server's structured-output mode accepts can be used.

config/agents/schemas/invoice.yaml

# JSON Schema, written as YAML. `id` names it; the rest is the schema.
id: invoice
type: object
additionalProperties: false
required: [vendor_name, invoice_number, invoice_date, currency, subtotal, tax, total, lines]
properties:
vendor_name: { type: string }
vendor_tax_id: { type: [string, "null"] }
vendor_iban: { type: [string, "null"] }
invoice_number: { type: string }
invoice_date: { type: string, format: date }
due_date: { type: [string, "null"], format: date }
currency: { type: string, pattern: "^[A-Z]{3}$" }
subtotal: { type: number }
tax: { type: number }
total: { type: number }
po_number: { type: [string, "null"] }
lines:
type: array
items:
type: object
additionalProperties: false
required: [description, quantity, unit_price, amount]
properties:
description: { type: string }
quantity: { type: number }
unit_price: { type: number }
amount: { type: number }