Function er_embed
generates embeddings for text inputs.
er_embed(text, api = "huggingface", model = NULL, type = NULL, verbose = FALSE)
a character
vector of texts.
a character
string specifying the embedding API. One of c("huggingface","openai","cohere")
. Default is "huggingface"
.
a character
string specifying the embedding model. Must match the model names in the corresponding APIs. See, huggingface.co/models, platform.openai.com/docs/models/embeddings, cohere.com/embeddings. Defaults to "sentence-transformers/all-mpnet-base-v2"
for api = "huggingface"
, to "text-embedding-ada-002"
for api = "openai"
, and to "embed-english-v3.0"
for api = "cohere"
.
a character
string specifying the type of Cohere embeddings. One of c("search_document","search_query","classification","clustering")
. Default is "clustering"
. See https://docs.cohere.com/reference/embed.
a logical
specifying whether to show messages.
The function returns a matrix
containing the text embeddings with length(text)
rows and as many columns as there are embedding dimensions.
Wulff, D. U., Aeschbach, S., Hussain, Z., & Mata, R. (2024). embeddeR. In preparation.