Skip to main content

Run DIAL with an Azure OpenAI model

In this tutorial, you will run DIAL locally and connect it to a model deployed in Azure OpenAI. By the end, you will chat with your Azure model through DIAL Chat at http://localhost:3000. This setup uses the DIAL OpenAI adapter to reach Azure. You need an Azure OpenAI deployment with its endpoint and API key — every other component runs locally.

Prerequisites​

  • Docker Engine with Docker Compose v2.20.0 or higher. See the Docker documentation.

  • Free TCP ports 3000 (DIAL Chat) and 8080 (DIAL Core) on your machine.

  • An Azure OpenAI deployment, with:

    • the deployment endpoint, for example https://my-resource.openai.azure.com
    • the deployment name, for example gpt-4
    • an API key for the deployment

    See the Azure OpenAI documentation to create a resource and deploy a model.

What you'll build​

A local DIAL stack connected to Azure OpenAI through the OpenAI adapter. DIAL Core routes requests to the adapter, which forwards them to your Azure deployment. The setup registers two chat deployments — gpt-35-turbo and gpt-4 — that you select in DIAL Chat.

Note

This sample runs the standalone DIAL OpenAI Adapter, which will be deprecated. For your own deployments, use DIAL Model Provider, which serves the same adapter under /compat/openai. To move a configuration, see Migrate from the standalone adapters.

Project structure​

The dial-docker-compose/model directory looks like this:

model/
├── docker-compose.yml
└── core/
└── config.json

The docker-compose.yml adds the OpenAI adapter to the shared common.yml base:

include:
- path: ../common.yml
env_file: ./.env

services:
adapter-openai:
image: epam/ai-dial-adapter-openai:0.22.0
platform: linux/amd64
environment:
WEB_CONCURRENCY: "3"

Step 1: Get the Docker Compose files​

Clone the DIAL repository and change into the model directory:

git clone https://github.com/epam/ai-dial.git
cd ai-dial/dial-docker-compose/model

Verify: the directory contains docker-compose.yml and a core/ directory.

Step 2: Add your Azure credentials to config.json​

Open core/config.json. Each model has an upstreams entry pointing at the adapter's Azure target. Replace the placeholders with your values:

  • Set key to your Azure deployment API key.
  • Replace http://azure_deployment_host with your Azure endpoint.
  • If your Azure deployment name differs from the model name, replace it in the endpoint path.
"upstreams": [
{
"endpoint": "https://<YOUR_AZURE_RESOURCE>.openai.azure.com/openai/deployments/<YOUR_DEPLOYMENT_NAME>/chat/completions",
"key": "<YOUR_AZURE_API_KEY>"
}
]

Repeat for each model you want to expose. Remove any model you do not have a deployment for, so DIAL Core does not advertise a deployment it cannot reach.

Verify: core/config.json contains your real endpoint and key, with no azure_deployment_host or AZURE_MODEL_API_KEY placeholders left.

warning

config.json now contains a live API key. Do not commit it to version control. For anything beyond local evaluation, supply secrets through environment variables instead — see the .env reference.

Step 3: Launch DIAL​

From the model directory, start the stack:

docker compose up

Verify: the logs show the core, chat, and adapter-openai services started, with no errors.

Step 4: Chat with the model​

  1. Open http://localhost:3000 in your browser.
  2. Open the Catalog and select GPT-4 (or GPT-3.5).
  3. Send a prompt.

Verify: the model responds with output generated by your Azure deployment.

How it fits together​

DIAL Core does not call Azure directly. Each model's endpoint points at the OpenAI adapter, and the adapter's upstreams entry carries the Azure endpoint and key:

"gpt-4": {
"type": "chat",
"displayName": "GPT-4",
"endpoint": "http://adapter-openai:5000/openai/deployments/gpt-4/chat/completions",
"upstreams": [
{
"endpoint": "https://<YOUR_AZURE_RESOURCE>.openai.azure.com/openai/deployments/gpt-4/chat/completions",
"key": "<YOUR_AZURE_API_KEY>"
}
]
}

The adapter translates between the DIAL Unified API and the Azure OpenAI API, so DIAL Chat and any application call the model the same way they call every other deployment.

What you learned​

  • How to connect a local DIAL stack to an Azure OpenAI model
  • How the OpenAI adapter sits between DIAL Core and Azure
  • How upstreams carries the provider endpoint and key for a model

Further reading​