-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
If the OPEN_AI_API Key is wrong or invalid, the chatapi/v1/got endpoint returns http code 200, but the "answer" is empty.
The DEBUG logs will show an error:
2024-05-15 21:50:32,910 DEBUG openai._base_client Thread-1 (process_request_thread) : HTTP Request: POST https://api.openai.com/v1/chat/completions "401 Unauthorized"
2024-05-15 21:50:32,911 INFO backoff Thread-1 (process_request_thread) : Backing off chat(...) for 0.7s (openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: 03********************5e. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}})
But this error is not being relayed by the chatapi/v1/got endpoint. The Frontend needs this information to display a helpful message to users.
To Reproduce
Steps to reproduce the behavior:
- Set an invalid OPENAI_API_KEY in the .env file
- Launch the backend server:
docker compose up execgpt - Call the
POST chatapi/v1/gotendpoint with a body similar to:
{
"chatInput": "what genes are associated with Droperidol?"
}
The response comes back with an empty "answer" key and the DEBUG log shows the error above
Expected behavior
This endpoint needs to relay messages from calls to the OpenAI API.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working