% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/llama.R
\name{llama_gen_next}
\alias{llama_gen_next}
\title{Pull the next chunk of a streaming generation}
\usage{
llama_gen_next(state)
}
\arguments{
\item{state}{Generation state handle from [llama_gen_begin].}
}
\value{
A length-1 UTF-8 character vector with the next chunk, or
  \code{NULL} when generation has finished (end-of-generation token reached
  or \code{max_new_tokens} exhausted). After \code{NULL}, call
  [llama_gen_end] to flush any remaining bytes.
}
\description{
Advances a generation started with [llama_gen_begin] by one token and
returns the next chunk of decoded text. A possibly-incomplete trailing
UTF-8 character is held back until enough bytes arrive, so every returned
chunk is valid UTF-8 (the chunk may be \code{""} when the only new byte is
part of an unfinished character).
}
\seealso{
[llama_gen_begin], [llama_gen_end]
}
