Files
chengyongru 4a7ad00e4f fix(tokens): warm fallback tokenizer in background (#5861)
* fix(tokens): keep fallback token estimation offline

* fix(tokens): warm fallback tokenizer in background

* test(tokens): isolate agent fixtures from tokenizer readiness

* test(tokens): keep Codex pressure fixtures within byte budget

* docs: remove manual wrapping from troubleshooting prose
2026-09-28 13:50:55 +08:00

14 lines
380 B
Python

import pytest
import tiktoken
@pytest.fixture
def byte_encoding() -> tiktoken.Encoding:
"""Exercise the tokenizer API without downloading an upstream vocabulary."""
return tiktoken.Encoding(
name="test-bytes",
pat_str=r"(?s).",
mergeable_ranks={bytes([value]): value for value in range(256)},
special_tokens={"<|endoftext|>": 256},
)