Closed jeffdapaz closed 1 year ago
+1 to this. I came here to suggest it myself!
I'm still waiting for microsoft to make the service public so I can test it and add to the extension.
But if someone who already has access can collaborate and implement it themselves, that would be great.
Hi @jeffdapaz I've just requested access to MS to be able to use Azure OpenAI, if I get access I will try it. The changes required to do in your extension are: OptionGrid.cs Add new property to select if you want to use ChatGPT or Azure OpenAI let say ServiceType Add property "YourResourceName" Add property "deploymentId"
ChatGPT.cs Update method CreateApiHandler to retrieve instead of apikey and proxy the whole options object Then inside the method change:
if (api == null)
{
api = new(apiKey);
}
else if (api.Auth.ApiKey != apiKey)
{
api.Auth.ApiKey = apiKey;
}
if (!string.IsNullOrWhiteSpace(proxy))
{
api.ApiUrlFormat = proxy + "/{0}/{1}";
}
by:
if (api == null)
{
if (configuration.ServiceType == ServiceType.AzureOpenAi)
{
api = OpenAIAPI.ForAzure(configuration.YourResourceName, configuration.DeploymentId, configuration.api-key);
}
else
{
api = new(configuration.apiKey);
}
}
else if (api.Auth.ApiKey != configuration.apiKey)
{
api.Auth.ApiKey = configuration.apiKey;
}
if (!string.IsNullOrWhiteSpace(configuration.proxy))
{
api.ApiUrlFormat = configuration.proxy + "/{0}/{1}";
}
Hi @Rabosa616, very thanks to show how to do!
Now I'm on vacation in another country without access to a computer where I can program, but when I go back I will release a version with this change for the people can test and maybe use through azure.
Hi @jeffdapaz All info I extracted from the nuget package OpenAI that you use in the project. All Azure info you can find here: https://github.com/OkGoDoIt/OpenAI-API-dotnet#azure.
Hi @jeffdapaz I've got access to Azure OpenAI, so I´ve update your code with a PR.
If you like the implementation feel free to approve it
Thanks @Rabosa616!
When be possible I will approve the PR and release a new version.
No problems. The only think I do not like is that when for instance select AddTest the response is written directly under the function. Should not be better to write the responses in the proper VisualChatGPTStudio windows?
No problems. The only think I do not like is that when for instance select AddTest the response is written directly under the function. Should not be better to write the responses in the proper VisualChatGPTStudio windows?
Yes, agree here. It just destroys already existing code!
@Rabosa616 and @duskwalker, you already can do this.
Hold SHIFT when click in one of the commands and the response will be write under the tool window instead the code editor.
I already have the solution provided by @Rabosa616 on my side.
I will publish it shortly in the next release.
If the solution is not suitable, feel free to give feedback and open this issue again.
Make possible to use the Azure Open API instead OpenAI API.
The idea is add new option parameters to possibility the VS user select Azure Open API instead OpenAI API, and set especifics Azure Open API parameters.