-
Book Overview & Buying
-
Table Of Contents
Building Natural Language and LLM Pipelines
By :
In the previous sections, we learned the basics of custom component definition, including the run() method and the use of the warm_up() method for managing heavy resources. We will now apply what we’ve learned to an advanced case: building a series of custom components to create a knowledge graph from documents and then using that graph to generate question-answer pairs for evaluating a RAG system.
Before diving into the code, it is crucial to understand why we are using a knowledge graph as an intermediate step. While it might seem simpler to generate questions directly from text chunks, this approach has significant limitations. Standard RAG systems that rely on vector search over isolated text chunks often struggle with complex, multi-hop questions (Su et al., 2020); Neo4j, 2025), which are queries that require connecting information scattered across multiple documents or contexts.
Knowledge graphs excel where simple...