| llama_token_to_piece | R Documentation |
Convert a single token ID to its text piece
llama_token_to_piece(ctx, token, special = FALSE)
ctx |
A context pointer (llama_context). |
token |
Integer token ID. |
special |
Logical. If TRUE, render special tokens (e.g. |
A character string — the text piece for the token.
## Not run:
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")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.