openai-php / laravel

⚡️ OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with OpenAI API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAI \ Exceptions \ ErrorException - unclear, please help

nezaboravi opened this issue · comments

I am attaching image of screen.
Error is unclear, and i am not sure where to look at all

image

Pest test works:
carbon(1)

Since yesterday this is happening with no further explanation, before yesterday everything was fine; this is the error i'm getting in Laravel 9

image

This has been fixed in the latest version: 0.5.3

commented

Me too

Same here. Please check still exist in version: 0.5.3

I've tried various things, but I am not able to reproduce the issue.

@nezaboravi @kmilo2622 @Obacm @makerstorage Was anyone of you able to debug an find out, what the API actually returns or do you have a stable way to reproduce the issue?

Probably I run into the same issue right now:

For some error the API returns an error with an empty message, which leads to some confusion. If you are taking a closer look to the error exception details, the reason is visible, but this some kind of unexpected.

Exception Output:
Screenshot 2023-06-14 at 21 52 28

Raw JSON error from the API:
Screenshot 2023-06-14 at 21 54 14

Maybe would could add some logic, like "if the message is empty copy the error code to the message".
What do you think?

At least for the invalid API Key this doesn't look to bad:
Screenshot 2023-06-14 at 21 58 49

I could find out the error using the openAI API directly and it was a problem with the API key (in my situation) but that error wasn't available for debug in this PHP package for some reason.

Problem here lays in env variable naming.
min openai is actually two similar things, one is called display name and other is called id. In env file in laravel mislead me kind of so I wrote Coding Wisely as organisation name, and when I removed it and changed to organisation id provided in openai, it worked. Maybe just update environment name to be clear that that is ID

Here is what i am talking about:
OPENAI_ORGANIZATION=
I would rename it to OPENAI_ORGANIZATION_ID and point user where to get it.

In openAI you have both open organization and open organization id that starts with org-....