ai data extraction with dynamic prompts and baserow
Configured with Airtable, Chain LLM, Extract From File, Filter, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- Routing
- Code
- Web / API
- Transform
- AI & models
- Data store
- Trigger
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Event Type | Routing | Switch | See node parameters |
| Get Prompt Fields | Code | Code | See node parameters |
| Get File Data | Web / API | HTTP Request | See node parameters |
| Extract from File | Transform | Extract From File | |
| Get Result | Transform | Edit Fields | See node parameters |
| Loop Over Items | Routing | Loop Over Items | See node parameters |
| Row Reference | Routing | No Op | See node parameters |
| Generate Field Value | AI & models | Chain LLM | See node parameters |
| Fields to Update | Code | Code | See node parameters |
| Loop Over Items1 | Routing | Loop Over Items | See node parameters |
| Row Ref | Routing | No Op | See node parameters |
| Get File Data1 | Web / API | HTTP Request | See node parameters |
| Extract from File1 | Transform | Extract From File | |
| Get Result1 | Transform | Edit Fields | See node parameters |
| Generate Field Value1 | AI & models | Chain LLM | See node parameters |
| Filter Valid Rows | Routing | Filter | See node parameters |
| Filter Valid Fields | Routing | Filter | See node parameters |
| Event Ref | Routing | No Op | See node parameters |
| Event Ref1 | Routing | No Op | See node parameters |
| OpenAI Chat Model | AI & models | OpenAI Chat Model | See node parameters |
| OpenAI Chat Model1 | AI & models | OpenAI Chat Model | See node parameters |
| Get Webhook Payload | Web / API | HTTP Request | See node parameters |
| Parse Event | Code | Code | See node parameters |
| Get Table Schema | Data store | Airtable | base / getSchema |
| Fetch Records | Data store | Airtable | search |
| Update Row | Data store | Airtable | update |
| Get Row | Data store | Airtable | See node parameters |
| Add Row ID to Payload | Transform | Edit Fields | See node parameters |
| Update Record | Data store | Airtable | update |
| Airtable Webhook | Trigger | Webhook | See node parameters |
| When clicking ‘Test workflow’ | Trigger | Manual Trigger | See node parameters |
| Set Airtable Vars | Transform | Edit Fields | See node parameters |
| Get Table Schema1 | Data store | Airtable | base / getSchema |
| Get "Input" Field | Transform | Edit Fields | See node parameters |
| RecordsChanged Webhook | Web / API | HTTP Request | POST |
| FieldsChanged Webhook | Web / API | HTTP Request | POST |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
airtableTokenApiopenAiApi
Workflow notes
1. Get Table Schema
1. Get Table Schema
Learn more about the Airtable node
For this operation, we'll use the handy Airtable node. I recommend getting familiar with this node for all your Airtable needs!
2a. Updates Minimal Number of Rows
2a. Updates Minimal Number of Rows
This branch updates only the rows impacted.
2b. Update Every Row under the Field
2b. Update Every Row under the Field
This branch updates all applicable rows under field when the field/column is created or changed. Watch out - if you have 1000s of rows, this could take a while!
Try It Out!
Try It Out!
This n8n template powers a "dynamic" or "user-defined" prompts with PDF workflow pattern for a Airtable table. Simply put, it allows users to populate a spreadsheet using prompts without touching the underlying template.
Check out the video demo I did for n8n Studio: https://www.youtube.com/watch?v=_fNAD1u8BZw
Check out the example Airtable here: https://airtable.com/appAyH3GCBJ56cfXl/shrXzR1Tj99kuQbyL
This template is intended to be used as a webhook source for Airtable. Looking for a Baserow version? Click here
How it works
- Each Airtable.io tables offers integration feature whereby changes to the table can be sent as events to any accessible webhook. This allows for a reactive trigger pattern which makes this type of workflow possible. For our usecase, we capture the vents of
row_updated,field_createdandfield_updated. - Next, we'll need an "input" column in our Airtable.io table. This column will be where our context lives for evaluating the prompts against. In this example, our "input" column name is "file" and it's where we'll upload our PDFs. Note, this "input" field is human-controlled and never updated from this template.
- Now for the columns (aka "fields" in Airtable). Each field allows us to define a name, type and description and together form the schema. The first 2 are self-explaintory but the "description" will be for users to provide their prompts ie. what data should the field to contain.
- In this template, a webhook trigger waits for when a row or column is updated. The incoming event comes with lots of details such as the table, row and/or column Ids that were impacted.
- We use this information to fetch the table's schema in order to get the column's descriptions (aka dynamic prompts).
- For each triggered event, we download our input ie. the PDF and ready it for our AI/LLM. By iterating through the available columns and feeding the dynamic prompts, our LLM can run those prompts against the PDF and thus generating a value response for each cell.
- These values are then collected and used to update the Airtable Record.
How to use
- You'll need to publish this workflow and make it accessible to our Airtable instance.
- you must run the "Create Airtable Webhooks" mini-flow to link it to your Airtable.
- This template is reusable for other Airtables but the webhooks need to be created each time for each table.
Need Help?
Join the Discord or ask in the Forum!
Happy Flowgramming!
2. Event Router Pattern
2. Event Router Pattern
Learn more about the Switch node
A simple switch node can be used to determine which event to handle. The difference between our row and field events is that row event affect a single row whereas field events affect all rows.
3. Filter Only Rows with Valid Input
3. Filter Only Rows with Valid Input
Learn more about the Split Out node
This step handles one or more updated rows where "updated" means the "input" column (ie. "file" in our example) for these rows were changed. For each affected row, we'll get the full row to figure out only the columns we need to update - this is an optimisation to avoid redundant work ie. generating values for columns which already have a value.
6. Update the Airtable Record
6. Update the Airtable Record
Learn more about the Edit Fields node
Finally, we can collect the LLM responses and combine them to build an API request to update our Airtable record - the Id of which we got from initial webhook. After this is done, we can move onto the next row and repeat the process.
5. PDFs, LLMs and Dynamic Prompts? Oh My!
5. PDFs, LLMs and Dynamic Prompts? Oh My!
Learn more about the Basic LLM node
This step is where it all comes together! In short, we give our LLM the PDF contents as the context and loop through our dynamic prompts (from the schema we pulled earlier) for our row. At the end, our LLM should have produced a value for each column requested.
Note: There's definitely a optimisation which could be done for caching PDFs but it beyond the scope of this demonstration.
4. Using an Items Loop
4. Using an Items Loop
Learn more about the Split in Batches node
A split in batches node is used here to update a row at a time however, this is a preference for user experience - changes are seen in the Airtable quicker.
7. Listing All Applicable Rows Under The Column
7. Listing All Applicable Rows Under The Column
Learn more about the Filter node
To keep things performant, we can decide to get only rows with inputfield populated as this is required to perform the extraction. This can easily be achieved with Airtable filters.
9. Generating Value using LLM
9. Generating Value using LLM
Learn more about the Extract From File node
Pretty much identical to Step 5 but instead of updating every field/column, we only need to generate a value for one.
8. Using an Items Loop
8. Using an Items Loop
Learn more about the Split in Batches node
Similar to Step 4, the Split in Batches node is a preference for user experience - changes are seen in the Airtable quicker.
10. Update the Airtable Record
10. Update the Airtable Record
Learn more about the Edit Fields node
As with Step 6, the LLM response is used to update the row however only under the field that was created/changed. Once complete, the loop continues and the next row is processed.
⭐️ Creating Airtable Webhooks
⭐️ Creating Airtable Webhooks
To link this workflow with Airtable, you'll have to create webhooks for the Base. You'll only really need to do this this once but if these webhooks are inactive after 7 days, you'll need to create them again.
Check out the Airtable Developer documentation for more info: https://airtable.com/developers/web/api/webhooks-overview
ai data extraction with dynamic prompts and baserow
ai data extraction with dynamic prompts and baserow
Purpose and structure
This folder contains the ai data extraction with dynamic prompts and baserow workflow. Its executable nodes use airtable, chainLlm, code, extractFromFile, filter, httpRequest, lmChatOpenAi, manualTrigger, noOp, set, splitInBatches, switch, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
Airtable Webhook, When clicking ‘Test workflow’
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0696_Code_Webhook_Create_Webhook.json MIT; preserve source notices.