Repository navigation
Implement health checks for Azure AI Inference ChatCompletionsClient and EmbeddingsClient #15969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Sébastien Ros (sebastienros)
merged 10 commits into
microsoft:main
from
Formatted:add-azure-openai-inference-health-checks
Sep 2, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5eaa723
Implement health checks for Azure AI Inference ChatCompletionsClient …
0758c9c
Merge remote-tracking branch 'origin/main' into add-azure-openai-infe…
Formatted fcb4140
Fix AI inference health check compatibility
sebastienros 2cb90c2
Merge remote-tracking branch 'origin/main' into add-azure-openai-infe…
sebastienros 9aa4b13
Handle Foundry Azure OpenAI endpoints
sebastienros 709c7f7
Document Azure OpenAI domain maintenance
sebastienros bbcada3
Document Azure AI Inference health checks
sebastienros b86d81c
Test Azure AI embeddings health checks
sebastienros f3f969e
Exclude loopback endpoints from Azure AI Inference health checks
Formatted 042d08e
Test Azure AI chat health checks
sebastienros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Components/Aspire.Azure.AI.Inference/AzureAIInferenceChatCompletionsHealthCheck.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Azure.AI.Inference; | ||
| using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
|
|
||
| namespace Aspire.Azure.AI.Inference; | ||
|
|
||
| internal sealed class AzureAIInferenceChatCompletionsHealthCheck : IHealthCheck | ||
| { | ||
| private readonly ChatCompletionsClient _client; | ||
|
|
||
| public AzureAIInferenceChatCompletionsHealthCheck(ChatCompletionsClient client) | ||
| => _client = client; | ||
|
|
||
| public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) | ||
| { | ||
| try | ||
| { | ||
| await _client.GetModelInfoAsync(cancellationToken).ConfigureAwait(false); | ||
| return HealthCheckResult.Healthy(); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| return new HealthCheckResult(context.Registration.FailureStatus, exception: ex); | ||
| } | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
src/Components/Aspire.Azure.AI.Inference/AzureAIInferenceEmbeddingsHealthCheck.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Azure.AI.Inference; | ||
| using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
|
|
||
| namespace Aspire.Azure.AI.Inference; | ||
|
|
||
| internal sealed class AzureAIInferenceEmbeddingsHealthCheck : IHealthCheck | ||
| { | ||
| private readonly EmbeddingsClient _client; | ||
|
|
||
| public AzureAIInferenceEmbeddingsHealthCheck(EmbeddingsClient client) | ||
| => _client = client; | ||
|
|
||
| public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) | ||
| { | ||
| try | ||
| { | ||
| await _client.GetModelInfoAsync(cancellationToken).ConfigureAwait(false); | ||
|
sebastienros marked this conversation as resolved.
|
||
| return HealthCheckResult.Healthy(); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| return new HealthCheckResult(context.Registration.FailureStatus, exception: ex); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.