Skip to content

Graph

Package containing Graph Indexer modules.

Modules:

Name Description
LlamaIndexGraphRAGIndexer

A class for indexing elements using LlamaIndex.

Authors

Devita (devita1@gdplabs.id)

LlamaIndexGraphRAGIndexer(graph_store, llama_index_llm=None, kg_extractors=None, embed_model=None, vector_store=None, **kwargs)

Bases: BaseGraphRAGIndexer

Indexer for graph RAG using LlamaIndex.

Attributes:

Name Type Description
_index PropertyGraphIndex

Property graph index.

_graph_store LlamaIndexGraphRAGDataStore

Storage for property graph.

Initialize the LlamaIndexKGIndexer.

Parameters:

Name Type Description Default
graph_store LlamaIndexGraphRAGDataStore

Storage for property graph.

required
llama_index_llm BaseLLM | None

Language model for LlamaIndex. Defaults to None.

None
kg_extractors list[TransformComponent] | None

List of knowledge graph extractors. Defaults to None.

None
embed_model BaseEmbedding | None

Embedding model. Defaults to None.

None
vector_store BasePydanticVectorStore | None

Storage for vector data. Defaults to None.

None
**kwargs Any

Additional keyword arguments.

{}

delete(**kwargs)

Delete elements from the knowledge graph.

This method deletes elements from the knowledge graph based on the provided document_id.

Parameters:

Name Type Description Default
**kwargs Any

Additional keyword arguments.

{}

Raises:

Type Description
ValueError

If document_id is not provided.

Exception

If an error occurs during deletion.

index(elements, **kwargs)

Index elements into the graph.

This method indexes elements into the graph.

Notes: - Currently only Neo4jPropertyGraphStore that is supported for indexing the metadata from the TextNode. - The 'document_id' parameter is used to specify the document ID for the elements. - The 'chunk_id' parameter is used to specify the chunk ID for the elements.

Parameters:

Name Type Description Default
elements list[Element]

List of elements to index.

required
**kwargs Any

Additional keyword arguments.

{}

resolve_entities()

Resolve entities in the graph.

Currently, this method does nothing.