From 59cc86602c7e66f5871d7cbfc1c5af0ef2f50704 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Thu, 13 Mar 2025 00:33:15 +0000 Subject: [PATCH] Add safety valve for path_size set too high --- trustgraph-flow/trustgraph/graph_rag.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trustgraph-flow/trustgraph/graph_rag.py b/trustgraph-flow/trustgraph/graph_rag.py index f4e4a69c..6a4e11c5 100644 --- a/trustgraph-flow/trustgraph/graph_rag.py +++ b/trustgraph-flow/trustgraph/graph_rag.py @@ -93,6 +93,10 @@ class Query: if path_length <= 0: return + # Stop spanning around if the subgraph is already maxed out + if len(subgraph) >= self.max_subgraph_size: + return + res = self.rag.triples_client.request( user=self.user, collection=self.collection, s=ent, p=None, o=None,