Data Retrieval Chain
Data Retrieval Chain goes through a list of items and, for each one, asks your knowledge base a question: it finds the document passages related to that item and asks an AI model to answer using only that information. The answer is added as a new field of each item.
Use it when you have a list of cases and want to check the same documentation for each one, without asking one by one by hand.
When to use it
- For each product of an order, look up its warranty terms in the manuals.
- For each supplier in a list, find its payment terms in the contracts.
- For each frequent question received by email, prepare an answer based on the support documentation.
Configuration
| Field | What it does |
|---|---|
| Question | The start of the question. Each item is asked the question made of this text followed by the item’s value. For example, with “Warranty terms of” and the item “LX200 washing machine”, it asks “Warranty terms of LX200 washing machine”. |
| Prompt | The instructions for the model. It comes with a text that tells it to answer with the information found and to say it doesn’t know if it can’t find it. It must contain {context}, where the passages found are placed, and {question}, where the question goes. |
| Connection | What to connect |
|---|---|
| Data | The list of items, for example the output of CSV to Data List. |
| Model | An AI model component, for example OpenAI. |
| Retriever (required) | The knowledge base to search: the Retriever output of a component such as Chroma DB or PGVector. |
Advanced options
| Field | What it does |
|---|---|
| Source data input key | The field of each item that is added to the question. Default: text, the item’s main text. |
| Check if value is array | If the item’s value contains several separated values, asks one question for each and joins the answers in the output field. Default: on. If you turn it off, set Source data input key to the name of a specific field. |
| Separator for array | The character that separates the values when Check if value is array is on. Default: the comma. |
| Output key name | The name of the new field where the answer is stored. Default: chain_result. |
| Max Concurrency | How many questions are processed at the same time. Default: 5. |
| JSON Mode | Reads the model’s answer as structured data in JSON format. Ask for a JSON answer in Prompt. Default: off. |
| JSON Flatten | With JSON Mode on, stores each value of the JSON answer as its own field of the item. Default: off. |
Output
Data is the same list that came in, with the answer added to each item in the field set in Output key name. Connect it to a component that stores or transforms data, for example Data to CSV.
Example
Hogar Retama receives a daily list of complaints with the affected appliance model:
- Connect the list to Data and type
modelin Source data input key. - In Question write “What does the warranty cover and how long does it last for model”.
- Connect the knowledge base with the manuals to Retriever and an AI model to Model.
- In Output key name type
warranty.
Each complaint comes out with a warranty field that summarises the coverage of its model, ready for the after-sales team to reply to the customer.
Good practices
- Word Question so that it makes sense followed by each item’s value.
- Turn off Check if value is array if the value may contain commas that don’t separate items, for example a description.