Skip to content

Commit 921a9dc

Browse files
authored
feat: only single-db mode in nebula now; modify index gql for better efficiency (#363)
* feat: only single-db mode in nebula now; modify index gql for better effciency * feat: delete multi-db nebula example
1 parent 72d0423 commit 921a9dc

File tree

2 files changed

+65
-159
lines changed

2 files changed

+65
-159
lines changed

examples/basic_modules/nebular_example.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -52,56 +52,6 @@ def embed_memory_item(memory: str) -> list[float]:
5252
return embedding_list
5353

5454

55-
def example_multi_db(db_name: str = "paper"):
56-
# Step 1: Build factory config
57-
config = GraphDBConfigFactory(
58-
backend="nebular",
59-
config={
60-
"uri": json.loads(os.getenv("NEBULAR_HOSTS", "localhost")),
61-
"user": os.getenv("NEBULAR_USER", "root"),
62-
"password": os.getenv("NEBULAR_PASSWORD", "xxxxxx"),
63-
"space": db_name,
64-
"use_multi_db": True,
65-
"auto_create": True,
66-
"embedding_dimension": embedder_dimension,
67-
},
68-
)
69-
70-
# Step 2: Instantiate the graph store
71-
graph = GraphStoreFactory.from_config(config)
72-
graph.clear()
73-
74-
# Step 3: Create topic node
75-
topic = TextualMemoryItem(
76-
memory="This research addresses long-term multi-UAV navigation for energy-efficient communication coverage.",
77-
metadata=TreeNodeTextualMemoryMetadata(
78-
memory_type="LongTermMemory",
79-
key="Multi-UAV Long-Term Coverage",
80-
hierarchy_level="topic",
81-
type="fact",
82-
memory_time="2024-01-01",
83-
source="file",
84-
sources=["paper://multi-uav-coverage/intro"],
85-
status="activated",
86-
confidence=95.0,
87-
tags=["UAV", "coverage", "multi-agent"],
88-
entities=["UAV", "coverage", "navigation"],
89-
visibility="public",
90-
updated_at=datetime.now().isoformat(),
91-
embedding=embed_memory_item(
92-
"This research addresses long-term "
93-
"multi-UAV navigation for "
94-
"energy-efficient communication "
95-
"coverage."
96-
),
97-
),
98-
)
99-
100-
graph.add_node(
101-
id=topic.id, memory=topic.memory, metadata=topic.metadata.model_dump(exclude_none=True)
102-
)
103-
104-
10555
def example_shared_db(db_name: str = "shared-traval-group"):
10656
"""
10757
Example: Single(Shared)-DB multi-tenant (logical isolation)
@@ -404,9 +354,6 @@ def example_complex_shared_db(db_name: str = "shared-traval-group-complex"):
404354

405355

406356
if __name__ == "__main__":
407-
print("\n=== Example: Multi-DB ===")
408-
example_multi_db(db_name="paper-new")
409-
410357
print("\n=== Example: Single-DB ===")
411358
example_shared_db(db_name="shared_traval_group-new")
412359

0 commit comments

Comments
 (0)