#12869·haystack

TiktokenCounter 会在像 `<|endoftext|>` 这样的字面特殊令牌字符串上抛出 ValueError

作者: bogdankostic创建于 2026年9月23日更新于 2026年9月30日
标签good first issueContributions wanted!P2

描述错误

TiktokenCounter.count() 遇到 ValueError 时,对话或工具模板中包含了字面的 tiktoken 特殊标记字符串,例如 <|endoftext|>.

haystack/token_counters/tiktoken_counter.py:77 使用 Encoding.encode() 编码渲染的对话:

内容来源: deepset-ai/haystack