-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added util functions to get nodes of different depth from a hierarchical nodes list #10535
Added util functions to get nodes of different depth from a hierarchical nodes list #10535
Conversation
@qiisziilbash if you can fix up the CI errors, we can get this merged Seems you may need to update the
|
Good catch; done! |
@logan-markewich feel free to merge this; soes not seem like I have permission to do so |
@qiisziilbash apologies, with v0.10.0 the project structure has changed slightly. Was focused on getting that landed. I can take a stab at porting this PR in a bit, if you don't get to it first :) |
55eab8e
to
928d456
Compare
@logan-markewich this should be good to go in |
(ugh, merging main locally brought in extra changes, all good though, they will get merged anyways lol) |
Description
Added util functions to get nodes of different depth from a hierarchical nodes list.
When one creates a hierarchical chunking especially with a DB backed vector store, one cannot create an index with nodes of a given chunk easily. This utils enables users to get nodes with different depth which correspond to different chunk sizes and add the chunk size as metadata to the nodes and filter nodes later based on this metadata.
This can be achieved in a different way as well; which is by adding chunk_size of the
node_parser
to the nodes as metadata when creating the nodes; however, it seems more reasonable to provide utils that enables users to achieve this themselves than making nodes bulkier for every user that might not need this metadata.Type of Change
How Has This Been Tested?
Suggested Checklist:
make format; make lint
to appease the lint gods