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

[Bug]: Uncaught JsonException #339

Open
sera1t opened this issue Feb 19, 2024 · 0 comments
Open

[Bug]: Uncaught JsonException #339

sera1t opened this issue Feb 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sera1t
Copy link

sera1t commented Feb 19, 2024

Description

Hello, I installed the library, everything is fine, but for some reason, when I try to make a request, it gives me this error in the console.

[Mon Feb 19 12:51:13 2024] 127.0.0.1:53566 [500]: GET /chat/tet.php - Uncaught JsonException: Syntax error in /var/www/chatbot/vendor/openai-php/client/src/Transporters/HttpTransporter.php:61
Stack trace:
#0 /var/www/chatbot/vendor/openai-php/client/src/Transporters/HttpTransporter.php(61): json_decode()
#1 /var/www/chatbot/vendor/openai-php/client/src/Resources/Chat.php(33): OpenAI\Transporters\HttpTransporter->requestObject()
#2 /var/www/chatbot/public/chat/tet.php(10): OpenAI\Resources\Chat->create()
#3 {main}

Next OpenAI\Exceptions\UnserializableResponse: Syntax error in /var/www/chatbot/vendor/openai-php/client/src/Transporters/HttpTransporter.php:63
Stack trace:
#0 /var/www/chatbot/vendor/openai-php/client/src/Resources/Chat.php(33): OpenAI\Transporters\HttpTransporter->requestObject()
#1 /var/www/chatbot/public/chat/tet.php(10): OpenAI\Resources\Chat->create()
#2 {main}
thrown in /var/www/chatbot/vendor/openai-php/client/src/Transporters/HttpTransporter.php on line 63

Steps To Reproduce

I'm trying to run this code
$client = OpenAI::client($apiKey);

$response = $client->chat()->create([
'model' => 'gpt-4',
'messages' => [
['role'=>'system', 'content' => 'Assistant'],
['role' => 'user', 'content' => 'Hello!'],
],
]);

OpenAI PHP Client Version

v0.8.4

PHP Version

8.1

Notes

No response

@sera1t sera1t added the bug Something isn't working label Feb 19, 2024
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

1 participant