Skip to main content
This file contains the VoyageEncoder class which is used to encode text using Voyage

VoyageEncoder Objects

Class to encode text using Voyage and VoyageAI SDK. Requires a Voyage API key from https://voyageai.com/api-keys/

__init__

Initialize the VoyageEncoder. Arguments:
  • name (str): The name of the embedding model to use such as “voyage-3-lite”.
  • api_key (str): The Voyage API key, can also be set via the VOYAGE_API_KEY environment variable.
  • score_threshold (float): The score threshold for the embeddings.
Raises:
  • ValueError: If no API key is provided or found in the environment.

__call__

Encode a list of text documents into embeddings using Voyage. Arguments:
  • docs (list[Any]): List of text documents to encode.
Returns: list[list[float]]: List of embeddings for each document.

acall

Encode a list of text documents into embeddings using Voyage asynchronously. Arguments:
  • docs (list[Any]): List of text documents to encode.
Returns: list[list[float]]: List of embeddings for each document.