New Tool Radar

AI Agents & Automation

How to Build a Langflow RAG Agent Over PDFs With a Vector Store

Build a Langflow RAG agent over PDF files using the Vector Store RAG template and a vector store.

Schematic with three steps: Start from the Vector Store RAG template; Load the PDFs into the vector store; Ask the Retriever flow questions from the.

The Langflow Vector Store RAG template gives you two flows: a Load Data flow that ingests a file, splits it into chunks and stores embeddings in a vector database, and a Retriever flow that answers chat questions from those chunks. Start from the template instead of wiring the components by hand, load your PDFs first, and only then ask the agent questions about them.

What you need

  • Langflow with an OpenAI API key or another embedding provider
  • One or two PDF files to load
  • A vector store component, such as the template default or Chroma DB

Step 1: Start from the Vector Store RAG template

In Langflow, click New Flow and select the Vector Store RAG template. It creates the Load Data flow and the Retriever flow together.

Step 2: Load the PDFs into the vector store

In the Load Data flow, add your API key to the embedding components, point the Read File component at a PDF, and run the vector store component so the file is chunked, embedded and indexed. Repeat for each PDF.

Step 3: Ask the Retriever flow questions from the PDFs

In the Retriever flow, ask questions whose answers are only in the PDFs and check each answer against the source passage. If an answer is invented, the load step missed content, so re-check which files were ingested.

Worked example: synthetic PDF questions

The table below is a synthetic example. It shows the expected result of RAG over PDFs; no file was loaded.

Question Answered from PDF? Result
What is the refund window? Yes Pass
Who approves expenses? Yes Pass
Question outside the PDFs No – agent says so Pass

Expected result (UNTESTED). two questions are answered from the PDFs, and the third is refused as not covered instead of answered from general knowledge. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • The Retriever flow can only answer from files the Load Data flow actually ingested, so confirm each file loaded.
  • The template default vector store can be swapped for another, but both flows must use the same store.
  • Chunking splits long documents, so an answer that spans a chunk boundary may come back incomplete.

Sources

See all