Skip to content

Commit

Permalink
Fix get relations
Browse files Browse the repository at this point in the history
  • Loading branch information
YoanSallami committed Jun 3, 2024
1 parent e1ba729 commit 44f307d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
container_name: hybrid-agi-db
ports:
- 6379:6379
- 3000:3000
# - 3000:3000
hybrid-agi-db-browser:
image: redislabs/redisinsight:1.14.0
container_name: hybrid-agi-db-browser
Expand Down
2 changes: 1 addition & 1 deletion hybridagi/hybridstores/fact_memory/fact_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_rel_map(
return rel_map

query = f"""
MATCH (n1:{self._node_label})
MATCH (n1:{self.indexed_label})
WHERE n1.name IN $subjs
WITH n1
MATCH p=(n1)-[e*1..{depth}]->(z)
Expand Down
20 changes: 19 additions & 1 deletion tests/hybridstores/fact_memory/test_fact_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,22 @@ def test_delete_triplet():

memory.add_triplet("myself", "is a", "robot")
memory.delete_triplet("myself", "is a", "robot")
assert len(memory.get_triplets("myself")) == 0
assert len(memory.get_triplets("myself")) == 0

def test_get_rel_map():
emb = FakeEmbeddings(dim=250)
memory = FactMemory(
index_name="test",
embeddings=emb,
wipe_on_start=True,
)

memory.add_triplet("myself", "is a", "robot")
memory.add_triplet("robot", "has", "sensors")
memory.add_triplet("robot", "can", "move")

rel_map = memory.get_rel_map(subjs=["myself", "robot"], depth=2, limit=30)

assert len(rel_map) == 2
assert len(rel_map["myself"]) == 3
assert len(rel_map["robot"]) == 2

0 comments on commit 44f307d

Please sign in to comment.