llama_memory_seq_rm: Remove tokens from a sequence in the KV cache

View source: R/llama.R

llama_memory_seq_rmR Documentation

Remove tokens from a sequence in the KV cache

Description

Removes cached tokens for the given sequence in the position range [p0, p1). Use p0 = -1 and p1 = -1 to remove all tokens for the sequence.

Usage

llama_memory_seq_rm(ctx, seq_id, p0 = -1L, p1 = -1L)

Arguments

ctx

Context handle returned by [llama_new_context]

seq_id

Sequence ID (integer)

p0

Start position (inclusive, -1 for beginning)

p1

End position (exclusive, -1 for end)

Value

A logical scalar: TRUE if tokens were successfully removed.

Examples

## Not run: 
# Remove all tokens from sequence 0
llama_memory_seq_rm(ctx, seq_id = 0L, p0 = -1L, p1 = -1L)

## End(Not run)

llamaR documentation built on May 28, 2026, 1:06 a.m.