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

can't use groq #511

Open
dss99911 opened this issue Apr 24, 2024 · 10 comments
Open

can't use groq #511

dss99911 opened this issue Apr 24, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@dss99911
Copy link

What happened?

Connection failed.

Incorrect API key provided: $CUSTOM_***********_KEY. You can find your API key at
https://platform.openai.com/account/api-keys.

Relevant log output or stack trace

No response

Steps to reproduce

  1. get api key from https://groq.com/

  2. on codegpt setting,

  • select custom openai service
  • select 'Groq' on preset template
  • input api key
  • click test connection

the error below occurred

Connection failed.

Incorrect API key provided: $CUSTOM_***********_KEY. You can find your API key at
https://platform.openai.com/account/api-keys.

when I tested on curl below, it's working fine.

curl -X POST "https://api.groq.com/openai/v1/chat/completions" \
     -H "Authorization: Bearer $GROQ_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"messages": [{"role": "user", "content": "Explain the importance of fast language models"}], "model": "mixtral-8x7b-32768"}'

CodeGPT version

2.6.3-241

Operating System

macOS

@dss99911 dss99911 added the bug Something isn't working label Apr 24, 2024
@sisve
Copy link
Contributor

sisve commented Apr 25, 2024

The error message indicates that 1) you're talking to openai.com, and 2) you're sending the literal string $CUSTOM_SERVICE_API_KEY as your api-key.

Can you verify that you have configured an custom URL and api-key in your CodeGPT plugin settings?

@dss99911
Copy link
Author

when I select 'Groq' on preset template.
it changes the URL to https://api.groq.com/openai/v1/chat/completions automatically. I used the url

@dss99911
Copy link
Author

image

@carlrobertoh
Copy link
Owner

carlrobertoh commented Apr 25, 2024

Did you apply the settings before testing the connection? There's a small bug around that.

@dss99911
Copy link
Author

the settings I mentioned above is applied before testing the connection

@reneleonhardt
Copy link
Contributor

reneleonhardt commented Apr 25, 2024

Same here since #476 has been merged, the wrong settings are being used for Custom OpenAI, depending on your application state.
If you switch presets, the default settings are being applied (Ollama has no code completions, tab is disabled).
If you reopen the settings dialog again, code completions becomes active with default settings for OpenAI (first FIM template autoselected), hence the Incorrect API key provided response for platform.openai.com (Ollama runs on localhost).
So the user settings are being overwritten sometimes with "default values" or empty values depending on Preset template change, FIM template change, open settings dialog (init forms)...
This feature is very flaky, I would suggest writing tests first for all supported services, models and FIM templates (success and errors like missing API key, unexpected API key, unexpected response). And especially changing user settings without the user knowing it, initializing forms shouldn't change persisted users settings but instead load them, but many more settings are changed/deleted/added depending on the selected Preset and FIM.
Maybe it would be helpful if the listener would be usable with checked exceptions instead of RuntimeExceptions, so the application would have to handle all errors explicitly.

Incorrect API key provided: $CUSTOM_***********_KEY. You can find your API key at https://platform.openai.com/account/api-keys.

java.lang.RuntimeException
	at ee.carlrobert.llm.completion.CompletionEventSourceListener.onFailure(CompletionEventSourceListener.java:114)
	at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:52)

@dss99911
Copy link
Author

thanks for the solution. but, I couldn't understand the detail.

  1. can it be fixed?
  2. is there workaround before it's fixed?

@reneleonhardt
Copy link
Contributor

Never open settings again before the next CodeGPT release 😅
Before closing settings, make sure to switch the Preset template first and check all settings to be correct.

@carlrobertoh
Copy link
Owner

@dss99911

is there workaround before it's fixed?

Delete CodeGPT_CustomServiceSettings.xml settings file from the options folder and restart your IDE.

https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs

@PhilKes
Copy link
Contributor

PhilKes commented May 8, 2024

This is fixed by #531

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants