Build

In AI Hub Build, you can create a custom document understanding app in just a few steps. Upload sample documents, tell Build what document types and data points you want to identify, then publish your app for use.

Build community and commercial offerings

Build is available in two tiers: a community offering available for general use, and a commercial offering suitable for companies and organizations.

For plan comparisons and pricing, see Instabase pricing.

A Build community account lets you create a basic document understanding app and publish it for use.

A Build commercial account lets you collaborate on projects, perform advanced cleaning operations, validate results, and more.

Using the Build interface

Understanding the Build interface can help you efficiently build document understanding apps.

The default Build interface includes three main panels:

  • The document list on the left displays all files included in your project. If your project includes classification, documents are automatically grouped by class, but you can use the filter, sort, and group icons to change the list display.

  • The document preview in the center displays the document selected in the document list. The preview pane includes a toolbar, auto-hidden by default, with controls for viewing the selected document, including image or text-only views, keyword search, and page selection.

  • The editing panel on the right displays classes and fields in your project, with results for the document selected in the document list. In projects that belong to commercial accounts, a validation tab lets you view, create, and edit validation rules across your project, while class and field controls are displayed in a separate schema tab.

Tip

Use the icons in the Documents header to switch between viewing modes: single document, document grid, or results table.

Working with projects

A project is a collection of files and artifacts used to create a Build app. Projects correspond to your unique document understanding workflow, with document types and data points that address your specific use case.

You can view and modify project settings by clicking the gear icon next to any project in the main sidebar. Project settings include options for detecting checkboxes and multipage tables and, in commercial accounts, for splitting multipage files into appropriate classes.

Info

If you enable object detection after initial file upload, any existing files are automatically redigitized according to your new settings.

Collaborating on projects Commercial

You can collaborate on Build projects with other members of a shared workspace by creating your project in that shared workspace. Collaboration in Build uses a combination of exclusive edit access and a timed lock system to mitigate the risk of conflicts or another member overwriting your changes.

Exclusive edit access means that only one user can edit a project at a time. Examples of actions that initiate edit access include clicking Save, uploading a document, and renaming a field or the project. When you hold edit access, a banner displays at the top of the page.

The timed lock system means you can only retain exclusive edit access while actively editing the project. While you can actively edit a project for as long as needed, after a period of five consecutive minutes of inactivity, another member of the shared workspace can take over exclusive edit access and initiate their own timed lock. If another user takes over edit access, any unsaved changes made prior to the five minute period of inactivity are lost.

Creating a project

To get started building a custom app, create a project and add files.

Commercial users can fast-track project development by copying classes and fields from another project in their organization.

Before you begin

You must have a set of files that represent the types of documents you want to process. Five or so files of each type is a good start.

  1. Commercial In the sidebar under your organization name, verify the workspace in which to create the project.

  2. Click Create Project or the + icon, then select one of these options based on your AI Hub license and project requirements:

    • Blank project – Starts your project in a blank state.

    • Use existing schema Commercial – Copies all classes and fields from another project in your organization. If you select this option, choose the project with the schema you want to duplicate and click Create project.

  3. (Optional) If your documents includes tables or checkboxes that you want to extract, enable Object detection.

  4. Select supported files to start building with.

    Files are uploaded to your project, then digitized and processed according to your project settings. Documents are added to the document list as they finish processing.

What's next?

If your project is blank, your next step is creating classes and fields. If you copied an existing project schema, you can add more classes and fields as needed, or modify what was imported.

Creating classes and fields

To process documents, you must specify which data points, or fields, you want to extract. If your project includes different document types, like a mix of passports and driver’s licenses, you can create a class for each document type and specify a different set of fields for each class.

You can create up to 50 classes per project, and up to 50 fields per class.

Creating classes

If your project includes different document types, start by creating a class for each document type. You can then specify a different set of fields for each class.

Commercial users can import prebuilt classes from a library of established schemas, such as paystubs, invoices, bank statements, and utility bills.

In projects with classification, a default class called other is assigned to documents that can’t be classified. You can’t delete or modify this class.

  1. In the editing panel, on the Schema tab, click the Create classes icon Icon that looks like a horizontal bookmark or tab, with a small plus in the lower right. to add a class, then select one of these options based on your AI Hub license and project requirements:

    • Create classes – Let you create a custom class without any fields. If you select this option, enter a descriptive name for one of your document type, and press Enter.

    • Browse prebuilt classes Commercial – Lets you add common document types and their associated fields based on a library of available schemas. If you select this option, choose the prebuilt classes that you want to add and click Add to project.

  2. Use the Create classes icon Icon that looks like a horizontal bookmark or tab, with a small plus in the lower right. to add more classes as needed.

  3. When you’re done creating classes, click Save & reclassify documents.

    Commercial If your project includes multipage files, you’re prompted to enable splitting files that include multiple document types. After classifying your documents, page ranges indicate how files are split.

    Build assigns classes to your documents and groups documents by class in the document list. Any documents that can’t be classified are assigned the other class.

Creating fields

Create fields for each of the data points you want to identify.

Tip

When you initially create fields, Build attempts to return results based only on field name. It’s okay if this result isn’t what you expect; you can refine your results by editing fields.

  1. In the editing panel, on the Schema tab, click Add field.

  2. Add fields as needed to the Create fields list using one of these methods:

    • Select a suggested field.

    • Enter your own field name, or a comma-separated list of field names.

  3. Click Create.

  4. (Optional) If your project includes classes, expand each class and add fields appropriate to each document type.

  5. When you’re done creating fields, click Save fields.

    Build extracts data points from your documents based on the fields you specified.

Editing fields

If field name alone doesn’t return the results you expect, you can edit fields to give Build more guidance.

To edit a field, hover over the field and click the Edit field icon Pencil icon..

To change the order of fields in the field editor, use the up and down arrows that display when you hover over a field. Fields are displayed in processed results in the same order as in the field editor, so reordering fields can be helpful to speed up reviews or support downstream integrations. For commercial users, field order can impact custom cleaning functions, which optionally reference preceding fields.

Note

If you have custom cleaning functions in your project that reference preceding fields, be aware that reordering fields can break the cleaning function.

Extraction versus reasoning prompts

In the field editor, first choose whether to use an extraction or reasoning prompt.

Extraction prompts are appropriate when your document includes the information you want to identify.

Reasoning prompts are queries that require summarization, calculation, or extrapolation. Reasoning prompts are appropriate when the information you want isn’t explicitly found in the document, but can be deduced.

In either mode, commercial users can change the model from default to advanced using the Select model icon Icon with three stars.. For details about model capabilities, see Choosing a model.

Crafting extraction prompts

Extraction prompts identify a string of text or numbers. Commercial users may additionally opt to extract lists of objects or tables.

  • Text – Used to extract a string of text or numbers, such as address, account balance, or filing status.

  • List Commercial – Used to extract a list of items, such as deposits on a banking summary, billing codes on a medical claim form, properties on a broker submission, or items on a receipt. If there are additional data points associated with each item that you want to identify, such as price and SKU for receipt items, you can add an attribute for each data point.

    Tip

    You can think of the list data type as building a table on-demand, where each row lists one of the items you want to identify and each column is an attribute.

  • Table Commercial – Used to extract tables. For more details, see Extracting tables.

If necessary, use the Description field to add details about the field or list attribute to help the model identify your data. As a best practice, keep field or attribute name short and use the description field for longer-form prompts.

Crafting reasoning prompts

Reasoning prompts generate analysis, synthesis, and other conclusions based on higher-order thinking.

By default, reasoning fields use your field name as the prompt, but you can modify Natural language prompt to provide a more descriptive prompt.

Examples of reasoning prompts include:

  • What’s the description for the largest debit on this statement?

  • Summarize this document in less than 200 words.

Extracting objects

You can extract tables, checkboxes, and signatures using specific settings and prompts.

Info

For best results when extracting tables and checkboxes, enable object detection in project settings.

Extracting tables

The method for extracting tables differs for community and commercial users.

Tip

To see the tables identified in a document, with object detection enabled in project settings, select the prediction icon Lightbulb icon. in the header and enable Show detected objects for tables. Tables in the document are highlighted and you can use the adjacent table icon to view, copy, or download a table.

Community To extract tables as a community user, use a reasoning prompt and describe the table extraction you want to perform in the prompt.

You can extract multipage tables and perform some table manipulation with reasoning prompts, however this method requires more trial and error than the commercially supported method.

Here are some examples of reasoning prompts for tables:

  • Extract transactions as a Markdown table

  • Extract transactions as JSON

  • Extract all tables with columns Date, Description, Debit, Credit

  • Extract transactions and filter for amounts greater than $1,000

Commercial To extract tables as a commercial user, use an extraction prompt with the table data type and describe the table extraction you want to perform in the prompt. This method extracts tables with a high degree of accuracy and lets you manipulate tables in various ways.

Here are some examples of extraction prompts for tables:

  • Extract tables with columns Date, Description, Debit, Credit

  • Extract transactions and filter for amounts greater than $1,000

  • Extract transactions and return results for 01 May through 15 May

  • Extract transactions and sort amounts from smallest to largest

  • Extract transactions and add a column Flagged with values set to Yes if the debit is greater than $70

Extracting checkboxes

Checkboxes can be extracted with either an extraction or reasoning prompt.

  • For a group of checkboxes with a label, such as the Filing Status field on a tax form, use the label for your field name.

  • For a standalone checkbox, use a question that indicates whether the checkbox is ticked. For example, Is the filer claiming capital gains or losses?

Extracting signatures

You can extract information about signatures, including whether a document is signed, who the signer was, and the signature date. Extraction of signature images is not available.

Signature information can be extracted with either an extraction or reasoning prompt.

Often, a field name like signatory name, signatory title, or signature date is adequate. If field name alone fails to extract the data you want, edit the field and provide a more descriptive natural language prompt. For example:

  • Extract all signatures

  • Return yes if this document is signed

Viewing results across documents

To quickly scan or compare results, click the Results table icon Icon that looks like a 2x6 table. in the Documents header.

The results table corresponds to the current view in the editing panel, so the results you see change depending on your current task.

If the editing panel shows… Then the results table displays…
Classes Final results for all fields, across all classes.
Field editor Final result and, if applicable, confidence threshold validation result for the selected field.
Validation rules with no rule selected Validation results for all fields, across all classes.
Validation rules with a rule selected
or
Validation editor
Validation result for the selected rule and the result of any fields used to calculate it.

Improving class and field results

One of the most effective ways to improve results is to provide a field name or prompt that uses wording directly from your sample documents. Models are often most effective at identifying specific information if you give them clear signposts.

For example, if you’re working with bank statements and want to extract total withdrawals, locate this information on a sample document and use its corresponding label in your prompt. Keep in mind that this wording might differ across document classes, so your prompt should also be different. On a Chase bank statement, this information might be labeled Electronic Withdrawals, whereas on a Capital One statement, it might have the label Checks/Debits.

Similarly, when classifying documents, give your classes names that correspond to information actually contained in your sample documents, such as in the document header. File names aren’t usually an effective method of classifying documents.

Cleaning results

If results for a given field aren’t formatted as needed, you can clean data using quick clean options or, for commercial users, a natural language prompt or a custom function.

Quick clean

Quick clean options include:

  • Changing character casing to all uppercase, all lowercase, or sentence case.

  • Removing characters by specifying characters to remove, with no comma separator.

  • Reformatting date by selecting from available formatting options.

    Tip

    In numeric-only dates like 06/01/2024, use the Input field to specify whether the original value lists the month or the day first.

Quick clean options use Python functions to reformat data; there is no model processing and no unit cost.

Cleaning prompt Commercial

If quick clean options don’t work for your data, you can instead use a natural language prompt to clean up the output. Prompt-based refinement takes the raw output of your extraction or reasoning prompt and applies whatever instructions you specify in the clean prompt. Effective clean prompts are clear, concise, and detailed.

Cleaning function Commercial

For advanced cleaning, you can write a custom function in Python.

For example, you might use a cleaning function to calculate wages minus income tax from a W-2.

Cleaning functions accept these parameters:

Parameter Required? Description
previous_line Required Represents the value of the preceding cleaning line, or the extraction value if the custom function is the first cleaning line.
context Required Stores metadata about the document. You can retrieve the entire text of the document with context['document_text'].
<preceding-field-name> Optional Names of additional fields used in the function. Because fields are extracted sequentially, referenced parameters must precede the current field in the editing panel.
Tip

If necessary, reorder fields using the up and down arrows that display in the field editor when you hover over a field.

Cleaning functions can return any value. The value is converted to a string when it’s passed to subsequent refinement lines or validation rules. If the cleaning function encounters issues, it must raise an exception.

For additional guidance about custom functions, see Writing custom functions.

Confidence scores Commercial

Extraction prompts return confidence scores that are displayed in the field editor. Confidence scores aren’t supported for reasoning prompts.

Confidence scores are calculated by the model using log probabilities, which provide a mathematical measure of how likely a result is. In internal testing, this method proves reliable when compared to benchmarks.

Validating results Commercial

For commercial users, you can validate fields based on confidence scores or a custom function. In production, fields that fail validation are flagged for human review.

Confidence validation

You can set a confidence threshold across all fields in your project, or you can set confidence thresholds that apply to individual fields within a given class.

  1. In the editing panel, select the Validations tab.

  2. Specify validation rules as needed.

    1. In the Apply to all group, click + Validate and select Extraction confidence.

    2. Enter a project confidence threshold and click Save.

    1. In the class that you want to add a validation rule for, click + Validate and select Extraction confidence.

    2. Select the field to apply the validation rule to, enter a confidence threshold, and click Save.

    Tip

    To see how a validation rule performs across documents, click any rule in the Validations tab to see an aggregate view.

Validation function

For advanced validation, you can write a custom function in Python.

For example, you might use a validation function to check that a date is within a certain range.

Validation functions accept these parameters:

Parameter Required? Description
<field-name> Required Value of the field that the custom function validates.
context Required Stores metadata about the document.
context['document_text'] Optional Retrieves the entire text of the document.
context['runtime_config'] Optional Validates results passed as structured data when running an app via API.
<additional-field-name> Optional Names of additional fields used in the function. Referenced parameters must exist within the specified class.

Validation functions must return None if the validation rule passes, and an error string if the validation rule fails.

For additional guidance about custom functions, see Writing custom functions.

Creating your app

Creating an app makes your project functionality reusable, automateable, and shareable.

  1. (Optional) Preview your app with test documents to verify that it’s working as expected.

    1. Click Preview, then click Run app.

    2. Select files to test your app with.

      Files are uploaded, digitized, and processed according to your app settings.

  2. When you’re ready to create your app, click Create app.

  3. Confirm the name of your app and specify optional details, then click Next.

    • Name – By default, apps are assigned the same name as the corresponding Build project. You can change app name as needed when you create the app, but it can’t be changed later.

    • Description – Enter a description for the app to help users understand its purpose.

    • App icon – Upload an icon to represent your app. Icons can be up to 2 MB.

  4. Confirm version details, then click Create app.

    • Version – By default, the first version of your app is numbered 0.0.1.

    • Release state – By default, apps are created in the Production state, which gives access to other users you share the app with. To restrict access to only yourself, select Pre-production.

    Your app is created and published to the Apps tab.

Tip

Apps are accessible from the Apps tab. With your app open, you can run it and access other details from the left sidebar.

To version an app, make changes to the corresponding project, then click Update. To change the release state of an existing version, from the Version history tab, hover over an app version and click the Edit release state icon Pencil icon..

Processing documents

After creating an app, you can use it to process documents similar to those used in development.

  1. From the Apps tab, open your app, then click Run app.

  2. Commercial Verify the workspace in which to run the app. Run results display only in the selected workspace.

  3. Select files to process.

Each group of documents you process is treated as a batch. The app homepage includes a historical list of batches, with your most recent submission at the top. When the run completes, click the Batch ID to view results.

Tip

You can access app runs and other app details from the left sidebar when your app is open.

Reviewing results Commercial

After processing a batch of documents, you can review and correct class and field data as needed.

If your app includes downstream integrations and any documents in a run fail validation, the run is automatically paused for review with the status Review required. The run is considered complete when the review is closed.

  1. With a batch of documents open, select a document in the document list.

  2. For each document you’re reviewing, verify and correct data if needed, then mark the document as reviewed.

    • To correct mapping data where multipage files were incorrectly parsed into individual documents, select the Documents Grid tab. Select pages and use the button controls to move or delete pages or create additional documents.

    • To correct classification data, use one of these methods:

      • For documents belonging to only one class, click the Edit classification icon near the assigned class. Select the correct class, then click Confirm.

      • For files that contain multiple documents, select the Documents Grid tab. Next to the classification label on an incorrectly classified document, click Edit. Select the correct class, then click Confirm.

        Tip

        Changing the classification of a document clears any extracted data, resulting in a new set of blank extraction fields appropriate to the class you specify.

    • To correct text fields, on the Single Document tab, in the fields list, select a field. Enter a new value or, in the document viewer, select the area of the document that contains the information for that field. You can click to select text, or use your mouse to draw a box around the information.

      Tip

      If validations apply to the selected document, all fields are automatically revalidated when you modify a value.

    • To correct tables, on the Single Document tab, in the fields list, select a table to open it for editing. Select any table cell, then in the document viewer, select the area of the document that contains the information for that cell. You can click to select text, or use your mouse to draw a box around the information.

  3. (Optional) When your review is complete, download your results as a CSV or Excel file.

Sending results Commercial

You can automatically send results to other apps and systems by configuring an integration. Results are sent only after any required reviews are completed.

Supported integrations include:

  • Email – Send results to an email address in CSV, XLSX, or JSON format. In projects with classes, separate CSV files are generated for each class.

  • Connected drive – Send results to a workspace or organization drive by specifying the path to the drive. Results are saved in CSV, XLSX, or JSON format with a timestamped file name. In projects with classes, separate CSV files are generated for each class.

  • Custom function – Send results in JSON format using a custom Python function.

During configuration, you can test the connection by sending the results from a previous app run to your downstream integration.

Integration function

For advanced integrations, you can write a custom function in Python.

For example, you might use an integration function to send results to a webhook:

import requests

# Construct a list of records information
concise_records = []
for record in results['records']:
    concise_record = {
        "fields": record.get("results"),  # Note: This might be intended to be "fields" or a similar key
        "classification_label": record.get("classification_label"),
        "record_index": record.get("record_index")
    }
    concise_records.append(concise_record)

# Post endpoint call template
url = "https://example.com/my_own_webhook"
response = requests.post(url, json=concise_records)
if response.status_code == 200:
    print("POST request successful")
else:
    print(f"POST request failed with status code {response.status_code}")
    return None

Integration functions accept these parameters:

Parameter Required? Description
results Required Results of the app run in JSON format. Individual documents within the app run are exported as records[0].results.

For additional guidance about custom functions, see Writing custom functions.

Writing custom functions

Follow these guidelines when writing custom cleaning, validation, or integration functions to use in Build.

The standard Python library is supported, except for the logging service. As an alternative to logging, you can use print() statements totaling up to 4 KB in length. If needed, you can split results into multiple print statements.

In addition to the standard Python library, you can import these external libraries at the version indicated.

  • datetime 4.4

  • dateparser 1.1.4

  • numpy 1.21.6

  • pandas1.5.3

  • regex 2022.10.31

  • requests 2.25.1

  • typing 3.6.2

  • typing-extensions 4.5.0

For example:

import pandas as pd
print(pd.Series([1,2,3]))