Animated data flow diagram

AI-Powered Document Q&A Agent: Google Drive, Gemini & Pinecone RAG

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

Google Drive Google Gemini Pinecone Langchain (via n8n)

Overview

Unlock Instant Answers from Your Company Knowledge Base with this AI Agent

This n8n workflow transforms your Google Drive into an intelligent, queryable knowledge base. It functions as a sophisticated AI Agent, specifically an HR assistant or internal Q&A bot, capable of understanding and responding to natural language questions based on your company's documents. The agent automatically ingests, processes, and indexes documents (e.g., policies, SOPs, product specs) when they are created or updated in a designated Google Drive folder. When an employee or team member asks a question via the integrated chat interface, the AI Agent leverages Google Gemini's advanced language models and Pinecone's efficient vector search (Retrieval Augmented Generation - RAG) to find and synthesize accurate answers directly from your organizational knowledge.

Key Features & Benefits

  • Automated Document Ingestion: Monitors a specific Google Drive folder, automatically processing new or updated files.
  • AI-Powered Document Understanding: Utilizes Google Gemini embeddings (models/text-embedding-004) to convert document content into meaningful vector representations.
  • Efficient Knowledge Storage: Stores and indexes document embeddings in a Pinecone vector database (company-files index) for fast retrieval.
  • Intelligent Q&A Capability: Features an AI Agent powered by Google Gemini (models/gemini-2.0-flash-exp) that uses RAG to answer questions based on the indexed documents.
  • Natural Language Interaction: Allows users to ask questions in plain language via a chat interface.
  • Contextual HR Assistant: Pre-configured with a system prompt to act as an HR assistant for employee questions based on company policies, but easily customizable for other roles.
  • Graceful Fallbacks: Responds appropriately (e.g., "I cannot find the answer in the available resources.") if information isn't available in the documents.
  • Real-time Updates: Keeps the knowledge base current by automatically re-indexing updated documents.

Use Cases

  • For B2C e-commerce: Equip your support or HR teams with an AI assistant that instantly answers questions about internal policies (e.g., return procedures, employee benefits) sourced directly from company handbooks in Google Drive.
  • For B2B SaaS: Enable sales, support, and product teams to quickly find accurate information on product features, technical specifications, or pricing models by querying internal documentation managed in Google Drive.
  • Automate new employee onboarding by providing an AI-powered Q&A tool that answers common questions about company culture, processes, and resources.
  • Streamline internal knowledge sharing, reducing the time employees spend searching for information across disparate documents and empowering them with self-service answers.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • A Google Cloud project with the Vertex AI API enabled.
  • A Google AI API Key obtained from Google AI Studio.
  • A Pinecone account with an API Key and an index named company-files created.
  • A dedicated folder in Google Drive for company documents.
  • n8n credentials configured for: Google Drive (OAuth2), Google Gemini (using your Google AI API key), and Pinecone (using your Pinecone API key).

Setup Instructions

  1. Ensure all prerequisites are met. Specifically, confirm your Google Cloud project, Google AI API key, Pinecone account/index, and Google Drive folder are set up, and corresponding credentials are added to n8n.
  2. Download the n8n workflow JSON file (ai-company-doc-rag-agent-v1.0.0.json).
  3. Import the workflow into your n8n instance.
  4. Configure Google Drive Triggers: In both 'Google Drive File Created' and 'Google Drive File Updated' nodes, set the 'Folder To Watch' parameter to your designated Google Drive folder.
  5. Verify Pinecone Nodes: Ensure the 'Pinecone Vector Store' and 'Pinecone Vector Store (Retrieval)' nodes are correctly linked to your Pinecone credentials and the company-files index.
  6. Verify Gemini Nodes: Ensure all 'Embeddings Google Gemini' and 'Google Gemini Chat Model' nodes are correctly linked to your Google Gemini credentials.
  7. (Optional) Customize AI Agent: Review and adjust the systemMessage in the 'AI Agent' node if you need to change its persona from the default HR assistant.
  8. Test Ingestion: Add or update a document in your watched Google Drive folder. Execute the workflow manually (or wait for the trigger) to ensure the document is processed and indexed in Pinecone.
  9. Test Q&A: Use the 'When chat message received' trigger (or n8n's chat interface, if applicable for this setup) to ask questions based on the content of your indexed documents.
  10. Activate the workflow for live operation.

Tags:

AI AgentRAGGoogle GeminiPineconeGoogle DriveDocument Q&AKnowledge ManagementHR AutomationAutomation

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation