Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Handle GrandCypher API change, closes #909

davidmezzetti484b366608a4
diff --git a/src/python/txtai/graph/networkx.py b/src/python/txtai/graph/networkx.py
index 9076030d..d0a81f47 100644
--- a/src/python/txtai/graph/networkx.py
+++ b/src/python/txtai/graph/networkx.py
@@ -132,8 +132,11 @@ class NetworkX(Graph):
if isinstance(value, list):
# Path group
nodes.update([node for node in value if node and not isinstance(node, dict)])
+ elif isinstance(value, dict):
+ # Nodes by id attribute
+ nodes.update(uid for uid, attr in self.scan(data=True) if attr["id"] == value["id"])
elif value is not None:
- # Single result
+ # Single node id
nodes.add(value)
return self.filter(list(nodes))
diff --git a/test/python/testgraph.py b/test/python/testgraph.py
index 1f40f5c2..62d311b9 100644
--- a/test/python/testgraph.py
+++ b/test/python/testgraph.py
@@ -446,7 +446,7 @@ class TestGraph(unittest.TestCase):
g = self.embeddings.search(
"""
MATCH (A)-[]->(B)
- RETURN A, B
+ RETURN A, ID(B)
""",
graph=True,
)