embed | R Documentation |
The embed()
function allows you to embed a text via a specified provider.
It routes the input to the appropriate provider-specific embedding function.
embed(
.input,
.provider = getOption("tidyllm_embed_default"),
.model = NULL,
.truncate = NULL,
.timeout = NULL,
.dry_run = NULL,
.max_tries = NULL
)
.input |
A character vector of texts v, a list of texts and image objects, or an |
.provider |
A function or function call specifying the language model provider and any additional parameters.
This should be a call to a provider function like |
.model |
The embedding model to use |
.truncate |
Whether to truncate inputs to fit the model's context length |
.timeout |
Timeout for the API request in seconds |
.dry_run |
If TRUE, perform a dry run and return the request object. |
.max_tries |
Maximum retry attempts for requests |
A tibble with two columns: input
and embeddings
.
The input
column contains the texts sent to embed, and the embeddings
column
is a list column where each row contains an embedding vector of the sent input.
## Not run:
c("What is the meaning of life, the universe and everything?",
"How much wood would a woodchuck chuck?",
"How does the brain work?") |>
embed(gemini)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.