Skip to content
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

Aspire.AI.Azure.OpenAI integration #153

Merged
merged 12 commits into from
Feb 21, 2024
Merged

Aspire.AI.Azure.OpenAI integration #153

merged 12 commits into from
Feb 21, 2024

Conversation

sebastienros
Copy link
Member

Showing how the upcoming Aspire.Azure.AI.OpenAI component can be integrated.

@@ -5,6 +5,7 @@
builder.AddApplicationServices();

builder.Services.AddProblemDetails();
builder.AddAzureOpenAI("catalogOpenAi");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the name of this method.
In the AppHost we have AddAzureOpenAI and AddopenAI (for non-azure and azure based open ai services).
In the apps we have AddAzureOpenAI and AddKeyedAzureOpenAI named after the NuGet package.

On the "client" app I'd rather have the method called Add[Keyed]OpenAIClient since is independent of Azure or non-Azure, and represents more what it's doing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the core of the issue is that the library does both, but is "Azure" branded.

An option is to have both methods. And the AzureOpenAI one ensures both Endpoint and Key are configured. And the OpenAI one just reads Key.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Azure" is OK, we could see this coming from the Azure SDK.

What about the AddOpenAI vs AddOpenAIClient though? For Postgres we call it AddNpgsqlDataSource which makes it simpler to grasp, and why I'd prefer to use AddOpenAIClient (or AddAzureOpenAIClient since it's an Azure SDK concept?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with adding Client to the name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: we are having lots of discussions on the Azure SDK about the best way to support both OpenAI (OAI) and Azure OpenAI (AOAI) with just one client. We are thinking that the way it's done today (e.g. if no endpoint passed, OAI is called; and the 3rd parameter meaning either model or deployment) is not ideal and so it might change before the SDK GAs (releases as stable). Because of that, I would suggest that you don't rely too much on how the ctors look today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, depending on how that's changed, changing that could negatively impact Semantic Kernel, which has OpenAIClient in its public surface area.
cc: @markwallace-microsoft, @matthewbolanos

@eerhardt
Copy link
Member

eerhardt commented Feb 5, 2024

What's the status of this PR? Are we waiting for Aspire preview3 to ship before completing it?

@sebastienros
Copy link
Member Author

Correct. I was using locally built packages.

@adityamandaleeka
Copy link
Member

@sebastienros, FYI we're using preview 3 in this repo now (and you have a merge conflict for that).

@sebastienros sebastienros marked this pull request as ready for review February 15, 2024 22:11
Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I just have 1 main question.

src/eShop.AppHost/Program.cs Outdated Show resolved Hide resolved
src/Catalog.API/Services/CatalogAI.cs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants