% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/llama.R
\name{llama_token_to_piece}
\alias{llama_token_to_piece}
\title{Convert a single token ID to its text piece}
\usage{
llama_token_to_piece(ctx, token, special = FALSE)
}
\arguments{
\item{ctx}{A context pointer (llama_context).}

\item{token}{Integer token ID.}

\item{special}{Logical. If TRUE, render special tokens (e.g. \code{<bos>}).}
}
\value{
A character string — the text piece for the token.
}
\description{
Convert a single token ID to its text piece
}
\examples{
\dontrun{
model <- llama_load_model("model.gguf")
ctx   <- llama_new_context(model)

# Inspect individual tokens from tokenizer output
tokens <- llama_tokenize(ctx, "Hello world")
pieces <- vapply(tokens, function(t) llama_token_to_piece(ctx, t), "")
cat(paste(pieces, collapse = "|"), "\n")
}
}
