Skip to content

Data Batch Chain

Data Batch Chain goes through a list of items, for example the rows of a spreadsheet, and for each one sends an AI model the same instructions with that item’s data. The model’s answer is added as a new field of each item, so at the end you have the original list, enriched.

Use it when you have to do the same task over many records: classify, summarise, translate or extract information.

When to use it

  • Classify hundreds of customer reviews by topic and sentiment.
  • Write a sales description for each product of a catalogue from its features.
  • Summarise each support ticket of the week in one sentence.
  • Extract the amount and date of each invoice from a list of texts.

Configuration

FieldWhat it does
promptThe instructions sent to the model for each item. Mark with braces where the item’s data goes (see below). It must have at least one gap between braces.
ConnectionWhat to connect
DataThe list of items you want to process, for example the output of CSV to Data List.
ModelAn AI model component, for example OpenAI.

Gaps between braces in the prompt

  • {Data} is replaced by the content of each item: its main text or, if you change it, the field set in Source data input key.
  • {Data.field} is replaced by the value of a specific field of each item. For example, {Data.price} takes the price field.
  • Any other name between braces, for example {language}, creates a new field in the component. Its value is the same for all items; you can type it or connect it.

Advanced options

FieldWhat it does
Max ConcurrencyHow many items are sent to the model at the same time. Default: 5.
Source data input keyThe field of each item used in {Data}. Default: text, the item’s main text.
Output key nameThe name of the new field where the model’s answer is stored. Default: chain_result.
JSON ModeReads the model’s answer as structured data in JSON format and stores it that way in the output field. Ask the model in the prompt to answer in JSON. Default: off.
JSON FlattenWith JSON Mode on, stores each value of the JSON answer as its own field of the item instead of grouping them in one field. Default: off.

Output

Data is the same list that came in, in the same order, with the model’s answer added to each item. Connect it to a component that stores or transforms data, for example one that writes to a spreadsheet or a Data to CSV.

Example

Cosmética Lirio wants to classify the reviews it receives in its online store:

  1. Load the reviews with CSV to Data List and connect its output to Data.
  2. Connect a model to Model.
  3. In prompt write: “Classify this review of product {Data.product} as positive, neutral or negative and answer with one word: {Data.comment}”.
  4. In Output key name type sentiment.

Each review comes out with a new field, sentiment, which the team uses to look at the negative ones first.

Good practices

  • Test the prompt with a few items before processing a large list.
  • If you want several values per item, turn on JSON Mode and JSON Flatten and describe the fields you expect in the prompt.
  • Raise Max Concurrency only if your model provider allows it; with high values it may reject requests.