AutomationFlowsAI & RAG › Build a Pdf-based RAG System with Openai, Pinecone and Cohere Reranking

Build a Pdf-based RAG System with Openai, Pinecone and Cohere Reranking

ByAji Prakoso @jipraks on n8n.io

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Event trigger★★★★☆ complexityAI-powered14 nodesForm TriggerPinecone Vector StoreOpenAI EmbeddingsDocument Default Data LoaderText Splitter Recursive Character Text SplitterAgentChat TriggerOpenAI Chat
AI & RAG Trigger: Event Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #5734 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger 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
{
  "id": "pDhufDfHS9qRgtLf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Simple RAG",
  "tags": [],
  "nodes": [
    {
      "id": "93cd13c5-12ad-4c9c-aac7-1886a1d24470",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "Upload RAG PDF",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "File",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": ".pdf"
            }
          ]
        },
        "formDescription": "Upload RAG PDF"
      },
      "typeVersion": 2.2
    },
    {
      "id": "13fe2ba5-a24d-4198-8509-882eb4c08e1a",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        320,
        0
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "n8n",
          "cachedResultName": "n8n"
        }
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "aa3d1481-3da7-4ae1-9857-c64a71e28443",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        920,
        460
      ],
      "parameters": {
        "options": {
          "dimensions": 1024
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "17350e15-5b99-493d-acd2-9f44fd661b09",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        440,
        220
      ],
      "parameters": {
        "options": {},
        "dataType": "binary",
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "8199713d-cad8-4d17-937c-1b3b604b95ea",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        520,
        440
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "fcaf5178-4694-4e20-ac62-8da3c1c8279e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -80
      ],
      "parameters": {
        "width": 880,
        "height": 680,
        "content": "## Insert Data to Pinecone"
      },
      "typeVersion": 1
    },
    {
      "id": "e094ded2-c2e9-4139-b6d0-df086f2e2049",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1440,
        80
      ],
      "parameters": {
        "options": {
          "systemMessage": "Hanya jawab berdasarkan data yang ada di tools \"VectorDB\". Kalau data disitu gak ada, jawab saja kamu tidak tahu."
        }
      },
      "typeVersion": 2
    },
    {
      "id": "015d2a82-3c3d-4604-bbbf-7df57dd24269",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        1200,
        80
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "a1b26946-9a3f-4aa2-a723-f91e196943cf",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1280,
        300
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6beecd5e-a8fc-4e69-8fbc-a0e0e90c4aa6",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1480,
        300
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "02b1aa4f-a291-4f2c-b6d9-0290d6b563ae",
      "name": "VectorDB",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        1640,
        300
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 20,
        "options": {},
        "useReranker": true,
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "n8n",
          "cachedResultName": "n8n"
        },
        "toolDescription": "Ambil data dari vector database untuk knowledgebase"
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "bada58fc-73f4-431f-9702-e742a75ce2c3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 860,
        "height": 680,
        "content": "## Chat AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "2e572866-dcf7-492f-aebe-35b12bc6b27d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        300
      ],
      "parameters": {
        "color": 4,
        "height": 300,
        "content": "## Embedding Model"
      },
      "typeVersion": 1
    },
    {
      "id": "6dcbbf3a-3acd-4170-9f79-c2441da18979",
      "name": "Reranker Cohere",
      "type": "@n8n/n8n-nodes-langchain.rerankerCohere",
      "position": [
        1740,
        480
      ],
      "parameters": {},
      "credentials": {
        "cohereApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6b1d46bd-ed09-4a25-a95e-fa5a3e2950f7",
  "connections": {
    "VectorDB": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Reranker Cohere": {
      "ai_reranker": [
        [
          {
            "node": "VectorDB",
            "type": "ai_reranker",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "VectorDB",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "main": [
        []
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}

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

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Source: https://n8n.io/workflows/5734/ — 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

Your AI workforce is ready. Are you?

Google Sheets Tool, Mcp Trigger, Google Drive +29
AI & RAG

This intelligent chatbot leverages cutting-edge financial APIs and AI-driven analysis to deliver comprehensive stock research reports. Get instant access to professional-grade investment analysis that

Tool Think, Supabase Vector Store, OpenAI Embeddings +15
AI & RAG

This n8n template automatically classifies incoming emails (Sales, Support, Internal, Finance, Promotions) and routes them to a dedicated OpenAI LLM Agent for processing. Depending on the category, th

OpenAI, Gmail, Text Classifier +16
AI & RAG

Automate Outreach Prospect automates finding, enriching, and messaging potential partners (like restaurants, malls, and bars) using Apify Google Maps scraping, Perplexity enrichment, OpenAI LLMs, Goog

@Devlikeapro/N8N Nodes Waha, Google Drive Trigger, @Apify/N8N Nodes Apify +14
AI & RAG

Build a powerful, customizable AI chatbot for your WordPress website that intelligently retrieves posts, answers questions, and engages in natural conversations. This complete solution handles content

Qdrant Vector Store, OpenAI Embeddings, Document Default Data Loader +10