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.
1. ✅ Seamless Integration of File Upload + AI Context
The workflow automates the entire lifecycle:
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:
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:
A sustainable foundation for scalable RAG operations.
4. ✅ Visual and Modular Workflow Design
Thanks to n8n’s node-based flow:
5. ✅ Supports Both Form Submission and Chat Messages
The workflow is built with two entry points:
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 endpointimportFile endpointgenerateContent with file search toolsThis 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.
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.
When the form is submitted (through the Form Trigger), the workflow:
/upload endpoint.This step ensures content is stored, chunked, and indexed so the AI model can retrieve relevant sections later.
When a chat message is received:
This creates a fully functioning RAG chatbot powered by Gemini.
Before activating this workflow, you must complete the following configuration:
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).
Configure the Search Store:
fileSearchStores/my-store-12345).fileSearchStores/my-store-XXX in both nodes with the actual name of your newly created store.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.
Contact me for consulting and support or add me on Linkedin.