Find answers from the community

Updated 8 months ago

**LLaMA Index Knowledge Graph Query**

LLaMA Index Knowledge Graph Query

Hey fellow developers,
I'm building knowledge graphs using LLaMA Index and storing them in both the graph store and storage context. However, I'm having trouble querying the graph database directly. The only option I've found is load_index_from_storage, which stores some graph context locally. How can I query the graph database and return Knowledge Graph nodes?
Here's my code so far:

def build_knowledge_graph(): # ... (setup code) 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=github_document_loader(), 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) kg_index.storage_context.persist(persist_dir=PERSIST_PATH) return storage_context def load_graph(): # ... (setup code) graph_store = NebulaGraphStore(space_name=space_name, edge_types=edge_types, rel_prop_names=rel_prop_names, tags=tags) storage_context = StorageContext.from_defaults(persist_dir=persist_path, graph_store=graph_store) kg_index = load_index_from_storage(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, verbose=True) return kg_index

Any help would be greatly appreciated!
S
1 comment
@Logan M if you have the bandwidth could you help with this issue?
Add a reply
Sign up and join the conversation on Discord