Back to Catalog

Document Q&A with RAG: Query PDF content using Weaviate and OpenAI

Mary NewhauserMary Newhauser
2129 views
2/3/2026
Official Page

RAG over a PDF with Weaviate

This workflow allows you to upload a PDF file and ask questions about it using the Question and Answer Chain and the Weaviate Vector Store nodes.

Who it's for

This workflow is the simplest possible implementation of RAG with Weaviate in n8n. It's intended to act as an extendable template for RAG over your own documents.

Prerequisites

  1. An existing Weaviate cluster. You can view instructions for setting up a local cluster with Docker here or a Weaviate Cloud cluster here.
  2. API keys to generate embeddings and power chat models. We use OpenAI, but feel free to switch out the models as you like.
  3. Self-hosted n8n instance. See this video for how to get set up in just three minutes.

How it works

Part 1: Manually upload data

In this example, we manually upload a 100+ page article from arXiv called "A Survey of Large Language Models". But you can replace this with your own more advanced data pipeline, if you wish.

Part 2: Embed and load data into Weaviate collection

Here, we generate embeddings for the full-text of the article and store them in Weaviate.

Part 3: Perform RAG over PDF file with Weaviate

In this part of the workflow, you can enter your query by running the Chat Node and get a RAG response grounded in context via the Question and Answer Chain node.

How to run the workflow

  1. Go through the prerequisites, creating a Weaviate cluster (can be local or cloud), downloading self-hosted n8n, and adding your API keys and other credentials.
  2. Select the embedding and chat models you'd like to use.
  3. Upload a PDF file you want to ask questions about.
  4. Execute the rest of the workflow.

Document QA with RAG: Query PDF Content using Weaviate and OpenAI

This n8n workflow demonstrates a powerful Document Question-Answering (QA) system leveraging Retrieval Augmented Generation (RAG). It allows users to upload a PDF document, process its content, store it in a Weaviate vector database, and then query that content using an OpenAI Large Language Model (LLM).

What it does

This workflow automates the following steps:

  1. Triggers on form submission or chat message: The workflow can be initiated either by submitting a form (e.g., to upload a PDF) or by receiving a chat message (e.g., to ask a question).
  2. Extracts content from uploaded file: If a file (like a PDF) is provided via the form, it extracts the raw text content.
  3. Loads document data: The extracted text is then loaded as a document for further processing.
  4. Splits text into chunks: The document content is broken down into smaller, manageable chunks using a Recursive Character Text Splitter. This is crucial for efficient vector storage and retrieval.
  5. Generates embeddings with OpenAI: Each text chunk is converted into a numerical vector (embedding) using OpenAI's embedding models.
  6. Stores embeddings in Weaviate: These embeddings, along with their original text, are then stored in a Weaviate vector database, enabling semantic search.
  7. Retrieves relevant documents from Weaviate: When a query is received, the workflow uses a Vector Store Retriever to find the most semantically similar document chunks from Weaviate based on the query's embedding.
  8. Answers questions using OpenAI Chat Model: The retrieved document chunks are then provided as context to an OpenAI Chat Model, which generates a comprehensive answer to the user's question, augmented by the relevant document content.

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n instance: A running n8n instance (cloud or self-hosted).
  • OpenAI API Key: For generating embeddings and answering questions with the chat model.
  • Weaviate Instance: Access to a Weaviate vector database (e.g., Weaviate Cloud or a self-hosted instance).

Setup/Usage

  1. Import the workflow:
    • Download the provided JSON file.
    • In your n8n instance, go to "Workflows" and click "New".
    • Click the three dots in the top right corner and select "Import from JSON".
    • Paste the workflow JSON or upload the file.
  2. Configure Credentials:
    • Locate the "Embeddings OpenAI" and "OpenAI Chat Model" nodes and configure your OpenAI API key credential.
    • Locate the "Weaviate Vector Store" node and configure your Weaviate API key and URL credentials.
  3. Activate the workflow: Toggle the workflow to "Active".
  4. Upload a document (via Form Trigger):
    • The "On form submission" node provides a URL. Access this URL in your browser.
    • You can upload a PDF file through this form. The workflow will process and store its content in Weaviate.
  5. Query the document (via Chat Trigger):
    • The "When chat message received" node can be used to integrate with a chat platform (e.g., Slack, Telegram, etc.). You'll need to configure this node to listen for messages from your desired platform.
    • Once configured, send a message to your integrated chat platform asking a question about the content of the PDF you uploaded. The workflow will retrieve relevant information from Weaviate and respond with an answer generated by OpenAI.

Related Templates

Generate AI images in bulk with Freepik, Google Sheets & Drive

This n8n workflow automates bulk AI image generation using Freepik's Text-to-Image API. It reads prompts from a Google Sheet, generates multiple variations of each image using Freepik's AI, and automatically uploads the results to Google Drive with organized file names. This is perfect for content creators, marketers, or designers who need to generate multiple AI images in bulk and store them systematically. Key Features: Bulk image generation from Google Sheets prompts Multiple variations per prompt (configurable duplicates) Automatic file naming and organization Direct upload to Google Drive Batch processing for efficient API usage Freepik AI-powered image generation Step-by-Step Implementation Guide Prerequisites Before setting up this workflow, you'll need: n8n instance (cloud or self-hosted) Freepik API account with Text-to-Image access Google account with access to Sheets and Drive Google Sheet with your prompts Step 1: Set Up Freepik API Credentials Go to Freepik API Developer Portal Create an account or sign in Navigate to your API dashboard Generate an API key for Text-to-Image service Copy the API key and save it securely In n8n, go to Credentials → Add Credential → HTTP Header Auth Configure as follows: Name: "Header Auth account" Header Name: x-freepik-api-key Header Value: Your Freepik API key Step 2: Set Up Google Credentials Google Sheets Access: Go to Google Cloud Console Create a new project or select existing one Enable Google Sheets API Create OAuth2 credentials In n8n, go to Credentials → Add Credential → Google Sheets OAuth2 API Enter your OAuth2 credentials and authorize with spreadsheets.readonly scope Google Drive Access: In Google Cloud Console, enable Google Drive API In n8n, go to Credentials → Add Credential → Google Drive OAuth2 API Enter your OAuth2 credentials and authorize Step 3: Create Your Google Sheet Create a new Google Sheet: sheets.google.com Set up your sheet with these columns: Column A: Prompt (your image generation prompts) Column B: Name (identifier for file naming) Example data: | Prompt | Name | |-------------------------------------------|-------------| | A serene mountain landscape at sunrise | mountain-01 | | Modern office space with natural lighting | office-02 | | Cozy coffee shop interior | cafe-03 | Copy the Sheet ID from the URL (the long string between /d/ and /edit) Step 4: Set Up Google Drive Folder Create a folder in Google Drive for your generated images Copy the Folder ID from the URL when viewing the folder Note: The workflow is configured to use a folder called "n8n workflows" Step 5: Import and Configure the Workflow Copy the provided workflow JSON In n8n, click Import from File or Import from Clipboard Paste the workflow JSON Configure each node as detailed below: Node Configuration Details: Start Workflow (Manual Trigger) No configuration needed Used to manually start the workflow Get Prompt from Google Sheet (Google Sheets) Document ID: Your Google Sheet ID (from Step 3) Sheet Name: Sheet1 (or your sheet name) Operation: Read Credentials: Select your "Google Sheets account" Double Output (Code Node) Purpose: Creates multiple variations of each prompt JavaScript Code: javascript const original = items[0].json; return [ { json: { ...original, run: 1 } }, { json: { ...original, run: 2 } }, ]; Customization: Add more runs for additional variations Loop (Split in Batches) Processes items in batches to manage API rate limits Options: Keep default settings Reset: false Create Image (HTTP Request) Method: POST URL: https://api.freepik.com/v1/ai/text-to-image Authentication: Generic → HTTP Header Auth Credentials: Select your "Header Auth account" Send Body: true Body Parameters: Name: prompt Value: ={{ $json.Prompt }} Split Responses (Split Out) Field to Split Out: data Purpose: Separates multiple images from API response Convert to File (Convert to File) Operation: toBinary Source Property: base64 Purpose: Converts base64 image data to file format Upload Image to Google Drive (Google Drive) Operation: Upload Name: =Image - {{ $('Get Prompt from Google Sheet').item.json.Name }} - {{ $('Double Output').item.json.run }} Drive ID: My Drive Folder ID: Your Google Drive folder ID (from Step 4) Credentials: Select your "Google Drive account" Step 6: Customize for Your Use Case Modify Duplicate Count: Edit the "Double Output" code to create more variations Update File Naming: Change the naming pattern in the Google Drive upload node Adjust Batch Size: Modify the Loop node settings for your API limits Add Image Parameters: Enhance the HTTP request with additional Freepik parameters (size, style, etc.) Step 7: Test the Workflow Ensure your Google Sheet has test data Click Execute Workflow on the manual trigger Monitor the execution flow Check that images are generated and uploaded to Google Drive Verify file names match your expected pattern Step 8: Production Deployment Set up error handling for API failures Configure appropriate batch sizes based on your Freepik API limits Add logging for successful uploads Consider webhook triggers for automated execution Set up monitoring for failed executions Freepik API Parameters Basic Parameters: prompt: Your text description (required) negative_prompt: What to avoid in the image guidance_scale: How closely to follow the prompt (1-20) numinferencesteps: Quality vs speed trade-off (20-100) seed: For reproducible results Example Enhanced Body: json { "prompt": "{{ $json.Prompt }}", "negative_prompt": "blurry, low quality", "guidance_scale": 7.5, "numinferencesteps": 50, "num_images": 1 } Workflow Flow Summary Start → Manual trigger initiates the workflow Read Sheet → Gets prompts and names from Google Sheets Duplicate → Creates multiple runs for variations Loop → Processes items in batches Generate → Freepik API creates images from prompts Split → Separates multiple images from response Convert → Transforms base64 to binary file format Upload → Saves images to Google Drive with organized names Complete → Returns to loop for next batch Contact Information Robert A Ynteractive For support, customization, or questions about this workflow: 📧 Email: rbreen@ynteractive.com 🌐 Website: https://ynteractive.com/ 💼 LinkedIn: https://www.linkedin.com/in/robert-breen-29429625/ Need help implementing this workflow or want custom automation solutions? Get in touch for professional n8n consulting and workflow development services.

Robert BreenBy Robert Breen
3045

AI-powered cover letter generator with resume matching & Google Docs

This workflow generates a tailored cover letter using a provided resume and job description. Users submit a job description via form (or workflow input), the workflow uses an LLM to write a professional, casual cover letter, then creates and populates a Google Doc and redirects the user to download or review it. --- What You Must Update Before Running Resume Content Update the Configuration node to include your own resume text. This resume is injected directly into the prompt and used as the sole source of experience and qualifications. LLM Credentials The workflow uses OpenRouter with an OpenAI-compatible model. You must: Add your own OpenRouter API credentials Optionally change the model selection if desired Google Docs Credentials This workflow creates and edits Google Docs. You must: Connect your own Google Docs OAuth credentials Update the destination folder ID if you want files saved elsewhere --- What You Can Configure Prompt Tone & Constraints Edit the Write Cover Letter agent system prompt to adjust: Tone (more formal or more casual) Length Writing style constraints Execution Method The workflow supports: Manual execution via form submission Execution as a sub-workflow via workflow inputs

Joel GambleBy Joel Gamble
165

Forecast Zoho CRM deals with AlphaVantage market data, GPT‑4 and Slack alerts

Zoho CRM Deal Forecasting with External Market Factor This workflow automatically fetches active deals from Zoho CRM, retrieves real-time market signals, calculates AI-enhanced forecast metrics, evaluates deal-market alignment, stores data in a database, updates CRM, and sends a summary alert to Slack. This workflow runs weekly to help sales teams make data-driven decisions. It fetches all open deals from Zoho, calculates expected revenue using deal amount, probability, seasonal trends, and market signals. An AI node evaluates each deal’s match ratio against current market conditions. Forecasts and AI insights are stored in a database and written back into Zoho. A Slack message summarizes the key metrics for easy review. You receive: Weekly automated deal forecast. AI-powered deal-market alignment insights. Database storage for historical trends. Slack summary notifications. Ideal for sales teams wanting real-time insights into pipeline health and market alignment without manual calculations. Quick Start – Implementation Steps Import the provided n8n workflow JSON file. Add your Zoho CRM credentials in all relevant nodes. Add your AlphaVantage API key in the Market Signal node. Connect your Slack credentials and select the channel for alerts. Connect your Supabase (or preferred database) account for storing forecasts. Activate the workflow — it will run automatically on the configured weekly schedule. What It Does This workflow automates deal forecasting with AI-enhanced insights: Fetches all active deals from Zoho CRM. Retrieves real-time market data (SPY index) from AlphaVantage. Combines deal and market data for forecast calculations. Calculates expected revenue using: Deal amount Probability Seasonal factors Market signals Sends deal data to an AI node for match ratio, confidence level, and reasoning. Parses AI output and merges it with forecast data. Stores forecast & AI metrics in a database (Supabase). Updates Zoho CRM with adjusted forecast and AI insights. Sends a summary alert to Slack including: Deal name and stage Amount, probability, and expected revenue Market signal and seasonal factor AI match ratio and confidence This ensures teams see clear, actionable sales insights every week. Who’s It For This workflow is ideal for: Sales managers and CRM admins Revenue operations teams Forecasting analysts Teams using Zoho CRM and Slack for pipeline management Anyone wanting AI insights on market alignment for deals Requirements to Use This Workflow To run this workflow, you need: n8n instance (cloud or self-hosted) Zoho CRM account with API access AlphaVantage API key for market data Slack workspace with API permissions Supabase or other database for storing forecasts Basic understanding of deals, probabilities, and seasonal forecasting How It Works Weekly Trigger – Workflow runs automatically once a week. Fetch Deals – Retrieves all active deals from Zoho CRM. Get Market Signal – Fetches real-time market data. Combine Deal & Market Info – Merges deal and market datasets. Generate Forecast Metrics – Calculates expected revenue using deal info, seasonality, and market influence. AI Deal Match Evaluator – AI evaluates alignment of each deal with market conditions. Parse AI Output & Merge Forecast – Parses AI response and combines with forecast data. Store Forecast in Database – Saves forecast and AI insights to Supabase. Update Deal Forecast in Zoho – Updates deals with adjusted forecast and AI insights. Send Forecast Summary to Slack – Sends a clear summary with key metrics. Setup Steps Import the workflow JSON file into n8n. Add Zoho credentials for deal fetch and update nodes. Add AlphaVantage API key for market signal node. Configure Supabase node to store forecast data. Add Slack credentials and choose a channel for notifications. Test the workflow manually to ensure metrics are calculated correctly. Activate the weekly trigger. How To Customize Nodes Forecast Calculation Modify Generate Forecast Metrics node to adjust seasonal factors or calculation logic. AI Match Evaluation You can tweak prompts in Message a Model to adjust AI scoring logic or reasoning output. Database Storage Supabase node can include additional fields: Timestamp Deal owner Notes or comments Additional KPIs Slack Alerts Customize message format, emojis, or mentions for team readability. Add-Ons (Optional Enhancements) Integrate multiple market indices for more accurate forecasting. Add multi-stage probability adjustments. Create dashboards using stored forecast data. Extend AI evaluation for risk scoring or priority recommendations. Use Case Examples Pipeline Health Quickly see which deals are aligned with market conditions. Forecast Accuracy Track historical vs AI-enhanced forecasts for trend analysis. Team Notifications Slack summary alerts keep sales and leadership informed weekly. Troubleshooting Guide | Issue | Possible Cause | Solution | |-------|----------------|---------| | No Slack alerts | Invalid credentials | Re-check Slack API key and channel | | Forecast not updating | Zoho API error | Verify Zoho OAuth credentials | | AI node fails | Model misconfiguration | Check OpenAI API credentials & prompt format | | Data not stored | Supabase connection issue | Verify credentials and table mapping | Need Help? If you need assistance setting up the workflow, modifying the AI forecast logic or integrating Slack summaries our n8n workflow development team at WeblineIndia can help. We provide workflow customization, advanced forecasting and reporting solutions for Zoho CRM pipelines.

WeblineIndiaBy WeblineIndia
29