Building a Knowledge Graph RAG Flow
KG RAG (Knowledge Graph Retrieval-Augmented Generation) allows users to build an AI-ready document repository, query multiple documents with an LLM, and visualize semantic links between text segments. It uses webAI's Navigator to convert PDFs into vector data and create a knowledge graph, with optional interactive tools for exploring relationships.
The process involves two main steps: first setting up a document ingestion pipeline to process and vectorize content, then building an inference pipeline for chatting with documents using an LLM. This is perfect for creating secure, private AI systems that answer questions based on internal documents without relying on the cloud.
This step-by-step guide helps developers and technical professionals build Retrieval-Augmented Generation (RAG) systems that power AI chatbots capable of answering document-specific questions, such as those found in enterprise knowledge bases, legal documents, or technical manuals. The chat modal will also provide citations to the specific pages where the LLM found this information!
See our What is KG RAG? article for more information on system requirements, element details, key features, and known limitations.
Use Cases
- Enterprise Knowledge Base → Company documentation and policy Q&A
- Customer Support → Automated responses from support materials
- Legal Document Analysis → Contract and compliance document search
- Technical Documentation → API docs, manuals, and troubleshooting guides
- Research Assistant → Academic paper and research document querying
- Medical Information → Healthcare documentation and procedure guides
- Educational Content → Textbook and curriculum material assistance
- Compliance Systems → Regulatory and standards documentation
- Code Documentation → Software documentation and codebase understanding
- Training Materials → Employee handbook and training resource systems
Step 1: Document Ingestion → Knowledge Graph Builder
-
Before we begin we need to download the PDFs that we are going to use as our Source Document input. The below file structure is optional, however, this will help in this step by step guide for accessing these inputs and outputs easily.
- Create a main folder - in the below example - kg_rag_demo is the main folder
- Create 2 folders inside of the main folder. input and output
-
Place all of the PDFs we are going to use inside of the input folder

We only have one PDF file in this input folder but you can add more if needed for your specific ingestion flow.
- Open Navigator and on the Projects tab create a new KG RAG Document Ingestion template. Create → Templates → KG RAG Document Ingestion
-
You will now see the Document Ingestion element Output connected to the Input of Knowledge Graph Builder element. Your canvas should look like the below image:
- Click on the Document Ingestion element → View Settings or click the three dots on this element ... → Settings to open the Element Settings panel.
-
In the Document Ingestion element settings you can enable or disable Text-Only Ingestion
Enabling this feature will ignore all content outside of plain text during the extraction process. So if you plan to run inference on charts, diagrams, tables, etc. it is advised to keep this disabled.
-
In the Document Ingestion element settings click Select Directory under Source Documents (PDFs)
-
From the folder structure we created in the first step above, select the folder titled input → Open

-
Back on the Document Ingestion Settings panel click Select Directory under Output Directory
-
From the folder structure we created in the first step above, select the folder titled output → Open

The Document Ingestion element settings should now look like the below image:
- We are now going to configure the inputs and outputs of our Knowledge Graph Builder element. Click on the Knowledge Graph Builder element → View Settings or click the three dots on this element ... → Settings to open the Element Settings panel.
-
In the Knowledge Graph Builder element settings click into Setup → New Collection and provide a Name for this Vector Database collection. Select from the Configuration options then click Create Collection

-
(Optional) You can enable the Visualize Interactively toggle which will create a visualization of this knowledge graph in a browser. Keep this disabled for faster processing.

-
The Knowledge Graph Builder element settings should now look like the below image:
-
Once both the Document Ingestion and Knowledge Graph Builder elements are configured → click Run and you will see this Flow start to process! The Log Viewer will automatically open during this process for you to monitor along with progress bars on each Element.
This process will take some time to finish depending on the amount of documentation within your PDF files. This can take about 10-15 mins for 200 pages on a MacBook Pro with an M4 chip and 16 GB RAM and about 5-10 mins for 200 pages on a Mac Studio with an M4 chip and 256 GB RAM.
-
If Visualize Interactively setting in the Knowledge Graph Builder element was enabled you can Click Open on the Knowledge Graph Builder element to see the graph once this process has completed.
-
Once this ingestion process completes you should see a toast message in the top right of your Canvas with an option to Create Inference. Click this button and choose whether you would like these canvases nested in one project folder or keep these canvases separate.
This is the next step in interacting with your documents using an LLM! See the next steps below to for more information on the inference process.
If you don't click the Create Inference button your ingestion flow will continue to run. As long as this ingestion flow shows 100% completion it is okay to stop this ingestion flow by clicking the dropdown next to Active -> Stop
You should see all the individual pages from the PDFs that were in the input folder now in the output folder.
Step 2: Knowledge Graph Inference
If you already completed a KG RAG Document Ingestion flow and used the preconfigured settings to create an inference canvas, you can skip to step 6 below to select an LLM.
- Open Navigator and on the Projects tab create a new KG RAG Inference Pipeline template. Create → Templates → KG RAG Inference Pipeline
- We will see three Elements for this inference process.
- API Element
- LLM Element
- Knowledge Graph Retrieval
- If you selected the template, these should be preconfigured, however if you needed to manually apply these connectors here are the inputs and outputs for each element.
- The API Output should connect to the Knowledge Graph Retrieval Input
- The Knowledge Graph Retrieval Output should connect to the LLM Input
-
The LLM Output should connect to the API Input
The Canvas should now look like the image below
- Click on the Knowledge Graph Retrieval element → View Settings or click the three dots on this element ... → Settings to open the Element Settings panel.
-
Select the Collection Name that you created for the vector database during the Document Ingestion process in Step 1 above from the Collection Name dropdown.
If this inference canvas was preconfigured from the completion of the ingestion process, this Collection Name should already be auto-selected.
- Click on the LLM element or click the three dots on this element ... → Settings to open the Element Settings panel.
-
From the Large Language Model dropdown you can select the model you would like to use.
The recommended model for KG RAG inference pipeline is Llama 4 Scout 17B 16E Instruct 8bit. If you’re on a MacBook with limited RAM, you can use a smaller model like Gemma 3 4B IT BF16, though accuracy may be impacted using a smaller model.
-
You can now click Run to get this retrieval process started!
If you want more information on what these specific elements do and their settings, see our Element Registry.
Once this completes you should see a chat preview window appear for you to begin asking questions about your specific documents.
Knowledge Graph Retrieval takes less than 1 second per query on a MacBook Pro and Mac Studio. The first query will take about 3-5 seconds for cache warmup.
You have now created a KG RAG (Knowledge Graph Retrieval-Augmented Generation) inference pipeline within Navigator!
Next Steps
- For more information on the elements used in this guide, see our Element Registry
- For more information on deploying flows, see our Clusters Overview guide and our Deployments Overview guide
- For more information on other flows and templates, see our Quick Start guides