Recursive retrieval call never ends #10699
Replies: 1 comment
-
🤖 Hey @rahulkrprajapati, great to see you back here! Hope everything's been going well for you since our last interaction. Based on the code you've shared, it seems like the issue might be due to the recursive nature of the To fix this issue, you could add a mechanism to track the nodes that have already been visited and prevent revisiting them. Here's a simple way to do this:
class MyRetriever(AutoMergingRetriever):
def __init__(...):
...
self.visited_nodes = set()
def _try_merging(self, nodes: List[NodeWithScore]) -> Tuple[List[NodeWithScore], bool]:
...
for node in nodes:
if node.id in self.visited_nodes:
continue
else:
self.visited_nodes.add(node.id)
... This way, the recursive calls will stop when they encounter a node that has already been visited, preventing infinite recursion. Please note that this is a simple solution and might not cover all edge cases. You might need to adjust it based on your specific use case and data. As for the After filling in nodes, the The I hope this helps! If you have any other questions, feel free to ask. Sources
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I had defined a retriever call like given below. I have defined two separate vector store indices one for nodes and the other for leaf nodes.
When I try to use it like :
My Retrival line
my_retrived_nodes = my_retriever._retrieve(query_str)
prints :but this line never finishes executing it goes into some recursive call.
Beta Was this translation helpful? Give feedback.
All reactions