| llama_get_embeddings_seq | R Documentation |
Returns the pooled embedding vector for a given sequence ID after a batch decode. Only works when the model supports pooling (embedding models).
llama_get_embeddings_seq(ctx, seq_id)
ctx |
Context handle returned by [llama_new_context] with
|
seq_id |
Integer sequence ID (0-based) |
A numeric vector of length n_embd.
## Not run:
# Get pooled embedding for sequence 0 (requires embedding context)
model <- llama_load_model("nomic-embed.gguf")
ctx <- llama_new_context(model, embedding = TRUE)
mat <- llama_embed_batch(ctx, "Hello world")
emb <- llama_get_embeddings_seq(ctx, 0L)
cat("Pooled embedding dim:", length(emb), "\n")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.