MCPcopy
hub / github.com/openai/tiktoken / decode_bytes

Method decode_bytes

tiktoken/core.py:265–273  ·  view source on GitHub ↗

Decodes a list of tokens into bytes. ``` >>> enc.decode_bytes([31373, 995]) b'hello world' ```

(self, tokens: Sequence[int])

Source from the content-addressed store, hash-verified

263 # ====================
264
265 def decode_bytes(self, tokens: Sequence[int]) -> bytes:
266 """Decodes a list of tokens into bytes.
267
268 ```
269 >>> enc.decode_bytes([31373, 995])
270 b'hello world'
271 ```
272 """
273 return self._core_bpe.decode_bytes(tokens)
274
275 def decode(self, tokens: Sequence[int], errors: str = "replace") -> str:
276 """Decodes a list of tokens into a string.

Callers 3

test_encode_bytesFunction · 0.45
test_hyp_encode_bytesFunction · 0.45
decodeMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_encode_bytesFunction · 0.36
test_hyp_encode_bytesFunction · 0.36