% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mtmd.R
\name{llama_image_eval}
\alias{llama_image_eval}
\title{Evaluate an image + prompt into a llama context}
\usage{
llama_image_eval(mctx, ctx, prompt, bitmap, n_past = 0L)
}
\arguments{
\item{mctx}{An mtmd context from \code{\link{llama_mtmd_load}}.}

\item{ctx}{A llama context from \code{\link{llama_new_context}} (created on
the same text model the projector was loaded against).}

\item{prompt}{Prompt string containing exactly one media marker where the
image should be injected.}

\item{bitmap}{A bitmap from \code{\link{llama_image_load}}.}

\item{n_past}{Starting position in the KV cache (default \code{0L} for a
fresh context).}
}
\value{
Integer: the new \code{n_past} after evaluation, to continue
  generation from.
}
\description{
Tokenizes \code{prompt} (which must contain the media marker, see
\code{\link{llama_mtmd_marker}}) together with \code{bitmap}, encodes the
image, and decodes both the text and image chunks into the llama context's
KV cache. After this returns, continue generation with the usual
\code{\link{llama_gen_next}} loop, passing the returned position as the
starting \code{n_past}.
}
\examples{
\dontrun{
model  <- llama_load_model("model.gguf")
mctx   <- llama_mtmd_load(model, "mmproj-model.gguf")
ctx    <- llama_new_context(model, n_ctx = 4096)
img    <- llama_image_load(mctx, "photo.jpg")
prompt <- paste0("Describe this image: ", llama_mtmd_marker())
n_past <- llama_image_eval(mctx, ctx, prompt, img)
# ... continue with llama_gen_next() from n_past
}
}
\seealso{
\code{\link{llama_mtmd_marker}}, \code{\link{llama_image_load}}
}
