> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure AI Foundry

> 了解如何在 Agno 中使用 Azure AI Foundry 模型。

使用托管在 Azure 基础架构上的各种开源模型。在此处了解更多信息。

Azure AI Foundry 提供对 `Phi`、`Llama`、`Mistral`、`Cohere` 等模型的访问。

## 身份验证

导航到 [Azure Portal](https://portal.azure.com/) 中的 Azure AI Foundry 并创建一个服务。然后设置您的环境变量：

<CodeGroup>
  ```bash Mac theme={null}
  export AZURE_API_KEY=***
  export AZURE_ENDPOINT=***  # 格式为 https://<your-host-name>.<your-azure-region>.models.ai.azure.com/models
  # 可选：
  # export AZURE_API_VERSION=***
  ```

  ```bash Windows theme={null}
  setx AZURE_API_KEY ***  # 格式为 https://<your-host-name>.<your-azure-region>.models.ai.azure.com/models
  setx AZURE_ENDPOINT ***
  # 可选：
  # setx AZURE_API_VERSION ***
  ```
</CodeGroup>

## 示例

将 `AzureAIFoundry` 与您的 `Agent` 一起使用：

<CodeGroup>
  ```python agent.py theme={null}
  from agno.agent import Agent
  from agno.models.azure import AzureAIFoundry

  agent = Agent(
      model=AzureAIFoundry(id="Phi-4"),
      markdown=True
  )

  # 在终端上打印响应
  agent.print_response("写一个两句话的恐怖故事。")
  ```
</CodeGroup>

## 高级示例

在此处查看更多示例。

## 参数

`AzureAIFoundry` 是 `Model` 类的子类，可以访问相同的参数。
