You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Batch Endpoints can deploy models to run inference over large amounts of data, including OpenAI models. In this example, you learn how to create a batch endpoint to deploy ADA-002 model from OpenAI to compute embeddings at scale but you can use the same approach for completions and chat completions models. It uses Microsoft Entra authentication to grant access to the Azure OpenAI resource.
20
+
Batch Endpoints can deploy models to run inference over large amounts of data, including Azure OpenAI models. In this example, you learn how to create a batch endpoint to deploy `text-embedding-ada-002` model from Azure OpenAI to compute embeddings at scale but you can use the same approach for completions and chat completions models. It uses Microsoft Entra authentication to grant access to the Azure OpenAI resource.
21
21
22
22
## About this example
23
23
24
-
In this example, we're going to compute embeddings over a dataset using ADA-002 model from OpenAI. We will register the particular model in MLflow format using the OpenAI flavor which has support to orchestrate all the calls to the OpenAI service at scale.
24
+
In this example, we're going to compute embeddings over a dataset using `text-embedding-ada-002` model via the Azure OpenAI Service. We will register the particular model in MLflow format using the Azure OpenAI flavor which has support to orchestrate all the calls to the Azure OpenAI Service at scale.
The example shows how to run OpenAI models hosted in Azure OpenAI Service. To begin, you need an OpenAI resource correctly deployed in Azure and a deployment for the model you want to use. To deploy an OpenAI model in Azure OpenAI Service, see [Focus on Azure OpenAI Service](../ai-studio/azure-openai-in-ai-studio.md#focus-on-azure-openai-service).
45
+
The example shows how to run OpenAI models hosted in Azure OpenAI Service. To begin, you need an Azure OpenAI resource correctly deployed in Azure and a deployment for the model you want to use. To deploy an Azure OpenAI model in Azure OpenAI Service, see [Focus on Azure OpenAI Service](../ai-studio/azure-openai-in-ai-studio.md#focus-on-azure-openai-service).
46
46
47
-
:::image type="content" source="./media/how-to-use-batch-model-openai-embeddings/aoai-deployments.png" alt-text="A screenshot of the Azure OpenAI studio within Azure AI Foundry, showing the model deployments available in a particular Azure OpenAI Service resource." lightbox="media/how-to-use-batch-model-openai-embeddings/aoai-deployments.png":::
47
+
:::image type="content" source="./media/how-to-use-batch-model-openai-embeddings/aoai-deployments.png" alt-text="A screenshot of the Azure OpenAI Service page within Azure AI Foundry, showing the model deployments available in a particular Azure OpenAI Service resource." lightbox="media/how-to-use-batch-model-openai-embeddings/aoai-deployments.png":::
48
48
49
-
The previous image shows the Azure OpenAI Service resource to which the model is deployed. Note the name of this resource, as you later use it to construct the URL of the resource. Save the URL for later use in the tutorial.
49
+
The previous image shows the Azure OpenAI Service resource to which the model is deployed. Note the name of this resource, as you use it later to construct the URL of the resource.
50
50
51
51
# [Azure CLI](#tab/cli)
52
52
@@ -125,14 +125,14 @@ You can get an access key and configure the batch deployment to use the access k
125
125
---
126
126
127
127
128
-
### Register the OpenAI model
128
+
### Register the Azure OpenAI model
129
129
130
-
Model deployments in batch endpoints can only deploy registered models. You can use MLflow models with the flavor OpenAI to create a model in your workspace referencing a deployment in Azure OpenAI.
130
+
Model deployments in batch endpoints can only deploy registered models. You can use MLflow models with the Azure OpenAI flavor to create a model in your workspace referencing a deployment in Azure OpenAI.
131
131
132
-
1. Create an MLflow model in the workspace's models registry pointing to your OpenAI deployment with the model you want to use. Use MLflow SDK to create the model:
132
+
1. Create an MLflow model in the workspace's models registry pointing to your Azure OpenAI deployment with the model you want to use. Use the MLflow SDK to create the model:
133
133
134
134
> [!TIP]
135
-
> In the cloned repository in the folder **model** you already have an MLflow model to generate embeddings based on ADA-002 model in case you want to skip this step.
135
+
> In the cloned repository in the **model** folder, you already have an MLflow model to generate embeddings based on `text-embedding-ada-002` model in case you want to skip this step.
136
136
137
137
```python
138
138
import mlflow
@@ -159,7 +159,7 @@ Model deployments in batch endpoints can only deploy registered models. You can
1. One the scoring script is created, it's time to create a batch deployment for it. We use environment variables to configure the OpenAI deployment. Particularly we use the following keys:
236
+
1. One the scoring script is created, it's time to create a batch deployment for it. We use environment variables to configure the Azure OpenAI deployment. Particularly we use the following keys:
237
237
238
238
* `OPENAI_API_BASE` is the URL of the Azure OpenAI resource to use.
239
239
* `OPENAI_API_VERSION` is the version of the API you plan to use.
240
240
* `OPENAI_API_TYPE` is the type of API and authentication you want to use.
241
241
242
242
# [Microsoft Entra authentication](#tab/ad)
243
243
244
-
The environment variable `OPENAI_API_TYPE="azure_ad"` instructs OpenAI to use Active Directory authentication and hence no key is required to invoke the OpenAI deployment. The identity of the cluster is used instead.
244
+
The environment variable `OPENAI_API_TYPE="azure_ad"` instructs the Azure OpenAI Service to use Microsoft Entra authentication and hence no key is required to invoke the Azure OpenAI deployment. The identity of the cluster is used instead.
245
245
246
246
# [Access keys](#tab/keys)
247
247
248
248
To use access keys instead of Microsoft Entra authentication, we need the following environment variables:
249
249
250
250
* Use `OPENAI_API_TYPE="azure"`
251
-
* Use `OPENAI_API_KEY="<YOUR_AZURE_OPENAI_KEY>"`
251
+
* Use `AZURE_OPENAI_API_KEY="<YOUR_AZURE_OPENAI_KEY>"`
252
252
253
253
1. Once we decided on the authentication and the environment variables, we can use them in the deployment. The following example shows how to use Microsoft Entra authentication particularly:
254
254
@@ -259,14 +259,14 @@ Model deployments in batch endpoints can only deploy registered models. You can
> Notice the `environment_variables` section where we indicate the configuration for the OpenAI deployment. The value for `OPENAI_API_BASE` will be set later in the creation command so you don't have to edit the YAML configuration file.
262
+
> Notice the `environment_variables` section where we indicate the configuration for the Azure OpenAI deployment. The value for `OPENAI_API_BASE` will be set later in the creation command so you don't have to edit the YAML configuration file.
0 commit comments