% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/llama.R
\name{llama_gen_begin_at}
\alias{llama_gen_begin_at}
\title{Begin streaming generation from an already-prefilled context}
\usage{
llama_gen_begin_at(
  ctx,
  n_past,
  max_new_tokens = 256L,
  temp = 0.8,
  top_k = 50L,
  top_p = 0.9,
  seed = 42L,
  min_p = 0,
  typical_p = 1,
  repeat_penalty = 1,
  repeat_last_n = 64L,
  frequency_penalty = 0,
  presence_penalty = 0,
  mirostat = 0L,
  mirostat_tau = 5,
  mirostat_eta = 0.1,
  grammar = NULL,
  trigger_patterns = NULL,
  trigger_tokens = NULL
)
}
\arguments{
\item{ctx}{A llama context whose KV cache has already been populated (e.g. by
[llama_image_eval]).}

\item{n_past}{Starting KV position, as returned by [llama_image_eval]. Kept
for clarity/symmetry; the context already tracks its own position.}

\item{max_new_tokens}{Maximum number of tokens to generate}

\item{temp}{Sampling temperature. 0 = greedy decoding.}

\item{top_k}{Top-K filtering (0 = disabled)}

\item{top_p}{Top-P (nucleus) filtering (1.0 = disabled)}

\item{seed}{Random seed for sampling}

\item{min_p}{Min-P filtering threshold (0.0 = disabled)}

\item{typical_p}{Locally typical sampling threshold (1.0 = disabled)}

\item{repeat_penalty}{Repetition penalty (1.0 = disabled)}

\item{repeat_last_n}{Number of last tokens to penalize (0 = disabled, -1 = context size)}

\item{frequency_penalty}{Frequency penalty (0.0 = disabled)}

\item{presence_penalty}{Presence penalty (0.0 = disabled)}

\item{mirostat}{Mirostat sampling mode (0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)}

\item{mirostat_tau}{Mirostat target entropy (tau parameter)}

\item{mirostat_eta}{Mirostat learning rate (eta parameter)}

\item{grammar}{GBNF grammar string for constrained generation (NULL = disabled)}

\item{trigger_patterns}{Character vector of regular expressions that lazily
activate a grammar (e.g. the prefix a model emits before a tool call). Only
meaningful alongside a lazy \code{grammar}; \code{NULL} (default) applies the
grammar from the first token. Supplied by \code{\link{llama_chat_build}}.}

\item{trigger_tokens}{Integer vector of token IDs that lazily activate the
grammar, the token-level counterpart to \code{trigger_patterns}. \code{NULL}
(default) means none.}
}
\value{
An external pointer holding the generation state (see
  [llama_gen_begin]).
}
\description{
Like [llama_gen_begin], but does \strong{not} tokenize a prompt or clear the
KV cache. Use it to continue generation after [llama_image_eval] (or any
other code that has already decoded tokens into the context), so the
multimodal prefill is preserved. Sampling continues from the context's last
logits; pull tokens with [llama_gen_next] and flush with [llama_gen_end] as
usual.
}
\seealso{
[llama_image_eval], [llama_gen_next], [llama_gen_end]
}
