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

fix: disable adding multiple openai provider #1191

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

gyliu513
Copy link
Contributor

Closes #1169

πŸ“‘ Description

βœ… Checks

  • 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
  • All the tests have passed

β„Ή Additional Information

@gyliu513
Copy link
Contributor Author

/cc @AlexsJones

@gyliu513
Copy link
Contributor Author

gyliu@guangyas-air k8sgpt % ./bin/k8sgpt auth add
Warning: backend input is empty, will use the default value: openai
Warning: model input is empty, will use the default value: gpt-3.5-turbo
Enter openai Key: openai added to the AI backend provider list
gyliu@guangyas-air k8sgpt % ./bin/k8sgpt auth add
Warning: backend input is empty, will use the default value: openai
Warning: model input is empty, will use the default value: gpt-3.5-turbo
Enter openai Key: Provider with same name already exists.
gyliu@Guangyas-MacBook-Air k8sgpt % cat k8sgpt.yaml
active_filters:
    - ValidatingWebhookConfiguration
    - Deployment
    - PersistentVolumeClaim
    - InstanaSelfHostedInstallCheck
    - StatefulSet
    - CronJob
    - ReplicaSet
    - Service
    - Node
    - MutatingWebhookConfiguration
    - InstanaSelfHostedValidate
    - Ingress
    - Pod
ai:
    providers:
        - name: openai
          model: gpt-3.5-turbo
          password: "123456"
          temperature: 0.7
          topp: 0.5
          topk: 50
          maxtokens: 2048
          customheaders: []
    defaultprovider: ""
kubeconfig: ""
kubecontext: ""

@AlexsJones
Copy link
Member

Can you help me understand this issue?

@gyliu513
Copy link
Contributor Author

@AlexsJones if you take a look at https://github.com/k8sgpt-ai/k8sgpt/blob/main/cmd/auth/add.go#L64 , you will see the backend is always empty if I did not set backend when adding auth, here I was trying to get backend first before adding auth to k8sgpt.yaml, is this clear for you? Thanks

@JuHyung-Son
Copy link
Contributor

your intend is to make disabling auth add if there is existing one. right?

@gyliu513
Copy link
Contributor Author

gyliu513 commented Jul 15, 2024

your intend is to make disabling auth add if there is existing one. right?

@JuHyung-Son This is the design behavior for all other LLM backends, I was trying to enable this behavior for openai as well.

@gyliu513
Copy link
Contributor Author

@AlexsJones @JuHyung-Son any further comments for this? Thanks!

@matthisholleville
Copy link
Contributor

Hi @gyliu513 ! I just tested it, and it works well. However, the CLI still prompts me to enter an API key before returning an error, since the backend already exists. Shouldn't we perform this check before displaying the Enter openai Key ?

@gyliu513
Copy link
Contributor Author

@matthisholleville done

gyliu@Guangyas-MacBook-Air k8sgpt % ./bin/k8sgpt auth add
Warning: backend input is empty, will use the default value: openai
Provider with same name already exists.

Copy link
Contributor

@matthisholleville matthisholleville left a comment

Choose a reason for hiding this comment

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

lgtm ! Great work

@matthisholleville matthisholleville merged commit 644581f into k8sgpt-ai:main Aug 20, 2024
8 checks passed
AlexsJones pushed a commit that referenced this pull request Oct 24, 2024
Signed-off-by: Guangya Liu <[email protected]>
Co-authored-by: Matthis <[email protected]>
Signed-off-by: AlexsJones <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG]: Update OpenAI API Key failed
4 participants