High-level function to generate embeddings for a single text string. This function handles the entire process from request creation to response processing.
Arguments
- text
Character string to get embeddings for
- endpoint_url
The URL of the Hugging Face Inference API endpoint
- key_name
Name of the environment variable containing the API key
- ...
ellipsis sent to
hf_perform_request, which forwards tohttr2::req_perform- parameters
Advanced usage: parameters to pass to the API endpoint. On TEI endpoints these are added to the top level of the request body.
- tidy
Whether to attempt to tidy the response or not
- max_retries
Maximum number of retry attempts for failed requests
- timeout
Request timeout in seconds
- validate
Whether to validate the endpoint before creating the request
- engine
The endpoint's inference engine:
"auto"(default) detects it with a call to the endpoint's/inforoute,"tei"for Text Embeddings Inference,"toolkit"for the default Hugging Face Inference Toolkit. Set the default for a session withoptions(EndpointR.hf_engine = "tei").