← All N8N workflows
AI & researchChain LLMCodeExtract From FileFilterHTTP Request

ai data extraction with dynamic prompts and airtable

Configured with Chain LLM, Extract From File, Filter, HTTP Request, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
TriggerBaserow EventWebhookRoutingEvent TypeSwitchWeb / APITable Fields APIHTTP RequestCodeGet Prompt FieldsCodeTransformGet Event BodyEdit FieldsWeb / APIList Table APIHTTP RequestCodeGet Valid RowsCodeWeb / APIGet File DataHTTP RequestTransformExtract from FileExtract From FileWeb / APIUpdate RowHTTP RequestTransformGet ResultEdit FieldsRoutingLoop Over ItemsLoop Over ItemsRoutingRow ReferenceNo OpAI & modelsGenerate Field ValueChain LLMWeb / APIGet RowHTTP RequestTransformRows to ListSplit OutCodeFields to UpdateCodeRoutingLoop Over Items1Loop Over ItemsRoutingRow RefNo OpWeb / APIGet File Data1HTTP RequestTransformExtract from File1Extract From FileWeb / APIUpdate Row1HTTP RequestTransformGet Result1Edit FieldsAI & modelsGenerate Field Value1Chain LLMRoutingFilter Valid RowsFilterRoutingFilter Valid FieldsFilterRoutingEvent RefNo OpRoutingEvent Ref1No OpAI & modelsOpenAI Chat ModelOpenAI Chat ModelAI & modelsOpenAI Chat Model1OpenAI Chat Model

Node categories in this workflow

  • Trigger
  • Routing
  • Web / API
  • Code
  • Transform
  • AI & models

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.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Baserow EventTriggerWebhookSee node parameters
Event TypeRoutingSwitchSee node parameters
Table Fields APIWeb / APIHTTP RequestSee node parameters
Get Prompt FieldsCodeCodeSee node parameters
Get Event BodyTransformEdit FieldsSee node parameters
List Table APIWeb / APIHTTP RequestSee node parameters
Get Valid RowsCodeCodeSee node parameters
Get File DataWeb / APIHTTP RequestSee node parameters
Extract from FileTransformExtract From Filepdf
Update RowWeb / APIHTTP RequestPATCH
Get ResultTransformEdit FieldsSee node parameters
Loop Over ItemsRoutingLoop Over ItemsSee node parameters
Row ReferenceRoutingNo OpSee node parameters
Generate Field ValueAI & modelsChain LLMSee node parameters
Get RowWeb / APIHTTP RequestSee node parameters
Rows to ListTransformSplit OutSee node parameters
Fields to UpdateCodeCodeSee node parameters
Loop Over Items1RoutingLoop Over ItemsSee node parameters
Row RefRoutingNo OpSee node parameters
Get File Data1Web / APIHTTP RequestSee node parameters
Extract from File1TransformExtract From Filepdf
Update Row1Web / APIHTTP RequestPATCH
Get Result1TransformEdit FieldsSee node parameters
Generate Field Value1AI & modelsChain LLMSee node parameters
Filter Valid RowsRoutingFilterSee node parameters
Filter Valid FieldsRoutingFilterSee node parameters
Event RefRoutingNo OpSee node parameters
Event Ref1RoutingNo OpSee node parameters
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
OpenAI Chat Model1AI & modelsOpenAI Chat ModelSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. 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

  • httpHeaderAuth
  • openAiApi

Workflow notes

Update Row

Execute Once

1. Get Table Schema

1. Get Table Schema

Learn more about the HTTP node

For this operation, we'll have to use the Baserow API rather than the built-in node. However, this way does allow for more flexibility with query parameters.

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 Baserow 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

This template is intended to be used as a webhook source for Baserow. Looking for a Airtable version? Click here

How it works

  • Each Baserow.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_created and field_updated.
  • Next, we'll need an "input" column in our Baserow.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 Baserow). 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 Baserow Table.

How to use

  • You'll need to publish this workflow and make it accessible to our Baserow instance. Good to note, you only really need to do this once and can reuse for many Baserow Tables.
  • Configure your Baserow Table to send row_updated, field_created and field_updated events to this n8n workflow.
  • This workflow should work with both cloud-hosted and self-hosted versions of Baserow.

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 Baserow Table Row

6. Update the Baserow Table Row

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 Baserow Table row - 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 Baserow quicker.

7. Listing All Rows Under The Column

7. Listing All Rows Under The Column

Learn more about the Code node

We can use Baserow's List API and the HTTP node's pagination feature to fetch all applicable rows under the affected field - the filter query on the API is helpful here.

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 Baserow quicker.

10. Update the Baserow Table Row

10. Update the Baserow Table Row

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.

Sticky Note6

⭐️ Creating Baserow Webhooks

⭐️ Creating Baserow Webhooks

Baserow webhooks are created via the UI and the option can be accessed by clicking on the 3 dots button in the toolbar.

  • Create a POST webhook for your n8n webhook URL found in this template.
  • Select the "use fields names instead of IDs" option.
  • Select "let me choose individual events"
  • The events to choose are "row updated", "field created" and "field updated".
  • For the "row updated" event, be sure to specify the input field - in this case, "File".

ai data extraction with dynamic prompts and airtable

ai data extraction with dynamic prompts and airtable

Purpose and structure

This folder contains the ai data extraction with dynamic prompts and airtable workflow. Its executable nodes use chainLlm, code, extractFromFile, filter, httpRequest, lmChatOpenAi, noOp, set, splitInBatches, splitOut, 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

Baserow Event

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/Splitout/0699_Splitout_Code_Create_Webhook.json MIT; preserve source notices.

More in AI & research