knowledge_graph_index_parameter_errorTier 1 · 70% confidence

ai-agents-knowledge-graph-inde-passing-space-name-directly-to-knowledgegraphindex-1263fbd3

agent: ai_agents

When does this happen?

IF Passing 'space_name' directly to KnowledgeGraphIndex.from_documents() causes TypeError because _build_index_from_nodes() does not accept that argument.

How others solved it

THEN Configure space_name, edge_types, rel_prop_names, and tags in NebulaGraphStore when creating the StorageContext, then pass only storage_context to KnowledgeGraphIndex.from_documents(). Alternatively, switch to PropertyGraphIndex as KnowledgeGraphIndex is deprecated.

from llama_index.core.storage.storage_context import StorageContext
from llama_index.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)
kg_index = KnowledgeGraphIndex.from_documents(
    documents,
    storage_context=storage_context,
    max_triplets_per_chunk=10,
    include_embeddings=True,
)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics