run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
33.62k stars 4.72k forks source link

[Question]: Intended difference between `KnowledgeGraph` & `ComposableGraph`? #13179

Closed brycecf closed 2 months ago

brycecf commented 2 months ago

Question Validation

Question

Noticing that ComposableGraph is not used in a KnowledgeGraphIndex, what is the intended usage for ComposableGraph?

dosubot[bot] commented 2 months ago

The KnowledgeGraph and ComposableGraph serve distinct roles within the framework. The KnowledgeGraph, or KnowledgeGraphIndex, focuses on constructing and querying Knowledge Graphs from unstructured text, integrating with Large Language Models for entity-based querying and more. It's designed for direct interaction with Knowledge Graphs, automating their construction and providing a flexible query engine.

In contrast, the ComposableGraph is aimed at managing and organizing multiple indices in a composable way. It's key for constructing and managing a graph of indices, allowing for complex data structures and relationships to be efficiently managed and queried. This includes handling the root index ID, accessing all indices, and facilitating the creation of complex index structures.

The reason ComposableGraph is not used in a KnowledgeGraphIndex could be related to the specific architectural decisions or requirements of the LlamaIndex framework, focusing on the distinct functionalities and use cases each class is designed to address.

If you need further details or have more questions, feel free to ask.

#### Details **Sources** - [llama-index-core/llama_index/core/indices/knowledge_graph/base.py](https://github.com/run-llama/llama_index/blob/main/llama-index-core/llama_index/core/indices/knowledge_graph/base.py) - [llama-index-legacy/llama_index/legacy/indices/knowledge_graph/base.py](https://github.com/run-llama/llama_index/blob/main/llama-index-legacy/llama_index/legacy/indices/knowledge_graph/base.py) - [docs/docs/examples/query_engine/knowledge_graph_rag_query_engine.ipynb](https://github.com/run-llama/llama_index/blob/main/docs/docs/examples/query_engine/knowledge_graph_rag_query_engine.ipynb) - [docs/docs/examples/index_structs/knowledge_graph/KnowledgeGraphDemo.ipynb](https://github.com/run-llama/llama_index/blob/main/docs/docs/examples/index_structs/knowledge_graph/KnowledgeGraphDemo.ipynb) - [llama-index-core/llama_index/core/indices/composability/graph.py](https://github.com/run-llama/llama_index/blob/main/llama-index-core/llama_index/core/indices/composability/graph.py) - [llama-index-legacy/llama_index/legacy/composability/base.py](https://github.com/run-llama/llama_index/blob/main/llama-index-legacy/llama_index/legacy/composability/base.py)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

logan-markewich commented 2 months ago

@brycecf A composable graph is just a collection of indexes that are arranged/queried in a sort of tree/graph structure. Its an older idea that is mostly deprecated at this point.

A knowledge graph is a collection of knowledge facts (i.e. triplets of subject, relation, object), along with the text chunks those triplets were extracted from.

So, the two are not related at all.