Answer document questions with OpenAI, Pinecone, Cohere, Gemini and Google Drive
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (17)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Respond to Webhook
n8n-nodes-base.respondToWebhook - Data table
n8n-nodes-base.dataTable - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Pinecone Vector Store
@n8n/n8n-nodes-langchain.vectorStorePinecone - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Reranker Cohere
@n8n/n8n-nodes-langchain.rerankerCohere - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Code
n8n-nodes-base.code - Google Drive
n8n-nodes-base.googleDrive - Aggregate
n8n-nodes-base.aggregate - Google Sheets
n8n-nodes-base.googleSheets
What it does
Quick overview This workflow exposes a webhook-powered document Q&A chatbot that searches a Pinecone vector database with OpenAI embeddings, reranks results with Cohere, optionally falls back to Google Gemini, and returns an answer with quoted sources plus Google Drive view and download links for the referenced files. How it works 1. Receives a POST request via webhook with the user’s question in the message field. 2. Searches a Pinecone knowledge base using OpenAI embeddings, reranks the top matches with Cohere, and uses an OpenAI chat model (with Google Gemini as fallback) to produce an answer that includes the document name, page number, and an exact supporting quote. 3. Sends the generated answer to a second OpenAI-based agent that extracts only the referenced source file names into structured JSON. 4. Splits the extracted file-name list into individual items and searches Google Drive for each file to retrieve its file ID. 5. Builds Google Drive view and direct download URLs for the matched files and packages them together with the AI answer. 6. Responds to the original webhook request with the answer content and the assembled source links. Setup 1. Add credentials for OpenAI (chat model and embeddings), Pinecone, Cohere, and Google Gemini (fallback model). 2. Connect Google Drive OAuth credentials and ensure the workflow has access to the Drive location containing your source PDFs. 3. Replace YOURPINECONEINDEXNAME with your Pinecone index name and confirm your PDFs are already embedded and stored in that index. 4. Activate the workflow, copy the webhook URL, and configure your client (website widget, Slack app, etc.) to POST JSON containing a message field.