You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: count literal special tokens in TiktokenCounter - #13010
Use encode_ordinary() in TiktokenCounter so literal strings resembling tiktoken special tokens in messages and tool descriptions are counted as ordinary text. Add unit coverage, a real-encoder integration regression test, and a release note.
How did you test it?
hatch run test:unit test/token_counters/test_tiktoken_counter.py -q — 11 passed.
hatch run test:integration test/token_counters/test_tiktoken_counter.py -q — 4 passed.
hatch run fmt — passed.
Notes for the reviewer
This PR was prepared with an AI assistant. Focused tests and formatting checks were run; please review the changes before merging.
Hi @yusei21, thanks for your interest in contributing to Haystack! 🙏
⚠️ Issue #12869 is already being addressed by open pull request(s) #12871, #12876, #12879, #12888, #13009. Before opening a PR for an issue, please check whether a PR is already linked to it, and consider contributing to the existing PR instead. We may close duplicate PRs to keep the review queue manageable.
This is an automated message to help us keep the review queue healthy.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You have signed the CLA already but the status is still pending? Let us recheck it.
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
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
<|endoftext|>#12869Proposed Changes
Use
encode_ordinary()inTiktokenCounterso literal strings resembling tiktoken special tokens in messages and tool descriptions are counted as ordinary text. Add unit coverage, a real-encoder integration regression test, and a release note.How did you test it?
hatch run test:unit test/token_counters/test_tiktoken_counter.py -q— 11 passed.hatch run test:integration test/token_counters/test_tiktoken_counter.py -q— 4 passed.hatch run fmt— passed.Notes for the reviewer
This PR was prepared with an AI assistant. Focused tests and formatting checks were run; please review the changes before merging.