k8sgpt icon indicating copy to clipboard operation
k8sgpt copied to clipboard

feat: add azure openai provider

Open arbreezy opened this issue 1 year ago • 6 comments

Closes https://github.com/k8sgpt-ai/k8sgpt/issues/117

📑 Description

This PR introduces azure openai and get viper to omit empty strings when writing to config files

✅ Checks

  • [x] My pull request adheres to the code style of this project
  • [ ] My code requires changes to the documentation
  • [ ] I have updated the documentation as required
  • [x] All the tests have passed

ℹ Additional Information

arbreezy avatar Apr 20 '23 15:04 arbreezy

Hello @arbreezy , shouldn't we update the README to indicate that we have a new AI Backend available?

matthisholleville avatar Apr 21 '23 07:04 matthisholleville

Hello @arbreezy , shouldn't we update the README to indicate that we have a new AI Backend available?

Yes we will add docs, I just didn't have much time yesterday; I want to test it as well before merging.

arbreezy avatar Apr 21 '23 12:04 arbreezy

Tried it out, and my first observation is that the help text needs to updated to reflect these changes. I had to check the code to find out what to define as the backend.

Secondly, and this might be out of scope for the actual implementation, but if I want to do an analysis with the Azure OpenAI backend after I have authenticated, I would have so explicitly state that I'm using that as a backend, even when I have no other backends in my configuration file. @AlexsJones, this is probably something we can look into in another issue, right?

Third, and more importantly, I get an error when I run analyze with explain. This is the commands I ran:

> go run . auth -u https://rsopenaigptdemo.openai.azure.com/ -e rsk8sgpt -b azureopenai
Using azureopenai as backend AI provider
Enter azureopenai Key: Provider updated
key added

> go run . analyse -b azureopenai -e
   0% |                                                                                                            | (0/3, 0 it/hr) [0s:0s]
Error: failed while calling AI provider azureopenai: Post "/openai/deployments//chat/completions?api-version=2023-03-15-preview": unsupported protocol scheme ""
exit status 1

roberthstrand avatar Apr 23 '23 10:04 roberthstrand

Tried it out, and my first observation is that the help text needs to updated to reflect these changes. I had to check the code to find out what to define as the backend.

Secondly, and this might be out of scope for the actual implementation, but if I want to do an analysis with the Azure OpenAI backend after I have authenticated, I would have so explicitly state that I'm using that as a backend, even when I have no other backends in my configuration file. @AlexsJones, this is probably something we can look into in another issue, right?

Third, and more importantly, I get an error when I run analyze with explain. This is the commands I ran:

> go run . auth -u https://rsopenaigptdemo.openai.azure.com/ -e rsk8sgpt -b azureopenai
Using azureopenai as backend AI provider
Enter azureopenai Key: Provider updated
key added

> go run . analyse -b azureopenai -e
   0% |                                                                                                            | (0/3, 0 it/hr) [0s:0s]
Error: failed while calling AI provider azureopenai: Post "/openai/deployments//chat/completions?api-version=2023-03-15-preview": unsupported protocol scheme ""
exit status 1

hello @roberthstrand, Documentation has been added along with some basic checks when running k8sgpt auth to ensure you will use a valid ai provider/backend. Could you please run again a test with your Azure OpenAI deployment ?

Re: the analyze cli , I will address it, in a different PR; I agree there is no need to specify a backend if it's the only one in your configuration

Thanks in advance :) !

arbreezy avatar Apr 25 '23 21:04 arbreezy

ready for review?

AlexsJones avatar Apr 26 '23 09:04 AlexsJones

ready for review?

yes !

arbreezy avatar Apr 26 '23 09:04 arbreezy

is there any documentation change required for this for end users ? wanted to validate this once with my azure openai account .

shubham-uipath avatar May 03 '23 06:05 shubham-uipath