Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/azureai/ai-integrations-compatibility-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ The [Aspire.Hosting.GitHub.Models](https://www.nuget.org/packages/Aspire.Hosting
```csharp
var builder = DistributedApplication.CreateBuilder(args);

var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model);

builder.AddProject<Projects.ExampleProject>()
.WithReference(chat);
Expand Down
18 changes: 12 additions & 6 deletions docs/azureai/azureai-foundry-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ var builder = DistributedApplication.CreateBuilder(args);

var foundry = builder.AddAzureAIFoundry("foundry");

var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft");
var model = AIFoundryModel.Microsoft.Phi4;
var chat = foundry.AddDeployment("chat", model);

builder.AddProject<Projects.ExampleProject>()
.WithReference(chat)
Expand All @@ -74,17 +75,18 @@ builder.AddProject<Projects.ExampleProject>()
The preceding code:

- Adds an Azure AI Foundry resource named `foundry`.
- Adds an Azure AI Foundry deployment resource named `chat` with a model name of `Phi-4`. The model name must correspond to an [available model](/azure/ai-foundry/foundry-models/concepts/models) in the Azure AI Foundry service.
- Adds an Azure AI Foundry deployment resource named `chat` using the <xref:Aspire.Hosting.Azure.AIFoundryModel> constant for Phi-4. The model must correspond to an [available model](/azure/ai-foundry/foundry-models/concepts/models) in the Azure AI Foundry service.

> [!NOTE]
> The `format` parameter of the `AddDeployment(...)` method can be found in the Azure AI Foundry portal in the details page of the model, right after the `Quick facts` text.
> [!TIP]
> Use the strongly-typed <xref:Aspire.Hosting.Azure.AIFoundryModel> constants to avoid typos and ensure you're using valid model identifiers. These constants are grouped by publisher (for example, `AIFoundryModel.Microsoft.Phi4`, `AIFoundryModel.OpenAI.Gpt4o`).

### Configure deployment properties

You can customize deployment properties using the <xref:Aspire.Hosting.AzureAIFoundryExtensions.WithProperties*> method:

```csharp
var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft")
var model = AIFoundryModel.Microsoft.Phi4;
var chat = foundry.AddDeployment("chat", model)
.WithProperties(deployment =>
{
deployment.SkuName = "Standard";
Expand Down Expand Up @@ -130,7 +132,8 @@ var builder = DistributedApplication.CreateBuilder(args);
var foundry = builder.AddAzureAIFoundry("foundry")
.RunAsFoundryLocal();

var chat = foundry.AddDeployment("chat", "phi-3.5-mini", "1", "Microsoft");
var model = AIFoundryModel.Local.Phi35Mini;
var chat = foundry.AddDeployment("chat", model);

builder.AddProject<Projects.ExampleProject>()
.WithReference(chat)
Expand All @@ -143,6 +146,9 @@ When the AppHost starts up, the local foundry service is also started. This requ

The <xref:Aspire.Hosting.AzureAIFoundryExtensions.RunAsFoundryLocal*> method configures the resource to run as an emulator. It downloads and loads the specified models locally. The method provides health checks for the local service and automatically manages the Foundry Local lifecycle.

> [!TIP]
> Use the strongly-typed `AIFoundryModel.Local` constants for local development models. These constants are specifically optimized for Foundry Local (for example, `AIFoundryModel.Local.Phi4Mini`, `AIFoundryModel.Local.DeepseekR17b`).

### Assign roles to resources

You can assign specific roles to resources that need to access the Azure AI Foundry service. Use the <xref:Aspire.Hosting.AzureAIFoundryExtensions.WithRoleAssignments*> method:
Expand Down
38 changes: 23 additions & 15 deletions docs/github/github-models-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ To add a `GitHubModelResource` to your AppHost project, call the `AddGitHubModel
```csharp
var builder = DistributedApplication.CreateBuilder(args);

var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model);

builder.AddProject<Projects.ExampleProject>()
.WithReference(chat);

// After adding all resources, run the app...
```

The preceding code adds a GitHub Model resource named `chat` using the `openai/gpt-4o-mini` model. The <xref:Aspire.Hosting.ResourceBuilderExtensions.WithReference*> method passes the connection information to the `ExampleProject` project.
The preceding code adds a GitHub Model resource named `chat` using the <xref:Aspire.Hosting.GitHub.GitHubModel> constant for OpenAI's GPT-4o-mini model. The <xref:Aspire.Hosting.ResourceBuilderExtensions.WithReference*> method passes the connection information to the `ExampleProject` project.

> [!TIP]
> Use the strongly-typed <xref:Aspire.Hosting.GitHub.GitHubModel> constants to avoid typos and ensure you're using valid model identifiers. These constants are grouped by publisher (for example, `GitHubModel.OpenAI.OpenAIGpt4oMini`, `GitHubModel.Microsoft.Phi4MiniInstruct`, `GitHubModel.DeepSeek.DeepSeekV30324`).

### Specify an organization

Expand All @@ -57,7 +61,8 @@ For organization-specific requests, you can specify an organization parameter:
var builder = DistributedApplication.CreateBuilder(args);

var organization = builder.AddParameter("github-org");
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini", organization);
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model, organization);

builder.AddProject<Projects.ExampleProject>()
.WithReference(chat);
Expand All @@ -76,7 +81,8 @@ The GitHub Models integration supports multiple ways to configure authentication
By default, the integration creates a parameter named `{resource_name}-gh-apikey` that automatically falls back to the `GITHUB_TOKEN` environment variable:

```csharp
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model);
```

Then in user secrets:
Expand All @@ -95,7 +101,8 @@ You can also specify a custom parameter for the API key:

```csharp
var apiKey = builder.AddParameter("my-api-key", secret: true);
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini")
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model)
.WithApiKey(apiKey);
```

Expand All @@ -114,7 +121,8 @@ Then in user secrets:
You can add health checks to verify the GitHub Models endpoint accessibility and API key validity:

```csharp
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini")
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model)
.WithHealthCheck();
```

Expand All @@ -123,14 +131,14 @@ var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini")

### Available models

GitHub Models supports various AI models. Some popular options include:
GitHub Models supports various AI models. Use the strongly-typed <xref:Aspire.Hosting.GitHub.GitHubModel> constants for the most up-to-date list of available models. Some popular options include:

- `openai/gpt-4o-mini`
- `openai/gpt-4o`
- `deepseek/DeepSeek-V3-0324`
- `microsoft/Phi-4-mini-instruct`
- `GitHubModel.OpenAI.OpenAIGpt4oMini`
- `GitHubModel.OpenAI.OpenAIGpt41Mini`
- `GitHubModel.DeepSeek.DeepSeekV30324`
- `GitHubModel.Microsoft.Phi4MiniInstruct`

Check the [GitHub Models documentation](https://docs.github.com/github-models) for the most up-to-date list of available models.
Check the [GitHub Models documentation](https://docs.github.com/github-models) for more information about these models and their capabilities.

## Client integration

Expand Down Expand Up @@ -171,7 +179,6 @@ public class ExampleService(ChatCompletionsClient client)
public async Task<string> GetResponseAsync(string prompt)
{
var response = await client.GetChatCompletionsAsync(
"openai/gpt-4o-mini",
new[]
{
new ChatMessage(ChatRole.User, prompt)
Expand Down Expand Up @@ -237,7 +244,7 @@ public class ChatService(OpenAIClient client)
{
public async Task<string> GetChatResponseAsync(string prompt)
{
var chatClient = client.GetChatClient("openai/gpt-4o-mini");
var chatClient = client.GetChatClient(GitHubModel.OpenAI.OpenAIGpt4oMini);

var response = await chatClient.CompleteChatAsync(
new[]
Expand Down Expand Up @@ -271,7 +278,8 @@ When running an app in GitHub Codespaces or GitHub Actions, the `GITHUB_TOKEN` e

```csharp
// No additional configuration needed in Codespaces/GitHub Actions
var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini");
var model = GitHubModel.OpenAI.OpenAIGpt4oMini;
var chat = builder.AddGitHubModel("chat", model);
```

##### Personal access tokens for local development
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/azure/AppHost/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var foundryDeployment = foundry.AddDeployment(
name: "chat",
modelName: "Phi-4",
modelVersion: "1",
modelVersion: "7",
format: "Microsoft");

builder.AddAzureAppConfiguration("config");
Expand Down