nemoguardrails.embeddings.providers.azureopenai

View as Markdown

Module Contents

Classes

NameDescription
AzureEmbeddingModelEmbedding model using Azure OpenAI.

Functions

NameDescription
get_executor-

API

class nemoguardrails.embeddings.providers.azureopenai.AzureEmbeddingModel(
embedding_model: str
)

Bases: EmbeddingModel

Embedding model using Azure OpenAI.

This class represents an embedding model that utilizes the Azure OpenAI API for generating text embeddings.

Parameters:

embedding_model
str

The name of the Azure OpenAI deployment model (e.g., “text-embedding-ada-002”).

MODEL_DIMENSIONS
= {'text-embedding-ada-002': 1536}
client
embedding_size
= self._get_embedding_dimension()
engine_name
= 'AzureOpenAI'
nemoguardrails.embeddings.providers.azureopenai.AzureEmbeddingModel._get_embedding_dimension()

Retrieve the embedding dimension for the specified model.

nemoguardrails.embeddings.providers.azureopenai.AzureEmbeddingModel.encode(
documents: typing.List[str]
) -> typing.List[typing.List[float]]

Encode a list of documents into their corresponding embeddings.

Parameters:

documents
List[str]

The list of documents to be encoded.

Returns: List[List[float]]

List[List[float]]: The list of embeddings, where each embedding is a list of floats.

Raises:

  • RuntimeError: If the API call fails.
nemoguardrails.embeddings.providers.azureopenai.AzureEmbeddingModel.encode_async(
documents: typing.List[str]
) -> typing.List[typing.List[float]]
async

Asynchronously encode a list of documents into their corresponding embeddings.

Parameters:

documents
List[str]

The list of documents to be encoded.

Returns: List[List[float]]

List[List[float]]: The list of embeddings, where each embedding is a list of floats.

nemoguardrails.embeddings.providers.azureopenai.get_executor()