[PR #528] [MERGED] Handle special token in TikToken #3385

Closed
opened 2026-02-22 18:33:40 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/528
Author: @timothycarambat
Created: 1/4/2024
Status: Merged
Merged: 1/4/2024
Merged by: @timothycarambat

Base: masterHead: 525-tiktoken-sanitized-output


📝 Commits (2)

  • ac29747 Handle special token in TikToken
  • 9264d52 remove duplicate method

📊 Changes

2 files changed (+6 additions, -10 deletions)

View changed files

📝 server/utils/helpers/chat/index.js (+1 -1)
📝 server/utils/helpers/tiktoken.js (+5 -9)

📄 Description

resolves #525

Pass in an empty array of disallowedSpecials to handle all tokens as text and to be tokenized - which is the intention.
https://github.com/openai/tiktoken/blob/9e79899bc248d5313c7dd73562b5e211d728723d/tiktoken/core.py#L91C20-L91C38


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/528 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 1/4/2024 **Status:** ✅ Merged **Merged:** 1/4/2024 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `525-tiktoken-sanitized-output` --- ### 📝 Commits (2) - [`ac29747`](https://github.com/Mintplex-Labs/anything-llm/commit/ac29747ac3a2cbd9cd45abb872f213dc32591008) Handle special token in TikToken - [`9264d52`](https://github.com/Mintplex-Labs/anything-llm/commit/9264d527795b381292d83d78edac78fb9c4323da) remove duplicate method ### 📊 Changes **2 files changed** (+6 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/helpers/chat/index.js` (+1 -1) 📝 `server/utils/helpers/tiktoken.js` (+5 -9) </details> ### 📄 Description resolves #525 Pass in an empty array of `disallowedSpecials` to handle all tokens as text and to be tokenized - which is the intention. https://github.com/openai/tiktoken/blob/9e79899bc248d5313c7dd73562b5e211d728723d/tiktoken/core.py#L91C20-L91C38 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:33:40 -05:00
yindo closed this issue 2026-02-22 18:33:40 -05:00
yindo changed title from [PR #528] Handle special token in TikToken to [PR #528] [MERGED] Handle special token in TikToken 2026-06-05 15:13:07 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3385