Conversation
shivsin25
requested review from
davidsbatista
and removed request for
a team
September 24, 2026 10:51
Contributor
|
@shivsin25 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Add "token" to split_by and a keyword-only tokenizer_encoding parameter, both passed to the inner DocumentSplitter instances, so block sizes can be counted in LLM tokens. Add warm_up() to load the tiktoken encoding or the sentence tokenizer when the pipeline starts instead of on the first run(). Closes deepset-ai#12917 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
The Integration / ubuntu-latest failure looks unrelated to this change: the only failing test is |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Contributor
Author
|
@davidsbatista is it ready to be merged or some chnages have to be made |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related Issues
Proposed Changes:
split_bynow accepts"token", and a new keyword-onlytokenizer_encodingparameter (default"o200k_base") picks the tiktoken encoding. Both are passed to the innerDocumentSplitterinstances, so the token splitting from feat: DocumentSplitter — add split_by="token" mode using tiktoken #12529 is reused as is.warm_up()that warms every inner splitter, so the encoding or the sentence tokenizer is loaded when the pipeline starts rather than on the firstrun(). It's idempotent becauseDocumentSplitter.warm_up()is, and tiktoken caches encodings by name, so all block sizes share one encoding object.tokenizer_encodingis serialized. Dicts saved before this change still load with the default.How did you test it?
warm_up()loads the encoding once per block size and is a no-op the second time. Updated the three existing tests that compare the exact serialized dict.o200k_baseandcl100k_base: every block stays within its block size in tokens, parent/child links are correct, and the children of each block add up exactly to the block's text.mainand pass with this change.hatch run test:unit test/components/preprocessors test/components/retrievers(includesAutoMergingRetriever): all pass.hatch run test:integration test/components/preprocessors: all pass.hatch run test:unit: 6494 passed. One unrelated failure on my Windows machine:test_byte_stream.pyexpectstext/csv, but Windows maps.csvto Excel's MIME type.hatch run test:typesandhatch run fmt-checkare clean. The pre-commit hooks pass.Notes for the reviewer
warm_up()also applies tosplit_by="sentence", which currently loads NLTK lazily on the firstrun(). Nothing changes for word, passage or page splits, whereDocumentSplitter.warm_up()does nothing.I used an AI assistant while working on this and reviewed and tested all changes myself.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.