Reach out

Command Palette

Search for a command to run...

[Deployment]

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Introduction

Mistral AI's open and commercial models can be deployed on the Microsoft Azure AI cloud platform in two ways:

  • Pay-as-you-go managed services: Using Model-as-a-Service (MaaS) serverless API deployments billed on endpoint usage. No GPU capacity quota is required for deployment.

  • Real-time endpoints: With quota-based billing tied to the underlying GPU infrastructure you choose to deploy.

This page focuses on the MaaS offering, where the following models are available:

  • Mistral Large (24.11, 24.07)
  • Mistral Small (24.09)
  • Ministral 3B (24.10)
  • Mistral Nemo

For more details, visit the models page.

Getting started

The following sections outline the steps to deploy and query a Mistral model on the Azure AI MaaS platform.

Deploying the model

Follow the instructions on the Azure documentation to create a new deployment for the model of your choice. Once deployed, take note of its corresponding URL and secret key.

Querying the model

Deployed endpoints expose a REST API that you can query using Mistral's SDKs or plain HTTP calls.

To run the examples below, set the following environment variables: - AZUREAI_ENDPOINT: Your endpoint URL, should be of the form https://your-endpoint.inference.ai.azure.com/v1/chat/completions. - AZUREAI_API_KEY: Your secret key. bash curl --location $AZUREAI_ENDPOINT/v1/chat/completions \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $AZURE_API_KEY" \ --data '{ "model": "azureai", "messages": [ { "role": "user", "content": "Who is the best French painter? Answer in one short sentence." } ] }' This code requires a virtual environment with the following packages: - mistralai-azure>=1.0.0

1    ```python
2    from mistralai_azure import MistralAzure
3    import os
4
5    endpoint = os.environ.get("AZUREAI_ENDPOINT", "")
6    api_key = os.environ.get("AZUREAI_API_KEY", "")
7
8    client = MistralAzure(azure_endpoint=endpoint,
9                     azure_api_key=api_key)
10
11    resp = client.chat.complete(messages=[
12        {
13            "role": "user",
14            "content": "Who is the best French painter? Answer in one short sentence."
15        },
16    ], model="azureai")
17
18    if resp:
19        print(resp)
20    ```
21</TabItem>
22<TabItem value="ts" label="TypeScript">
23    This code requires the following package:
24    - `@mistralai/mistralai-azure` (version >= `1.0.0`)
25
26    ```typescript
27    import { MistralAzure } from "@mistralai/mistralai-azure";
28
29    const client = new MistralAzure({
30        endpoint: process.env.AZUREAI_ENDPOINT || "",
31        apiKey: process.env.AZUREAI_API_KEY || ""
32    });
33
34    async function chat_completion(user_msg: string) {
35        const resp = await client.chat.complete({
36            model: "azureai",
37            messages: [
38                {
39                    content: user_msg,
40                    role: "user",
41                },
42            ],
43        });
44        if (resp.choices && resp.choices.length > 0) {
45            console.log(resp.choices[0]);
46        }
47    }
48
49    chat_completion("Who is the best French painter? Answer in one short sentence.");
50    ```
51</TabItem>

Going further

For more details and examples, refer to the following resources: