Skip to main content

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

Workflow preview

Workflow preview
100%
Document Q&A with RAG: Query PDF content using Weaviate and OpenAI preview
Open on n8n.io

Important notice

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

1. Workflow Overview

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 work...

Best for

  • Document Extraction automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.vectorstoreweaviate, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, n8n-nodes-base.extractfromfile, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.chainretrievalqa

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Mary Newhauser.

Original n8n.io source

1.1 Workflow description

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

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.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Weaviate Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreWeaviate - vectorStoreWeaviate
Config choices
Version 1.2

Block 2 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 3 - Embeddings OpenAI

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 4 - Recursive Character Text Splitter1

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 5 - Extract from File

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 6 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 7 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 8 - Weaviate Vector Store1

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreWeaviate - vectorStoreWeaviate
Config choices
Version 1.3

Block 9 - Question and Answer Chain

Type / Role
@n8n/n8n-nodes-langchain.chainRetrievalQa - chainRetrievalQa
Config choices
Version 1.6

Block 10 - Vector Store Retriever

Type / Role
@n8n/n8n-nodes-langchain.retrieverVectorStore - retrieverVectorStore
Config choices
Version 1

Block 11 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 12 - Embeddings OpenAI1

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 13 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Upload PDF

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.2

Block 17 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Document Q&A with RAG: Query PDF content using Weaviate and OpenAI
Complexity advanced
Nodes 17
Categories Document Extraction, Multimodal AI
Author Mary Newhauser
Published 08 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7170/7170.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Document Q&A with RAG: Query PDF content using Weaviate and OpenAI do?

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 work...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, Multimodal AI use case.