Add top_k Support for Tree Collapsing Functionality #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.