AutomationFlowsAI & RAG › AI File Upload to PGVector

AI File Upload to PGVector

Original n8n title: File Upload

File upload. Uses localFileTrigger, vectorStorePGVector, embeddingsMistralCloud, readWriteFile. Event-driven trigger; 11 nodes.

Event trigger★★★☆☆ complexityAI-powered11 nodesLocal File TriggerVector Store PgvectorEmbeddings Mistral CloudRead Write FilePostgresText Splitter Recursive Character Text SplitterDocument Default Data Loader
AI & RAG Trigger: Event Nodes: 11 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow follows the Documentdefaultdataloader → Textsplitterrecursivecharactertextsplitter recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "File upload",
  "nodes": [
    {
      "parameters": {
        "triggerOn": "folder",
        "path": "mudeli_input",
        "events": [
          "add"
        ],
        "options": {
          "awaitWriteFinish": true,
          "ignoreInitial": true
        }
      },
      "type": "n8n-nodes-base.localFileTrigger",
      "typeVersion": 1,
      "position": [
        -140,
        340
      ],
      "id": "8d716424-f142-4522-9280-a3c869837a78",
      "name": "Local File Trigger"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": "pdf_vectors",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "typeVersion": 1,
      "position": [
        460,
        580
      ],
      "id": "88afb19f-c434-4c45-8b55-8a3a6248bb7c",
      "name": "Postgres PGVector Store",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "batchSize": 32
        }
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "typeVersion": 1,
      "position": [
        420,
        780
      ],
      "id": "cfae9d05-03df-4bbb-99d1-8e82a99770ae",
      "name": "Embeddings Mistral Cloud2",
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fileSelector": "={{ $json.path }}",
        "options": {
          "fileExtension": "csv",
          "mimeType": "text/csv",
          "dataPropertyName": "data"
        }
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        40,
        340
      ],
      "id": "c88c32bf-e7ec-40dd-a502-2890f3167960",
      "name": "Read/Write Files from Disk1",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        240,
        340
      ],
      "id": "5b2477ca-b1bb-41f0-ba96-511ac5f233cc",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "kegg_annotations",
          "mode": "list",
          "cachedResultName": "kegg_annotations"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $json['Unnamed: 0'] }}",
            "length_bp": "={{ $json.length_bp }}",
            "quantification_keggcharter": "={{ $json['Quantification (KEGGCharter)'] }}",
            "locus_tag": "={{ $json.locus_tag }}",
            "ftype": "={{ $json.ftype }}",
            "gene": "={{ $json.gene }}",
            "ec_number": "={{ $json.EC_number }}",
            "cog": "={{ $json.COG }}",
            "product": "={{ $json.product }}",
            "ko_ec_column": "={{ $json['KO (ec-column)'] }}",
            "ec_ec_column": "={{ $json['EC (ec-column)'] }}",
            "ko_cog_column": "={{ $json['KO (cog-column)'] }}",
            "ko_keggcharter": "={{ $json['KO (KEGGCharter)'] }}",
            "ec_number_keggcharter": "={{ $json['EC number (KEGGCharter)'] }}",
            "Strain number": "={{ $('Local File Trigger').item.json.path.split('/').pop().replace('.csv', '') }}",
            "taxon": "={{ $json.taxonomy }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "locus_tag",
              "displayName": "locus_tag",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ftype",
              "displayName": "ftype",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "length_bp",
              "displayName": "length_bp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "gene",
              "displayName": "gene",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ec_number",
              "displayName": "ec_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "cog",
              "displayName": "cog",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "product",
              "displayName": "product",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "quantification_keggcharter",
              "displayName": "quantification_keggcharter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "taxon",
              "displayName": "taxon",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "ko_ec_column",
              "displayName": "ko_ec_column",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ec_ec_column",
              "displayName": "ec_ec_column",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ko_cog_column",
              "displayName": "ko_cog_column",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ko_keggcharter",
              "displayName": "ko_keggcharter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ec_number_keggcharter",
              "displayName": "ec_number_keggcharter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Strain number",
              "displayName": "Strain number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        440,
        340
      ],
      "id": "99fd699d-f5af-4910-8070-216dacdc84f6",
      "name": "Postgres regular database",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "triggerOn": "folder",
        "path": "pdfs",
        "events": [
          "add"
        ],
        "options": {
          "awaitWriteFinish": true,
          "ignoreInitial": true
        }
      },
      "type": "n8n-nodes-base.localFileTrigger",
      "typeVersion": 1,
      "position": [
        -140,
        580
      ],
      "id": "39bba65b-d306-4b23-b6a7-a2eda7b71089",
      "name": "Local File Trigger1"
    },
    {
      "parameters": {
        "fileSelector": "={{ $json.path }}",
        "options": {
          "fileExtension": "pdf",
          "mimeType": "application/pdf",
          "dataPropertyName": "pdf_data"
        }
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        40,
        580
      ],
      "id": "3727a050-37ac-454c-849d-d5d5442a653f",
      "name": "Read/Write Files from Disk2",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "chunkSize": 3000,
        "chunkOverlap": 200,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        600,
        940
      ],
      "id": "08d9eca7-4a50-4128-81d6-bc8e864bf55e",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "operation": "pdf",
        "binaryPropertyName": "pdf_data",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        240,
        580
      ],
      "id": "0d96579d-3ecb-4a34-8f19-50d773da1097",
      "name": "Extract from File1"
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $('Extract from File1').item.json.text }}",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "file-name",
                "value": "={{ $('Read/Write Files from Disk2').item.json.fileName }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        560,
        780
      ],
      "id": "e3ce3e24-48df-4fa7-9952-207253dd8934",
      "name": "Default Data Loader"
    }
  ],
  "connections": {
    "Local File Trigger": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Mistral Cloud2": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Postgres regular database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Local File Trigger1": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk1": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk2": {
      "main": [
        [
          {
            "node": "Extract from File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File1": {
      "main": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "df48b059-2365-42c8-86a0-7f28a058b937",
  "id": "X74CslmFOweryfUc",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

File upload. Uses localFileTrigger, vectorStorePGVector, embeddingsMistralCloud, readWriteFile. Event-driven trigger; 11 nodes.

Source: https://github.com/Karlerikkanal/GenomeAnalysisTool/blob/af76a30a7848e2f08b257e4f559d31641c3d9d86/workflows/File_upload.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Build A Financial Documents Assistant Using Qdrant And Mistral.Ai. Uses localFileTrigger, manualTrigger, stickyNote, readWriteFile. Event-driven trigger; 29 nodes.

Local File Trigger, Read Write File, Embeddings Mistral Cloud +8
AI & RAG

Localfile. Uses localFileTrigger, manualTrigger, stickyNote, readWriteFile. Event-driven trigger; 29 nodes.

Local File Trigger, Read Write File, Embeddings Mistral Cloud +8
AI & RAG

This n8n workflow demonstrates how to manage your Qdrant vector store when there is a need to keep it in sync with local files. It covers creating, updating and deleting vector store records ensuring

Local File Trigger, Read Write File, Embeddings Mistral Cloud +8
AI & RAG

Breakdown Documents Into Study Notes Using Templating Mistralai And Qdrant. Uses localFileTrigger, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter, embeddingsMistralCloud. Event-

Local File Trigger, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +9
AI & RAG

Localfile Wait. Uses localFileTrigger, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter, embeddingsMistralCloud. Event-driven trigger; 42 nodes.

Local File Trigger, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +9