Pipeline 3: Knowledge graph index-based RAG
It’s time to create a knowledge graph index-based RAG pipeline and interact with it. As illustrated in the following figure, we have a lot of work to do:
Figure 7.5: Building knowledge graph-index RAG from scratch
In this section, we will:
- Generate the knowledge graph index
 - Display the graph
 - Define the user prompt
 - Define the hyperparameters of LlamaIndex’s in-built LLM model
 - Install the similarity score packages
 - Define the similarity score functions
 - Run a sample similarity comparison between the similarity functions
 - Re-rank the output vectors of an LLM response
 - Run evaluation samples and apply metrics and human feedback scores
 - Run metric calculations and display them
 
Let’s go through these steps and begin by generating the knowledge graph index.
Generating the knowledge graph index
We will create a knowledge graph index from...