diff --git a/blarify/examples/graph_builder.py b/blarify/examples/graph_builder.py index 4d93c47a..fe6d2c96 100644 --- a/blarify/examples/graph_builder.py +++ b/blarify/examples/graph_builder.py @@ -13,7 +13,6 @@ def build(root_path: str = None): relationships = graph.get_relationships_as_objects() nodes = graph.get_nodes_as_objects() - # save_to_neo4j(relationships, nodes) save_to_falkordb(relationships, nodes) diff --git a/docs/quickstart.md b/docs/quickstart.md index 751fd241..4da8f35b 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -91,7 +91,7 @@ this will return a list of dictionaries with the following structure } ``` -Example using Neo4j +Example using FalkorDB ```python relationships = graph.get_relationships_as_objects() nodes = graph.get_nodes_as_objects() @@ -111,6 +111,7 @@ graph_manager.close() # Taken from blarify/examples/graph_builder.py from blarify.prebuilt.graph_builder import GraphBuilder from blarify.db_managers.neo4j_manager import Neo4jManager +from blarify.db_managers.falkordb_manager import FalkorDBManager import dotenv import os @@ -123,7 +124,7 @@ def build(root_path: str = None): relationships = graph.get_relationships_as_objects() nodes = graph.get_nodes_as_objects() - save_to_neo4j(relationships, nodes) + save_to_falkordb(relationships, nodes) def save_to_neo4j(relationships, nodes): @@ -134,7 +135,19 @@ def save_to_neo4j(relationships, nodes): graph_manager.close() +def save_to_falkordb(relationships, nodes): + graph_manager = FalkorDBManager(repo_id="repo", entity_id="organization") + + print(f"Saving graph with {len(nodes)} nodes and {len(relationships)} relationships") + graph_manager.save_graph(nodes, relationships) + graph_manager.close() + + if __name__ == "__main__": + import logging + + logging.basicConfig(level=logging.INFO) + dotenv.load_dotenv() root_path = os.getenv("ROOT_PATH") build(root_path=root_path)