RAG Chatbot for HR Documents using Google Drive and Gemini - n8n Workflow

Use this comprehensive n8n workflow to create a Retrieval-Augmented Generation (RAG) chatbot. Automatically sync company policies from Google Drive to Pinecone using Gemini embeddings.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

HR Departments: Seeking automated, instant answers to employee policy questions.
Automation Specialists: Looking for robust n8n templates integrating LangChain, Pinecone, and Google services.
Developers: Needing an efficient system to manage internal knowledge bases and deploy custom RAG chatbots.
n8n Users: Interested in building complex AI agents and utilizing the n8n workflow structure for data ingestion.

Overview

Managing internal documentation and ensuring employees have fast access to accurate policy information can be challenging. This advanced n8n workflow solves this by establishing a robust, two-part Retrieval-Augmented Generation (RAG) system, leveraging Google Drive for document storage and Pinecone for vector indexing.

The first critical function is the automated ingestion pipeline. It uses an n8n trigger connected to Google Drive to constantly monitor for new or updated company documents. Once a change is detected, the n8n node sequence processes the file, guaranteeing that your AI knowledge base is always current.

Secondly, this n8n template provides a live chat interface, powered by an AI Agent that uses the structured documents to respond intelligently. By utilizing specific LangChain n8n node types, the agent retrieves contextually relevant information before generating a final answer, making this n8n workflow highly accurate and efficient for internal support tasks.

How it Works

This n8n workflow operates in two distinct, yet interconnected, sequences:

1. Document Ingestion Pipeline


  1. Triggering the Ingestion: The process begins with two dedicated Google Drive n8n trigger nodes (one for 'File Created' and one for 'File Updated'). These n8n node components continuously monitor a specified company documents folder.

  2. File Download: Upon triggering, the relevant file is downloaded using the Google Drive n8n node.

  3. Data Loading and Splitting: The file data is loaded by the Default Data Loader and then segmented into manageable chunks by the Recursive Character Text Splitter (with a 100 character overlap) to prepare it for vectorization.

  4. Embedding Generation: The Embeddings Google Gemini n8n node converts the text chunks into dense vector representations using the models/text-embedding-004 model.

  5. Vector Storage: The Pinecone Vector Store n8n node inserts these new vectors into the designated company-files index, completing the ingestion cycle.

2. RAG Chat Pipeline


  1. Chat Initiation: The When chat message received n8n trigger starts the interaction when a user submits a query.

  2. Agent Orchestration: The core AI Agent n8n node receives the user query. It is pre-configured with a system message guiding it to act as a helpful HR assistant, prioritizing the use of the available document retrieval tool.

  3. Memory and Language Model: The agent utilizes the Window Buffer Memory n8n node to maintain conversation history and the Google Gemini Chat Model (models/gemini-2.0-flash-exp) for reasoning.

  4. Vector Store Tool Execution: When needed, the agent executes the Vector Store Tool which initiates a retrieval process from Pinecone, leveraging a secondary Gemini embedding and chat model setup to fetch relevant document segments based on the user's question.

  5. Final Response: The AI Agent synthesizes the retrieved information and history to provide a concise, accurate answer, or responds with a specific message if no relevant information is found in the documents.

Installation Guide

To deploy this powerful n8n workflow, follow these setup steps:


  1. Prerequisites: Ensure you have access to Google Cloud/Vertex AI (for API key), a Pinecone account (and an index named company-files), and a dedicated folder in Google Drive for your documents.

  2. Import the Workflow: Copy the provided JSON data and import it directly into your n8n instance.

  3. Configure Credentials: Set up the required n8n credentials for:

Google Drive OAuth2
Google Gemini(PaLM) Api (using your Google AI API key)
* Pinecone API (using your Pinecone API key)

  1. Configure Google Drive Triggers: Update both Google Drive n8n trigger nodes ('File Created' and 'File Updated') to specifically watch the folder containing your company documents.

  2. Activate Nodes: Ensure the Pinecone Vector Store and Pinecone Vector Store (Retrieval) n8n node components are configured to use your company-files index.

  3. Activate: Save and activate the n8n workflow. Documents added or updated in Google Drive will now automatically sync, and the RAG chatbot will be operational via its webhook URL.

Node Details

This n8n workflow relies heavily on specialized LangChain n8n node types for its RAG functionality:

Google Drive Trigger (File Created/Updated): The primary n8n trigger for the ingestion pipeline. Monitors a specific folder and initiates the workflow when a document is added or modified.
Download File From Google Drive: Downloads the binary content of the file triggered by the n8n trigger, making it available for processing.
Recursive Character Text Splitter: A crucial n8n node for RAG. It splits the raw document into smaller text chunks, configured here with a 100 character overlap for better contextual embedding.
Embeddings Google Gemini: This n8n node uses the Gemini embedding model (models/text-embedding-004) to generate vectors, turning text into searchable numerical data.
Pinecone Vector Store (Insert Mode): The destination n8n node for the embeddings. It pushes the vector data into the company-files Pinecone index for storage.
When chat message received: The primary n8n trigger for the chat pipeline. It exposes a webhook URL for user interaction.
AI Agent: The intelligent core n8n node of the system. It uses an internal monologue and tools to determine the best course of action (in this case, using the companydocumentstool).
Vector Store Tool: An n8n node that defines the capability of the AI Agent to search the vector database, connecting the agent to the Pinecone retrieval components.


  • Google Gemini Chat Model: Used in two places (as the primary LLM for the Agent and within the retrieval tool) for generating human-readable responses based on the retrieved context.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Full-stack developer with 5+ years streamlining healthcare processes. Proficient in NodeJS, VueJS, MongoDB, PostgreSQL, Kubernetes, and n8n. Ready to optimize your workflows – book a consult via my link.

Featured*