This PR introduces the top_k parameter to the retrieve_information_collapse_tree method in the TreeRetriever class. It allows users to control the number of top nodes to consider when retrieving information from the collapsed tree.
Usage:
The top_k parameter is an integer that specifies the number of top nodes to consider during retrieval.
It defaults to 10 if not provided, meaning the method will consider the top 10 most relevant nodes.
Users can adjust the value of top_k to retrieve more or fewer nodes based on their requirements.
Functionality:
The retrieve_information_collapse_tree method retrieves the most relevant information from the collapsed tree based on the given query.
It uses the max_tokens parameter to limit the maximum number of tokens in the retrieved context, defaulting to 3500 tokens.
The method calculates the distances between the query embedding and the node embeddings to determine the most relevant nodes.
It then iterates over the top top_k nodes, adding them to the selected nodes list until the token limit is reached.
it returns the selected nodes and the retrieved context.
This PR introduces the
top_k
parameter to theretrieve_information_collapse_tree
method in theTreeRetriever
class. It allows users to control the number of top nodes to consider when retrieving information from the collapsed tree.Usage:
top_k
parameter is an integer that specifies the number of top nodes to consider during retrieval.top_k
to retrieve more or fewer nodes based on their requirements.Functionality:
retrieve_information_collapse_tree
method retrieves the most relevant information from the collapsed tree based on the given query.max_tokens
parameter to limit the maximum number of tokens in the retrieved context, defaulting to 3500 tokens.top_k
nodes, adding them to the selected nodes list until the token limit is reached.