View Source Tokenizers.DecodeStream (Tokenizers v0.5.2)

Implements streaming decoding functionality for tokenizers.

Summary

Functions

Returns information about the decode stream state.

Creates a new decode stream.

Steps through the decode stream with the given tokenizer and token ID.

Types

@type t() :: %Tokenizers.DecodeStream{resource: reference()}

Functions

Returns information about the decode stream state.

@spec new(keyword()) :: t()

Creates a new decode stream.

Options

  • :skip_special_tokens - determines whether special tokens should be skipped during decoding. By default, it is set to false.
Link to this function

step(decode_stream, tokenizer, id)

View Source

Steps through the decode stream with the given tokenizer and token ID.

Returns {:ok, String.t()} if there's a decoded string, or {:ok, :out_ofr_range} if the token ID is out of range. Returns {:error, reason} if an error occurs during decoding.