Answer Google Drive document questions with citations and OpenAI RAG
Ready for 3.0What this workflow does
This AI workflow has 37 nodes and runs when a chat message arrives (plus 3 other triggers). Along the way it connects Embeddings OpenAI, OpenAI Chat Model and Google Drive.
How it runs
Trigger: When a chat message arrives (plus 3 other triggers).
- Your Settings (Edit Fields (Set)): sets 10 fields: driveFolderId, similarityThreshold, stalenessMonths…
- Reset the file index after a restart (Data table): delete rows
- Create table rag_file_index (Data table): create (table)
- Route by trigger type (If): checks a condition and branches into true / false
- Create table rag_query_log (Data table): create (table)
- Did the message contain a question? (If): checks a condition and branches into true / false
- List files in the Drive folder (Google Drive): search (file folder)
- Create table rag_index_runs (Data table): create (table)
- Retrieve matching chunks (Simple Vector Store): searches the Simple vector store, with embeddings: Create embeddings for retrieval
- Reply to an empty message (Edit Fields (Set)): sets 1 field: replyText
…plus 16 more steps. See the full node list below.
Services it uses
Other OpenAI + Google Drive templates (628)
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (17)
- Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Simple Vector Store
@n8n/n8n-nodes-langchain.vectorStoreInMemory - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Code
n8n-nodes-base.code - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Merge
n8n-nodes-base.merge - Google Drive
n8n-nodes-base.googleDrive - Data table
n8n-nodes-base.dataTable - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - Schedule Trigger
n8n-nodes-base.scheduleTrigger - n8n Trigger
n8n-nodes-base.n8nTrigger - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Manual Trigger
n8n-nodes-base.manualTrigger
From the author
Quick overview This workflow indexes files from a Google Drive folder into an in-memory vector store and answers questions in an n8n Chat using OpenAI, returning short answers with file citations and a staleness warning when the best source document is older…