Extraction Template

How to create an Extraction Template

What is an Extraction Template?

An extraction template defines the structure of data you want to extract from documents. It specifies which fields to extract, their data types, and how to transform the data into your required format.

How to create an extraction template

  1. Click Extraction Templates in the Home dashboard
  2. Click Create Template
  3. Select an existing template or create a new one

Create a new template

  1. Click Create New Type
  2. Enter a Display Name
  3. Enter a prompt to guide the AI on how to create the template
  4. (optional) Upload sample documents to automatically generate the schema
  5. Click Create

Edit an existing template

You can manually edit the template schema and adjust it to fit your specific document types.

  1. Click Edit on the template you want to edit
  2. Update the display name, Fields and Tables
  3. Click Save

Templates are flexible and customizable. You can create multiple variations of the same document type and use AI Instructions to guide extraction for each variation.

AI Instructions

The AI Instructions is a prompt that guides the AI on how to extract the data from the document.

  1. Click AI Instructions on the template you want to edit
  2. Enter a prompt to guide the AI on how to extract the data from the document
  3. Click Save

Fields and Tables

Fields

Fields represent individual data points extracted from documents (e.g., invoice date, vendor name, total amount).

Tables

Tables represent collections of related data points (e.g., line items in an invoice, transactions in a bank statement).

Field Types

Each field has a type that determines how its value is obtained:

  • Manual - Enter data manually (e.g., comments, notes)
  • AI - Extract data from the document using AI
  • Formula - Calculate from other fields using code

Each field also has a return type that defines the data format:

  • Text - String values
  • Number - Numeric values
  • Currency - Monetary amounts
  • Date - Date values
  • Boolean - True/false values
  • Enum - Predefined list of options

Manual Fields

Manual fields require you to enter data manually. They are not extracted by AI. Use them for comments, notes, or other data that isn't present in the document.

AI Extractible Fields

AI extractible fields extract data from documents using AI. Use AI Instructions to specify how the AI should extract each field.

Use cases:

  • Extract raw data from documents (text, numbers, dates)
  • Transform data (e.g., translate text to a specific language)
  • Basic calculations (note: AI math can be inaccurate; use Formula Code for complex calculations)

Special Sum type

For every numeric field in a Table, a Sum field is automatically generated. It calculates the total of all values in that field.

  • Hidden by default (accessible in Formula Code for calculations or validation)
  • Can be enabled to display in the UI with a custom display name

Formula Code

Formula Code runs after AI extraction. Use it for:

  • Complex calculations
  • Data validation
  • Data transformation
  • Calling external APIs

You can write custom code or use the built-in AI assistant to generate it.

Field-level formulas: Create a field in the Fields section that calculates values based on other fields or table data. You can modify other fields, but it's recommended to return a value (e.g., a boolean indicating success).

Table-level formulas: Create a field in the Tables section that calculates values for each row in the table.

Using the AI assistant to generate code:

  • Reference fields and tables using their display names
  • Clearly describe the calculation, validation, or transformation you need
  • Specify any notification messages you want to show to users

Enum return type

Use Enum for fields with predefined categories. Define each category as an enum option, then use AI Instructions to guide the AI on how to map document values to the correct enum option.