Building Indexes on top of other Indexes with ComposableGraph
The ComposableGraph
in LlamaIndex represents a sophisticated way to structure information by stacking Indexes on top of each other.
Figure 5.12 provides an overview of a ComposableGraph
:
Figure 5.12 – The structure of a ComposableGraph
This approach allows for the construction of Indexes within individual documents – lower-level Indexes – and the aggregation of these Indexes into higher-order ones over a collection of documents. For example, you can build a TreeIndex
for the text within each document and a SummaryIndex
that encompasses each TreeIndex
in a collection.
How to use the ComposableGraph
Here’s a simple code example demonstrating the usage of ComposableGraph
:
from llama_index.core import ( Â Â Â Â ComposableGraph, SimpleDirectoryReader, Â Â Â Â TreeIndex, SummaryIndex) documents = SimpleDirectoryReader("files...