AzureOpenAIEncoder Objects

class AzureOpenAIEncoder(DenseEncoder)

Encoder for Azure OpenAI API.

This class provides functionality to encode text documents using the Azure OpenAI API. It supports customization of the score threshold for filtering or processing the embeddings.

__init__

def __init__(api_key: Optional[str] = None,
             deployment_name: Optional[str] = None,
             azure_endpoint: Optional[str] = None,
             api_version: Optional[str] = None,
             model: Optional[str] = None,
             score_threshold: float = 0.82,
             dimensions: Union[int, NotGiven] = NotGiven(),
             max_retries: int = 3)

Initialize the AzureOpenAIEncoder.

Arguments:

  • api_key (str): The API key for the Azure OpenAI API.
  • deployment_name (str): The name of the deployment to use.
  • azure_endpoint (str): The endpoint for the Azure OpenAI API.
  • api_version (str): The version of the API to use.
  • model (str): The model to use.
  • str0 (str1): The score threshold for the embeddings.
  • str2 (str3): The dimensions of the embeddings.
  • str4 (str3): The maximum number of retries for the API call.

__call__

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

Encode a list of documents into embeddings using the Azure OpenAI API.

Arguments:

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

Returns:

List[List[float]]: The embeddings for the documents.

acall

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

Encode a list of documents into embeddings using the Azure OpenAI API asynchronously.

Arguments:

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

Returns:

List[List[float]]: The embeddings for the documents.