-
Notifications
You must be signed in to change notification settings - Fork 609
Integration for Azure.AI.Inference
#9103
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
base: main
Are you sure you want to change the base?
Conversation
if (builder.DisableTracing) | ||
{ | ||
return result; | ||
} | ||
|
||
var loggerFactory = services.GetService<ILoggerFactory>(); | ||
return new OpenTelemetryChatClient(result, loggerFactory?.CreateLogger(typeof(OpenTelemetryChatClient))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it do this instead of using the UseOpenTelemetry helper method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know it existed. I copied that from the OpenAI integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me as the author of the OpenAI integration: 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #9103 (comment)
src/Components/Aspire.Azure.AI.Inference/AspireAzureAIInferenceExtensions.cs
Show resolved
Hide resolved
src/Components/Aspire.Azure.AI.Inference/AspireChatCompletionsClientBuilder.cs
Show resolved
Hide resolved
src/Components/Aspire.Azure.AI.Inference/AspireAzureAIInferenceExtensions.cs
Outdated
Show resolved
Hide resolved
src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj
Outdated
Show resolved
Hide resolved
/// <summary> | ||
/// Gets or sets the name of the AI model to use for chat completions. | ||
/// </summary> | ||
public string? ModelName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly isn't, I think it was from an older implementation
/// <summary> | ||
/// Gets or sets the ID of the AI model to use for chat completions. | ||
/// </summary> | ||
public string? ModelId { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Azure.AI.Inference library calls this "deploymentId", right? We also use the term DeploymentId
in AspireChatCompletionsClientBuilder. We should consolidate on a single term here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that in my refactor, will fix.
src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj
Show resolved
Hide resolved
/// Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not. | ||
/// </summary> | ||
/// <remarks> | ||
/// ServiceBus ActivitySource support in Azure SDK is experimental, the shape of Activities may change in the future without notice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// ServiceBus ActivitySource support in Azure SDK is experimental, the shape of Activities may change in the future without notice. | |
/// Azure AI Inference client library ActivitySource support in Azure SDK is experimental, the shape of Activities may change in the future without notice. |
/// Gets or sets the connection string used to connect to the AI Foundry account. | ||
/// </summary> | ||
/// <remarks> | ||
/// If <see cref="ConnectionString"/> is set, it overrides <see cref="Endpoint"/> and <see cref="Credential"/>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is a bit misleading, since setting ConnectionString will populate Endpoint in ParseConnectionString below.
/// </summary> | ||
/// <param name="builder"></param> | ||
/// <returns></returns> | ||
public static ChatClientBuilder AddChatClient(this AspireChatCompletionsClientBuilder builder) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests for this method?
return result; | ||
} | ||
|
||
return new ChatClientBuilder(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use the same pattern as we do elsewhere:
aspire/src/Components/Aspire.OpenAI/AspireOpenAIClientBuilderChatClientExtensions.cs
Lines 75 to 76 in 3859112
var loggerFactory = services.GetService<ILoggerFactory>(); | |
return new OpenTelemetryChatClient(result, loggerFactory?.CreateLogger(typeof(OpenTelemetryChatClient))); |
As this code currently is, the Logger won't be hooked up because you aren't passing in the services to Build()
.
@@ -0,0 +1,30 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a README for the library?
Description
Implementing an integration for the Azure AI Inference NuGet package.
Fixes #9011
Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template