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

Clean-up Open AI resource. #2115

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Clean-up Open AI resource. #2115

merged 1 commit into from
Feb 7, 2024

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented Feb 7, 2024

We don't need an AddOpenAI extension method on the DAB. The reason is that when using the Open AI service we are not provisioning any resources, instead we can just use AddConnectionString(...) and punch in the API key for the Open AI API (e.g. Key=[key from https://platform.openai.com/api-keys].

This is distinct from AddAzureOpenAI which will ultimately result in a deployment and needs resource specific endpoints.

Also in this PR I've added a fairly simplistic app which uses the completions API to generate a story with a REALLy basic ux.

Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-integrations Issues pertaining to Aspire Integrations packages label Feb 7, 2024

var builder = DistributedApplication.CreateBuilder(args);

var openai = builder.AddConnectionString("openai");
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to use Parameters and ConnectionString together?

For example imagine I have:

var openaiKey = builder.AddParameter("OpenAIKey");

var openai = builder.AddConnectionString($"Key={openaiKey.Value}");

That way people wouldn't need to know about the connection string format. They would just stick the actual key into the parameter, and the above code would do the formatting for them.

Copy link
Member Author

Choose a reason for hiding this comment

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

No that isn't possible at the moment. File an issue? There would need to be some consideration on how interpolation would work here because the "secretness" of one parameter would have to poison all the other parameters it was injected into (btw in this example you would want to use AddParameter("OpenAIKey", secret: true). Only AddConnectionString(...) defaults to being secret.

@mitchdenny mitchdenny merged commit acc14c6 into main Feb 7, 2024
8 checks passed
@mitchdenny mitchdenny deleted the mitchdenny/clean-up-open-ai branch February 7, 2024 22:59
radical pushed a commit to radical/aspire that referenced this pull request Feb 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants