CohereEncoder Objects

class CohereEncoder(DenseEncoder)

Dense encoder that uses Cohere API to embed documents. Supports text only. Requires a Cohere API key from https://dashboard.cohere.com/api-keys.

__init__

def __init__(name: Optional[str] = None,
             cohere_api_key: Optional[str] = None,
             score_threshold: float = 0.3,
             input_type: Optional[str] = "search_query")

Initialize the Cohere encoder.

Arguments:

  • name (str): The name of the embedding model to use.
  • cohere_api_key (str): The API key for the Cohere client, can also be set via the COHERE_API_KEY environment variable.
  • score_threshold (float): The threshold for the score of the embedding.
  • input_type (str): The type of input to embed.

__call__

def __call__(docs: List[str]) -> List[List[float]]

Embed a list of documents. Supports text only.

Arguments:

  • docs (List[str]): The documents to embed.

Returns:

List[List[float]]: The vector embeddings of the documents.