llama_gen_end: Finish a streaming generation

View source: R/llama.R

llama_gen_endR Documentation

Finish a streaming generation

Description

Marks the generation done and returns any bytes still held in the internal UTF-8 carry buffer (the tail of an unfinished character, if generation stopped mid-character). Concatenating every [llama_gen_next] chunk followed by the llama_gen_end result reproduces the full [llama_generate] output for the same seed and parameters. Safe to call more than once.

Usage

llama_gen_end(state)

Arguments

state

Generation state handle from [llama_gen_begin].

Value

A length-1 UTF-8 character vector with any remaining buffered text (often "").

See Also

[llama_gen_begin], [llama_gen_next]


llamaR documentation built on May 28, 2026, 1:06 a.m.