as_embedding: Encode vectors as an embedding column

View source: R/embedding.R

as_embeddingR Documentation

Encode vectors as an embedding column

Description

Packs numeric vectors into the hex float32 blobs vectra stores embedding columns as. Write the result as an ordinary character column; the distance functions cosine(), l2(), and dot() decode it inside the engine.

Usage

as_embedding(x)

Arguments

x

A numeric matrix (one embedding per row), a list of equal-length numeric vectors, or a single numeric vector (one embedding).

Value

A character vector with one hex-encoded blob per embedding.

See Also

cosine(), l2(), dot()

Examples

m <- matrix(rnorm(12), nrow = 3)        # 3 embeddings of length 4
emb <- as_embedding(m)
df <- data.frame(id = 1:3, emb = emb)


vectra documentation built on July 10, 2026, 5:08 p.m.