% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/llama.R
\name{llama_encode}
\alias{llama_encode}
\title{Encode tokens using the encoder (encoder-decoder models only)}
\usage{
llama_encode(ctx, tokens)
}
\arguments{
\item{ctx}{A context pointer (llama_context).}

\item{tokens}{Integer vector of token IDs to encode.}
}
\value{
Integer return code (0 = success, negative = error).
}
\description{
Runs the encoder pass for encoder-decoder architectures (e.g. T5, BART).
The encoder output is stored internally and used by subsequent decoder calls.
}
\examples{
\dontrun{
model  <- llama_load_model("t5-model.gguf")
ctx    <- llama_new_context(model)
tokens <- llama_tokenize(ctx, "Hello world")
llama_encode(ctx, tokens)
}
}
