Skip to main content

Create a company policy chatbot with RAG, Pinecone vector database, and OpenAI

Workflow preview

Workflow preview
100%
Create a company policy chatbot with RAG, Pinecone vector database, and OpenAI preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

A RAG Chatbot with n8n and Pinecone Vector Database Retrieval Augmented Generation (RAG) allows Large Language Models (LLMs) to provide context aware answers by retrieving information from an exter...

Best for

  • AI RAG automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memorybufferwindow, @n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.toolcalculator, n8n-nodes-base.googledrivetrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Pramod Rathoure.

Original n8n.io source

1.1 Workflow description

Title
Create a company policy chatbot with RAG, Pinecone vector database, and OpenAI
Workflow name
Create a company policy chatbot with RAG, Pinecone vector database, and OpenAI

A RAG Chatbot with n8n and Pinecone Vector Database

Retrieval-Augmented Generation (RAG) allows Large Language Models (LLMs) to provide context-aware answers by retrieving information from an external vector database. In this post, we’ll walk through a complete n8n workflow that builds a chatbot capable of answering company policy questions using Pinecone Vector Database and OpenAI models.

Our setup has two main parts:

  1. Data Loading to RAG – documents (company policies) are ingested from Google Drive, processed, embedded, and stored in Pinecone.
  2. Data Retrieval using RAG – user queries are routed through an AI Agent that uses Pinecone to retrieve relevant information and generate precise answers.

1. Data Loading to RAG

This workflow section handles document ingestion. Whenever a new policy file is uploaded to Google Drive, it is automatically processed and indexed in Pinecone.

Nodes involved:

  • Google Drive Trigger
    Watches a specific folder in Google Drive. Any new or updated file triggers the workflow.

  • Google Drive (Download)
    Fetches the file (e.g., a PDF policy document) from Google Drive for processing.

  • Recursive Character Text Splitter
    Splits long documents into smaller chunks (with a defined overlap). This ensures embeddings remain context-rich and retrieval works effectively.

  • Default Data Loader
    Reads the binary document (PDF in this setup) and extracts the text.

  • OpenAI Embeddings
    Generates high-dimensional vector representations of each text chunk using OpenAI’s embedding models.

  • Pinecone Vector Store (Insert Mode)
    Stores the embeddings into a Pinecone index (n8ntest), under a chosen namespace. This step makes the policy data searchable by semantic similarity.

👉 Example flow: When HR uploads a new Work From Home Policy PDF to Google Drive, it is automatically split, embedded, and indexed in Pinecone.


2. Data Retrieval using RAG

Once documents are loaded into Pinecone, the chatbot is ready to handle user queries. This section of the workflow connects the chat interface, AI Agent, and retrieval pipeline.

Nodes involved:

  • When Chat Message Received
    Acts as the webhook entry point when a user sends a question to the chatbot.

  • AI Agent
    The core reasoning engine. It is configured with a system message instructing it to only use Pinecone-backed knowledge when answering.

  • Simple Memory
    Keeps track of the conversation context, so the bot can handle multi-turn queries.

  • Vector Store QnA Tool
    Queries Pinecone for the most relevant chunks related to the user’s question. In this workflow, it is configured to fetch company policy documents.

  • Pinecone Vector Store (Query Mode)
    Acts as the connection to Pinecone, fetching embeddings that best match the query.

  • OpenAI Chat Model
    Refines the retrieved chunks into a natural and concise answer. The model ensures answers remain grounded in the source material.

  • Calculator Tool
    Optional helper if the query involves numerical reasoning (e.g., leave calculations or benefit amounts).

👉 Example flow: A user asks “How many work-from-home days are allowed per month?”. The AI Agent queries Pinecone through the Vector Store QnA tool, retrieves the relevant section of the HR policy, and returns a concise answer grounded in the actual document.


Wrapping Up

By combining n8n automation, Pinecone for vector storage, and OpenAI for embeddings + LLM reasoning, we’ve created a self-updating RAG chatbot.

  • Data Loading pipeline ensures that every new company policy document uploaded to Google Drive is immediately available for semantic search.
  • Data Retrieval pipeline allows employees to ask natural language questions and get document-backed answers.

This setup can easily be adapted for other domains — compliance manuals, tax regulations, legal contracts, or even product documentation.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 2 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 4 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 5 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.2

Block 6 - Embeddings OpenAI

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 7 - Calculator

Type / Role
@n8n/n8n-nodes-langchain.toolCalculator - toolCalculator
Config choices
Version 1

Block 8 - Google Drive Trigger

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 9 - Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 10 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 11 - Recursive Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - PineconeVectorStore

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.2

Block 14 - OpenAI Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 15 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Vector Store QnA

Type / Role
@n8n/n8n-nodes-langchain.toolVectorStore - toolVectorStore
Config choices
Version 1.1

Block 17 - OpenAI Chat Model2

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

3. Summary Table

Workflow Create a company policy chatbot with RAG, Pinecone vector database, and OpenAI
Complexity advanced
Nodes 17
Categories AI RAG, Multimodal AI
Author Pramod Rathoure
Published 19 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7563/7563.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create a company policy chatbot with RAG, Pinecone vector database, and OpenAI do?

A RAG Chatbot with n8n and Pinecone Vector Database Retrieval Augmented Generation (RAG) allows Large Language Models (LLMs) to provide context aware answers by retrieving information from an exter...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI RAG, Multimodal AI use case.