Skip to content

Trustcall Extractor

Trustcall Extractor reads texts and pulls out the information you have described in one or more schemas. Each schema says which fields you want (for example, an invoice’s supplier, date and amount) and the component uses an AI model to fill them in.

It processes several texts at once and adds what it extracted to each one. It can also be offered as a tool so an agent extracts information when it needs to.

When to use it

  • Pull the key details from every invoice or delivery note that arrives by email.
  • Extract the contact details found in a batch of emails or signatures.
  • Handle texts of different kinds with one schema each (for example, orders and complaints) and let the model choose which one applies.
  • Give an agent the ability to extract tidy data from what a customer writes.

Configuration

FieldWhat it does
prompt (required)The instructions for the model. Write {Data} where the text to analyze should go, for example: “Extract the invoice details from the following text: {Data}”.
Schemas (required)One or more schemas with the information you want to extract. Connect them from Schema Builder.
Schema to extractWith a single schema connected, that one is always used. With several, the model decides which schema fits each text.
Input DataThe texts you want to analyze. It can be a message or a list of records.
Model (required)The AI model that does the extraction. Connect a model component here.

Advanced options

FieldWhat it does
Max ConcurrencyHow many texts are analyzed at the same time. The default is 5.
Tool NameThe name an agent sees for this component when it uses it as a tool. The default is get_entities_tool.
Tool descriptionThe description the agent reads to know when to use the tool. The default is “Extract entities from text.”.

Output

The component has two outputs:

  • Data: the same records you sent in, each with a new field, extraction_result, holding the information extracted according to the schema.
  • Tool: the extractor as a tool. Connect it to an agent so it can pass a text and get the extracted data back.

Example

An accounting firm receives dozens of PDF invoices every day. The flow extracts the text of each file and sends it to Trustcall Extractor with an Invoice schema (supplier, date, number and amount) built in Schema Builder. In prompt it writes “Extract the details of this invoice: {Data}”. Each record comes out with its extraction_result and is saved as a row in the accounting sheet.

Good practices

  • Use {Data} in prompt to choose where each record’s text goes. Without it, the text is added after your instructions.
  • If you will analyze many texts, set Max Concurrency to what your model provider allows.