Struct Configuration

This is a quick tutorial to set up your first struct.

1. Create a Template

To extract information from a piece of text or a document into an Excel we will first create an Excel template.

The easiest way to get started is to download one of the predefined templates. So click on View templates to see which predefined templates are available.

You can just use one of the predefined templates. Or you can click on the file and download the template file and edit it to the format you like. If you just want to use a predefined template, you can skip 1.1. and 1.2. and jump straight to 1.3. Process Template.

1.1. Customize your own template

If you want to create or customize your own template, you can do this just by creating your own Excel file. In the image below, you can see what an Excel template may look like to extract some information from an invoice for example.

In the example above {{date}} will be automatically replaced by the algorithm with the date of the invoice.

Try to avoid special characters and spaces in the tags to improve the performance.

Be sure to provide row or column titles like Invoice date (YYYY-MM-DD) so the algorithm can figure out exactly what you want the filled in data to look like. You can even add format suggestions like (YYYY-MM-DD) to make sure the invoice date is presented in a predefined format.

Once your template is uploaded you can process it. Jump straight to 1.3. Process Template for more information. For more advanced functionalities you can check out the Advanced Templating below.

1.2. Advanced Templating - Lists

If you want to go 1 step further, you can also generate lists. If you repeat a tag like {{invoice_number}} multiple times in the Excel, for example, the system will assume you are processing a list of invoice numbers.

In the case of invoices there is probably more than just the invoice number you want to track. You probably also want to keep the date, the currency, the amount, ... To make sure the order of each of the elements in the lists are the same you can group the tags by creating a list. For example invoice_list. To turn this into tags, you just need to combine the list and the tag separated by a dot like {{invoice_list.invoice_number}}. In the example below you can see what that may look like.

Only use lists to extract multiple pieces of information from 1 document. If you want to process multiple files use the Continuously extend template option in step 3 of the configuration process.

1.3. Process Template - Generate Prompts

Once you have selected or uploaded your template, you can process it. This will automatically create a prompt for each {{tag}} in the template. If you want you can edit the prompts in the UI shown below.

You can change all the prompts if you like, but you will see that in many cases this is not necessary and you can jumpt straight to 2. Upload Example(s).

For each template the following is generated:

  • Name: This is an automatically generated name for your struct. Feel free to edit the name to anything you like. This has no impact on the performance of the algorithm.

  • Description: Here the expected document type is described and general guidlines for the algorithm are listed. Everything you add here will be applied to all the tags.

  • Tags: For every tag in the template we will list the following:

    • Name: The name of the tag as extracted from the template. This you will typically not edit since it is automatically extracted from the template.

    • Prompt: The tag prompt which details what to extract. You can improve this prompt to get better results.

    • Format: The format of the tag. By default the algorithm assumes you are extracting text. But you can change the fromat to what you disire and the AI will try to match that format. As shown in the example above you might want to change the output format for amount_vatto a number with a decimal point. The formats we support are:

      • Text

      • Score from 0 to 10

      • Number (without decimal point)

      • Number (with decimal point)

      • List

In most cases you only need to edit the data format and you don't need to edit the prompts. But if you edit the prompts, be sure to be very detailed and specific. Sometimes you will need to iterate to get the best result so try out your prompts as discussed in 2. Upload Example(s).

2. Upload Example(s)

Once the template is processed, you are ready to test out your struct.

You can copy/paste a text or you can upload up to 4 documents. If you click on Test you can test the AI will use the prompts to find the information in the example(s) for you.

To get the best performance only process 1 document at a time. The large language models have a hard time switching context from 1 document to the next. (Unless your struct is comparing documents.)

After you click the Test button you get the results as shown in the image below.

In the table you will see the the value and the rationale for each tag that was extracted. In case there is an error, you can use the rationale to improve the prompt in step 1.

If you want to download the filled out template, you can click on the file name of you template as shown below.

Now you are ready to automate this process if you want to repeat this process regularly.

3. Fill-out Procedure

If you want to fill out your template in an automated way you have 2 options:

  • Start from new template every time: Use this option if you want to start from an empty template every time

  • Continuously extend template: Select this option if you want to continue adding data to the template every time you upload a new document.

4. Trigger

You can trigger your struct using our API or by sending an email. Just click Generate new email alias and this will create a custom email address for you and you can start sending emails to this address.

Every time you send an email to this address, you will recieve a reply from fill.template@mail.structize.com with you filled out template.

If you have any issues, don't hesitate to use the chat in the platform or to reach out to us on support@structize.com

Last updated