-
Notifications
You must be signed in to change notification settings - Fork 416
-
Notifications
You must be signed in to change notification settings - Fork 416
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
AddOpenAIRestApiClient
to wrap both AzureOpenAI and OpenAI integrations
#5755
Comments
This method doesn't take a We may not need to solve this immediately. But we should be aware of this limitation in the API. |
@eerhardt at that level we shouldn't know, so that's why I went with no callback. If we knew then we could just call the final method. The only viable option I see is to have new types for these settings that can be mapped to each concrete settings/options. Even if they don't make sense, like still provide |
The name AddOpenAIRestApiClient is a bit strange IMO. It implies that the other clients are not REST. |
@KrzysztofCwalina So far this was the best we got. We need to find a name that is not:
and yet shows that it returns something to connect to "any" OpenAI service. Other "not good" suggestions to show what we want to express would be |
Other (not necessarily better) names:
Maybe "Configurable" might be the best name so far... Or we could change the naming pattern to something like:
Another option is to bake this configuration sniffing directly into |
Background and Motivation
Between the existing Aspire.Azure.AI.OpenAI and the new Aspire.OpenAI integration implemented in #5621 we can now register an
AzureOpenAIClient
orOpenAIClient
withAddAzureOpenAIClient
orAddOpenAIClient
. AlsoAzureOpenAIClient
inherits fromOpenAIClient
.We want to create a new method in the Aspire.Azure.AI.OpenAI component, named
AddOpenAIRestApiClient
that will be able to return the correct instance, eitherAzureOpenAIClient
orOpenAIClient
based on the connection string that is provided.The logic to detect which concrete implementation to return will be based on the presence of an
Endpoint
in the connection string:IsAzure
is set in the connection string, if it'strue
returnAzureOpenAIClient
, otherwiseOpenAIClient
.Endpoint
containsazure.com
orazure.cn
return theAzureOpenAIClient
instanceOpenAIClient
instance.Proposed API
Usage Examples
These AppHost configurations would register an
AzureOpenAIClient
instance:These AppHost configurations would register an
OpenAIClient
instance:Each Aspire service would then provide the configuration matching the endpoint they provided, using either
Aspire:Azure:AI:OpenAI
orAspire:OpenAI
keys.Alternative Designs
N/A
Risks
This is not a breaking change, and it builds on top of the existing OpenAI integrations such that there is no code change in these either.
The text was updated successfully, but these errors were encountered: