| 1 | --- |
| 2 | title: Azure AI Foundry |
| 3 | slug: ../azure |
| 4 | --- |
| 5 | |
| 6 | Azure AI Foundry is a cloud-based service that provides access to models from OpenAI, Mistral AI, and others, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure AI Foundry resource in the [Azure portal](https://portal.azure.com). |
| 7 | |
| 8 | ## Chat model |
| 9 | |
| 10 | We recommend configuring **GPT-4o** as your chat model. |
| 11 | |
| 12 | <Tabs> |
| 13 | <Tab title="YAML"> |
| 14 | ```yaml title="config.yaml" |
| 15 | models: |
| 16 | - name: GPT-4o |
| 17 | provider: azure |
| 18 | model: gpt-4o |
| 19 | apiBase: <YOUR_DEPLOYMENT_BASE> |
| 20 | apiKey: <YOUR_AZURE_API_KEY> # If you use subscription key, try using Azure gateway to rename it apiKey |
| 21 | env: |
| 22 | deployment: <YOUR_DEPLOYMENT_NAME> |
| 23 | apiType: azure-foundry # Or "azure-openai" if using OpenAI models |
| 24 | apiVersion: 2023-07-01-preview # Azure API version |
| 25 | ``` |
| 26 | </Tab> |
| 27 | <Tab title="JSON"> |
| 28 | ```json title="config.json" |
| 29 | { |
| 30 | "models": [{ |
| 31 | "title": "GPT-4o", |
| 32 | "provider": "azure", |
| 33 | "model": "gpt-4o", |
| 34 | "apiBase": "<YOUR_DEPLOYMENT_BASE>", |
| 35 | "deployment": "<YOUR_DEPLOYMENT_NAME>", |
| 36 | "apiKey": "<YOUR_AZURE_API_KEY>", // If you use subscription key, try using Azure gateway to rename it apiKey |
| 37 | "apiType": "azure-foundry" // Or "azure-openai" if using OpenAI models |
| 38 | }] |
| 39 | } |
| 40 | ``` |
| 41 | </Tab> |
| 42 | </Tabs> |
| 43 | |
| 44 | ## Autocomplete model |
| 45 | |
| 46 | We recommend configuring **Codestral** as your autocomplete model. |
| 47 | |
| 48 | <Info> |
| 49 | **Note:** Azure AI Foundry does not provide the FIM (Fill-in-Middle) endpoint |
| 50 | required for autocomplete functionality. To use Codestral for autocomplete, |
| 51 | deploy it through **Azure Machine Learning Studio** instead, which provides |
| 52 | the necessary `/v1/fim/completions` endpoint. |
| 53 | </Info> |
| 54 | |
| 55 | If you use Azure Machine Learning Studio to deploy Codestral: |
| 56 | |
| 57 | <Tabs> |
| 58 | <Tab title="YAML"> |
| 59 | ```yaml title="config.yaml" |
| 60 | models: |
| 61 | - name: Codestral |
| 62 | provider: mistral |
| 63 | model: codestral-latest |
| 64 | apiBase: https://<YOUR_MODEL_NAME>.<YOUR_REGION>.models.ai.azure.com/v1 |
| 65 | apiKey: <YOUR_AZURE_API_KEY> |
| 66 | roles: |
| 67 | - autocomplete |
| 68 | ``` |
| 69 | </Tab> |
| 70 | <Tab title="JSON"> |
| 71 | ```json title="config.json" |
| 72 | { |
| 73 | "tabAutocompleteModel": { |
| 74 | "title": "Codestral", |
| 75 | "provider": "mistral", |
| 76 | "model": "codestral-latest", |
| 77 | "apiBase": "https://<YOUR_MODEL_NAME>.<YOUR_REGION>.models.ai.azure.com/v1", |
| 78 | "apiKey": "<YOUR_AZURE_API_KEY>" |
| 79 | } |
| 80 | } |
| 81 | ``` |
| 82 | </Tab> |
| 83 | </Tabs> |
| 84 | |
| 85 | ## Embeddings model |
| 86 | |
| 87 | We recommend configuring **text-embedding-3-large** as your embeddings model. |
| 88 | |
| 89 | <Tabs> |
| 90 | <Tab title="YAML"> |
| 91 | ```yaml title="config.yaml" |
| 92 | models: |
| 93 | - name: Text Embedding-3 Large |
| 94 | provider: azure |
| 95 | model: text-embedding-3-large |
| 96 | apiBase: <YOUR_DEPLOYMENT_BASE> |
| 97 | apiKey: <YOUR_AZURE_API_KEY> |
| 98 | env: |
| 99 | deployment: <YOUR_DEPLOYMENT_NAME> |
| 100 | apiType: azure |
| 101 | apiVersion: 2023-07-01-preview |
| 102 | ``` |
| 103 | </Tab> |
| 104 | <Tab title="JSON"> |
| 105 | ```json title="config.json" |
| 106 | { |
| 107 | "embeddingsProvider": { |
| 108 | "provider": "azure", |
| 109 | "model": "text-embedding-3-large", |
| 110 | "apiBase": "<YOUR_DEPLOYMENT_BASE>", |
| 111 | "deployment": "<YOUR_DEPLOYMENT_NAME>", |
| 112 | "apiKey": "<YOUR_AZURE_API_KEY>", |
| 113 | "apiType": "azure-foundry" // Or "azure-openai" if using OpenAI models |
| 114 | } |
| 115 | } |
| 116 | ``` |
| 117 | </Tab> |
| 118 | </Tabs> |
| 119 | |
| 120 | ## Reranking model |
| 121 | |
| 122 | Azure OpenAI currently does not offer any reranking models. |
| 123 | |
| 124 | [Click here](../../model-roles/reranking.mdx) to see a list of reranking models. |
| 125 | |
| 126 | ## Privacy |
| 127 | |
| 128 | If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. |
| 129 | |
| 130 | <Info> |
| 131 | **Getting access:** [Click |
| 132 | here](https://azure.microsoft.com/en-us/products/ai-services/openai-service) |
| 133 | to apply for access to the Azure OpenAI service. Response times are typically |
| 134 | within a few days. |
| 135 | </Info> |
| 136 | |
| 137 | ## Azure OpenAI Service configuration |
| 138 | |
| 139 | Azure OpenAI Service requires a handful of additional parameters to be configured, such as a deployment name and API base URL. |
| 140 | |
| 141 | To find this information in _Azure AI Foundry_, first select the model that you would like to connect. Then visit _Endpoint_ > _Target URI_. |
| 142 | |
| 143 | For example, a Target URI of `https://just-an-example.openai.azure.com/openai/deployments/gpt-4o-july/chat/completions?api-version=2023-03-15-preview` would map to the following: |
| 144 | |
| 145 | <Tabs> |
| 146 | <Tab title="YAML"> |
| 147 | ```yaml title="config.yaml" |
| 148 | models: |
| 149 | - name: GPT-4o Azure |
| 150 | model: gpt-4o |
| 151 | provider: azure |
| 152 | apiBase: https://just-an-example.openai.azure.com |
| 153 | apiKey: <YOUR_AZURE_API_KEY> |
| 154 | env: |
| 155 | apiVersion: 2023-03-15-preview |
| 156 | deployment: gpt-4o-july |
| 157 | apiType: azure-openai |
| 158 | ``` |
| 159 | </Tab> |
| 160 | <Tab title="JSON"> |
| 161 | ```json title="config.json" |
| 162 | { |
| 163 | "title": "GPT-4o Azure", |
| 164 | "model": "gpt-4o", |
| 165 | "provider": "azure", |
| 166 | "apiBase": "https://just-an-example.openai.azure.com", |
| 167 | "deployment": "gpt-4o-july", |
| 168 | "apiVersion": "2023-03-15-preview", |
| 169 | "apiKey": "<YOUR_AZURE_API_KEY>", |
| 170 | "apiType": "azure-openai" |
| 171 | } |
| 172 | ``` |
| 173 | </Tab> |
| 174 | </Tabs> |