jaketracey / opax

Opax is an integration tool that brings the capabilities of OpenAI's ChatGPT into Adobe Experience Manager (AEM). It leverages AEM's robust content management features and combines them with the versatility and power of ChatGPT, allowing for a sophisticated, AI-driven user experience.
https://opax.ai
MIT License
6 stars 7 forks source link

chatGptResponse.getChoices() is throwing NullPointerException. #8

Open shivakumar660 opened 1 year ago

shivakumar660 commented 1 year ago
image

In OpaxServlet servlet chatGptResponse.getChoices() is Null. Any idea why? I have entered the API key, and it has been read in the config.

shivakumar660 commented 1 year ago

Do you have a simple Postman request which I can use to test my API Key? I am a little skeptic that I am using the right API key which is necessary for the model gpt-3.5-turbo.

jaketracey commented 1 year ago

https://platform.openai.com/docs/api-reference/completions

shivakumar660 commented 1 year ago

Hi Jake, If the API Key is invalid or if the API key does not have enough credits left, say we get a response like "You exceeded your current quota, please check your plan and billing details". We are just showing an error on the screen and in the code, we are throwing a NullPointerException. Don't you think we should improve the error handling?

jaketracey commented 1 year ago

Hi @shivakumar660

Completely agree. It would be great to pipe the error message back from the response into the Toast notifications so that users can see the errors.

I will look into making a PR for this sometime in the next couple of weeks!

Feel free to keep contributing ideas or code if you like, it's very much appreciated.