Generates embeddings of text chunks as a matrix.

embed_text(x, text, ndim, ...)

Arguments

x

The Agent object, whose underlying model should be specialized for generating embeddings, like nomic.

text

A data.frame, typically generated via chunk, with a “text” column containing text chunks to embed.

ndim

The dimensionality of the embedding (the length of the each embedding vector). If NULL, it uses the model default.

...

Arguments passed to the embedding backend

Value

A matrix containing embedding coordinates, with one row per row of data and ndim columns.

See also

For convenience, just pass the text chunks to text_store, which automatically generates embeddings by default.

Author

Michael Lawrence

Examples

if (FALSE) { # \dontrun{
    chunks <- chunk(tools::Rd_db("S7"))
    embed_text(nomic(), chunks)
} # }