Skip to main content

Chat with Google Drive documents using GPT, Pinecone, and RAG

Workflow preview

Chat with Google Drive documents using GPT, Pinecone, and RAG preview
Open on n8n.io

Important notice

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

Overview

πŸ“Œ Short Overview

Automatically sync files from Google Drive into a searchable AI knowledge base with Pinecone, and answer user queries using GPT-4o with conversational memory.

βΈ»

πŸ› οΈ Workflow Usage Steps

1. Watch Google Drive for file changes

Trigger the workflow when a new file is uploaded or an existing file is updated in a specific Google Drive folder.

2. Download and process the file

Retrieve the file, split it into smaller text chunks with a Recursive Character Text Splitter, and generate vector embeddings using OpenAI.

3. Store embeddings in Pinecone

Save the embeddings in a Pinecone vector database to keep your knowledge base continuously updated and searchable.

4. Search context for chat queries

When a user asks a question, query Pinecone for relevant context, combine results with conversational memory, and process them with GPT-4o.

5. Respond with AI-powered answers

Provide a concise response (100–200 words) that blends knowledge from your documents with the conversation history.

βΈ»

βœ… Use Cases

β€’ Keep a live, AI-ready knowledge base from your Google Drive files. β€’ Enable team members to query company documents instantly. β€’ Build a personal assistant that stays up to date with your latest uploads.

βš™οΈ Setup Steps

  1. Google Drive β€’ Create a Google Cloud project. β€’ Enable the Google Drive API. β€’ Generate OAuth credentials and connect them in n8n.
  2. OpenAI β€’ Sign up at OpenAI. β€’ Copy your API key from the dashboard. β€’ Add it to n8n under Credentials β†’ OpenAI API.
  3. Pinecone β€’ Create an account at Pinecone. β€’ Create a new index (e.g., docs-embeddings). β€’ Copy your API key and environment, then add them to n8n under Credentials β†’ Pinecone API.
  4. Workflow Configuration β€’ Import this workflow into your n8n instance. β€’ Select the Google Drive folder you want to monitor. β€’ Set the Pinecone index name in the workflow. β€’ Adjust chunk size / overlap in the text splitter if needed.
  5. Test the Workflow β€’ Upload a new document to your Google Drive folder. β€’ Run the workflow to confirm embeddings are created and stored in Pinecone. β€’ Ask a sample query and verify the AI returns a context-aware answer.