Creating an external deployment with Azure OpenAI
Create an Azure OpenAI Deployment using the External Deployment type. In this article, you will find out how to integrate the Azure OpenAI gpt-4o Deployment in Deeploy. All code in this example is also available in this example
Prerequisites
Create a deployment using Azure OpenAI
Use the gpt-4o
model that is developed by OpenAI and available on Azure. In order to create an external Deployment in Deeploy you need the following:
- The model endpoint from a deployed model
- The API key to communicate with the model
The model inference endpoint and API key
To get a gpt-4o inference endpoint, follow these steps:
- In Azure AI Foundry create a OpenAI project
- From the Azure OpenAI model catalog select the gpt-4o model and click deploy
- Navigate to deployments and select the model that you just deployed
- You can find the target URI and Key in the Endpoint section
Connecting Azure OpenAI gpt-4o in Deeploy
Connect the Azure OpenAI to Deeploy via the UI or locally with the Python client
- UI
- Python client
Complete the following steps in the Deeploy UI
- Login to the Deeploy UI
- Navigate to the workspace where you want to add gpt-4o as an external deployment
- Click Create > External
- Follow the steps, in step 3 you are expected to add:
- The retrieved inference endpoint (e.g.,
https://deeploy-openai.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview
) - Select
Custom header
as authentication method and useapi-key
as Custom header - Paste the Azure OpenAI Key in the password field
- The retrieved inference endpoint (e.g.,
- Once the connection check is successful, the deployment can be created.
Make sure you have authenticated with Deeploy as described here. After that the following code snippet provides an example on how to add gpt-4o as an external model in Deeploy
from deeploy import CreateExternalDeployment
create_options: CreateExternalDeployment = {
"name": "Azure OpenAI gpt-4o",
"description": "Created with Python client",
"url": "https://deeploy-openai.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview"
"custom_header": "api-key"
"password": "ExampleKey"
}
deployment = client.create_external_deployment(create_options)