voyage_embedding | R Documentation |
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 |
Input to embed. Can be:
|
.model |
The embedding model identifier. For text-only: "voyage-3" (default). For multimodal inputs: "voyage-multimodal-3" is used automatically. |
.timeout |
Timeout for the API request in seconds (default: 120). |
.dry_run |
If TRUE, perform a dry run and return the request object without sending. |
.max_tries |
Maximum retry attempts for requests (default: 3). |
.verbose |
Should information about current rate limits be printed? (default: FALSE). |
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.
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
## Not run:
# Text embeddings
voyage_embedding("How does photosynthesis work?")
# Multimodal embeddings
list("A banana", img("banana.jpg"), "Yellow fruit") |>
voyage_embedding()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.