Open Aaronchangji opened 4 months ago
@Aaronchangji Hello! I'm here to help you with any bugs, questions, or contributions. Let's work together to resolve your issue.
To resolve the TypeError: KnowledgeGraphIndex._build_index_from_nodes() got an unexpected keyword argument 'space_name'
error, ensure that the space_name
argument is not passed to the _build_index_from_nodes
method. Instead, it should be used when instantiating the NebulaGraphStore
.
Here is the correct way to instantiate the NebulaGraphStore
and create the StorageContext
:
from llama_index.legacy.storage.storage_context import StorageContext
from llama_index.legacy.graph_stores.nebula import NebulaGraphStore
space_name = "llamaindex"
edge_types, rel_prop_names = ["relationship"], ["relationship"]
tags = ["entity"]
graph_store = NebulaGraphStore(
space_name=space_name,
edge_types=edge_types,
rel_prop_names=rel_prop_names,
tags=tags,
)
storage_context = StorageContext.from_defaults(graph_store=graph_store)
Ensure that you do not pass space_name
to the KnowledgeGraphIndex.from_documents
method. The KnowledgeGraphIndex
class does not accept space_name
as a parameter, and it should be configured within the NebulaGraphStore
and StorageContext
as shown above [1][2][3].
To continue talking to Dosu, mention @dosu.
Yep, same issue happening to us as well.
I think this issue goes back to the Llama_index Document at: https://docs.llamaindex.ai/en/stable/examples/query_engine/knowledge_graph_query_engine/#optional-build-the-knowledge-graph-with-llamaindex
It says (in Step 2):
`from llama_index.core import KnowledgeGraphIndex
kg_index = KnowledgeGraphIndex.from_documents( documents, storage_context=storage_context, max_triplets_per_chunk=10, space_name=space_name, edge_types=edge_types, rel_prop_names=rel_prop_names, tags=tags, include_embeddings=True, )`
The class KnowledgeGraphIndex is in "PYTHON_PATH/Lib/site-packages/llama_index/core/indices/knowledge_graph/base.py" When I checked this python file. I found that:
@deprecated.deprecated( version="0.10.53", reason=( "The KnowledgeGraphIndex class has been deprecated. " "Please use the new PropertyGraphIndex class instead. " "If a certain graph store integration is missing in the new class, " "please open an issue on the GitHub repository or contribute it!" ), )
Can refer to the following article to connect to graph db: https://docs.llamaindex.ai/en/latest/module_guides/indexing/lpg_index_guide/
Bug Description
Try to create KG index via
It reports:
_build_index_from_nodes()
inKnowledgeGraphIndex
does not take any keyword arguments except fornodes
.I think it's a similar bug with https://github.com/run-llama/llama_index/issues/14398
Version
0.10.52
Steps to Reproduce
Follow the instructions of https://docs.llamaindex.ai/en/stable/examples/query_engine/knowledge_graph_query_engine/#optionalbuild-the-knowledge-graph-with-llamaindex to build KG.
Relevant Logs/Tracbacks