decodeSingleTokenBytes method

ByteArray decodeSingleTokenBytes(
  1. int token
)

Implementation

ByteArray decodeSingleTokenBytes(int token) {
  if (decoder.containsKey(token)) {
    return decoder[token]!;
  } else if (specialTokensDecoder.containsKey(token)) {
    return specialTokensDecoder[token]!;
  } else {
    throw TiktokenError("Couldn't decode single token bytes for token '$token'");
  }
}