Skip to main content

Build a RAG system by uploading PDFs to the Google Gemini File Search Store

Workflow preview

Workflow preview
100%
Build a RAG system by uploading PDFs to the Google Gemini File Search Store preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This workflow implements a Retrieval Augmented Generation (RAG) system using Google Gemini's File Search API . It allows users to upload files to a dedicated search store and then ask questions abo...

Best for

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

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.formtrigger, n8n-nodes-base.merge, @n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.httprequesttool, @n8n/n8n-nodes-langchain.memorybufferwindow, n8n-nodes-base.httprequest

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Build a RAG system by uploading PDFs to the Google Gemini File Search Store
Workflow name
Build a RAG system by uploading PDFs to the Google Gemini File Search Store

This workflow implements a Retrieval-Augmented Generation (RAG) system using Google Gemini's File Search API. It allows users to upload files to a dedicated search store and then ask questions about their content in a chat interface.

The system automatically retrieves relevant information from the uploaded files to provide accurate, context-aware answers.


Key Advantages

1. ✅ Seamless Integration of File Upload + AI Context

The workflow automates the entire lifecycle:

  • Upload file
  • Index file
  • Retrieve content for AI chat

Everything happens inside one n8n automation, without manual actions.

2. ✅ Automatic Retrieval for Every User Query

The AI agent is instructed to always query the Search Store. This ensures:

  • More accurate answers
  • Context-aware responses
  • Ability to reference the exact content the user has uploaded

Perfect for knowledge bases, documentation Q&A, internal tools, and support.

3. ✅ Reusable Search Store for Multiple Sessions

Once created, the Search Store can be reused:

  • Multiple files can be imported
  • Many queries can leverage the same indexed data

A sustainable foundation for scalable RAG operations.

4. ✅ Visual and Modular Workflow Design

Thanks to n8n’s node-based flow:

  • Each step is clearly separated
  • Easy to debug
  • Easy to expand (e.g., adding authentication, connecting to a database, notifications, etc.)

5. ✅ Supports Both Form Submission and Chat Messages

The workflow is built with two entry points:

  • A form for uploading files
  • A chat-triggered entry point for RAG conversations

Meaning the system can be embedded in multiple user interfaces.

6. ✅ Compliant and Efficient Interaction With Gemini APIs

Your workflow respects the structure of Gemini’s File Search API:

  • /fileSearchStores (create store)
  • upload endpoint
  • importFile endpoint
  • generateContent with file search tools

This ensures compatibility and future expandability.

7. ✅ Memory-Aware Conversations

With the Memory Buffer node, the chat session preserves context across messages—providing a more natural and sophisticated conversational experience.


How it Works

STEP 1 - Create a new Search Store

Triggered manually via the “Execute workflow” node, this step sends a request to the Gemini API to create a FileSearch Store, which acts as a private vector index for your documents.

  • The store name is then saved using a Set node.
  • This store will later be used for file import and retrieval.
STEP 2 - Upload and import a file into the Search Store

When the form is submitted (through the Form Trigger), the workflow:

  1. Accepts a file upload via the form.
  2. Uploads the file to Gemini using the /upload endpoint.
  3. Imports the uploaded file into the Search Store, making it searchable.

This step ensures content is stored, chunked, and indexed so the AI model can retrieve relevant sections later.

STEP 3 - RAG-enabled Chat with Google Gemini

When a chat message is received:

  • The workflow loads the Search Store identifier.
  • A LangChain Agent is used along with the Google Gemini Chat Model.
  • The model is configured to always use the SearchStore tool, so every user query is enriched by a search inside the indexed files.
  • The system retrieves relevant chunks from your documents and uses them as context for generating more accurate responses.

This creates a fully functioning RAG chatbot powered by Gemini.


Set up Steps

Before activating this workflow, you must complete the following configuration:

  1. Google Gemini API Credentials: Ensure you have a valid Google AI Studio API key. This key must be entered in all HTTP Request nodes (Create Store, Upload File, Import to Store, and SearchStore).

  2. Configure the Search Store:

    • Manually trigger the "Create Store" node once via the "Execute Workflow" button. This will call the Gemini API to create a new File Search Store and return its resource name (e.g., fileSearchStores/my-store-12345).
    • Copy this resource name and update the "Get Store" and "Get Store1" Set nodes. Replace the placeholder value fileSearchStores/my-store-XXX in both nodes with the actual name of your newly created store.
  3. Deploy Triggers: For production use, you should activate the workflow. This will generate public URLs for the "On form submission" node (for file uploads) and the "When chat message received" node (for the chat interface). These URLs can be embedded in your applications (e.g., a website or dashboard).

Once these steps are complete, the workflow is ready. Users can start uploading files via the form and then ask questions about them in the chat.


Need help customizing?

Contact me for consulting and support or add me on Linkedin.

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 clicking ‘Execute workflow’

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

Block 2 - On form submission

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.3

Block 3 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 4 - When chat message received

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

Block 5 - Google Gemini Chat Model

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

Block 6 - Merge1

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 7 - SearchStore

Type / Role
n8n-nodes-base.httpRequestTool - httpRequestTool
Config choices
Version 4.3

Block 8 - Simple Memory

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

Block 9 - Create Store

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 10 - Upload File

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 11 - Import to Store

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 12 - Get Store1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Rag Agent

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

Block 14 - Sticky Note

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

Block 15 - Sticky Note1

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

Block 16 - Sticky Note2

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

Block 17 - Sticky Note3

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

Block 18 - Sticky Note4

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

Block 19 - Get Store

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 20 - Sticky Note5

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

3. Summary Table

Workflow Build a RAG system by uploading PDFs to the Google Gemini File Search Store
Complexity advanced
Nodes 20
Categories Internal Wiki, AI RAG
Author Davide
Published 24 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11197/11197.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 Build a RAG system by uploading PDFs to the Google Gemini File Search Store do?

This workflow implements a Retrieval Augmented Generation (RAG) system using Google Gemini's File Search API . It allows users to upload files to a dedicated search store and then ask questions abo...

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 Internal Wiki, AI RAG use case.