Tinkex.Types.SampleStreamChunk (Tinkex v0.3.4)
View SourceRepresents a single chunk from a streaming sample response.
Chunks are emitted incrementally during SSE-based streaming sampling, allowing real-time token-by-token processing of model output.
Summary
Functions
Create a done chunk indicating stream completion.
Check if this is the final chunk in a stream.
Create an error chunk.
Create a SampleStreamChunk from a parsed SSE event map.
Types
@type t() :: %Tinkex.Types.SampleStreamChunk{ event_type: :token | :done | :error, finish_reason: String.t() | nil, index: non_neg_integer() | nil, logprob: float() | nil, token: String.t() | nil, token_id: integer() | nil, total_tokens: non_neg_integer() | nil }
Functions
@spec done(String.t() | nil, non_neg_integer() | nil) :: t()
Create a done chunk indicating stream completion.
Check if this is the final chunk in a stream.
Create an error chunk.
Create a SampleStreamChunk from a parsed SSE event map.