This function creates embedding vectors from text or multimodal inputs (text and images) using the Voyage AI API. It supports three types of input:
voyage_embedding(
.input,
.model = "voyage-3",
.timeout = 120,
.dry_run = FALSE,
.max_tries = 3,
.verbose = FALSE
)Input to embed. Can be:
A character vector of texts
An LLMMessage object (all textual components will be embedded)
A list containing a mix of character strings and tidyllm_image objects created with img()
The embedding model identifier. For text-only: "voyage-3" (default). For multimodal inputs: "voyage-multimodal-3" is used automatically.
Timeout for the API request in seconds (default: 120).
If TRUE, perform a dry run and return the request object without sending.
Maximum retry attempts for requests (default: 3).
Should information about current rate limits be printed? (default: FALSE).
A tibble with two columns: input and embeddings.
The input column contains the input texts or image labels
The embeddings column is a list column where each row contains an embedding vector
Character vector: Embeds each text string separately
LLMMessage object: Extracts and embeds text content from messages
List of mixed content: Processes a combination of text strings and image objects created with img()
For multimodal inputs, the function automatically switches to Voyage's multimodal API
and formats the response with appropriate labels (e.g., "[IMG] image.png") for images.