openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.56k stars 466 forks source link

[Bug]: #373

Closed ThomasKroonV2 closed 2 months ago

ThomasKroonV2 commented 2 months ago

Description

When creating a run in my controller:

        $response = OpenAI::threads()->runs()->create(
            threadId: $data["thread_id"],
            parameters: [
                'assistant_id' => $requestData["assistant_id"],
                'stream' => true
            ],
        );`

I get a syntax error: { "message": "Syntax error", "exception": "OpenAI\Exceptions\UnserializableResponse", "file": "/var/www/html/vendor/openai-php/client/src/Transporters/HttpTransporter.php", "line": 64, "trace": [ { "file": "/var/www/html/vendor/openai-php/client/src/Resources/ThreadsRuns.php", "line": 30, "function": "requestObject", "class": "OpenAI\Transporters\HttpTransporter", "type": "->" }, { "file": "/var/www/html/app/Http/Controllers/Admin/RunCrudController.php", "line": 98, "function": "create", "class": "OpenAI\Resources\ThreadsRuns", "type": "->" }, { "file": "/var/www/html/app/Http/Controllers/Admin/MessageCrudController.php", "line": 134, "function": "store", "class": "App\Http\Controllers\Admin\RunCrudController", "type": "->" }, { "file": "/var/www/html/app/Http/Controllers/Admin/ThreadCrudController.php", "line": 146, "function": "store", "class": "App\Http\Controllers\Admin\MessageCrudController", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php", "line": 54, "function": "store", "class": "App\Http\Controllers\Admin\ThreadCrudController", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php", "line": 43, "function": "callAction", "class": "Illuminate\Routing\Controller", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 259, "function": "dispatch", "class": "Illuminate\Routing\ControllerDispatcher", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 205, "function": "runController", "class": "Illuminate\Routing\Route", "type": "->" }, { "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 806, "function": "run", "class": "Illuminate\Routing\Route", "type": "->" ] }

The error is on line 63 In Httptransporter.php. When i dump $contents i retrieve the requested data.

Steps To Reproduce

-

OpenAI PHP Client Version

^0.8.4

PHP Version

8.3.4

Notes

No response

nunomaduro commented 2 months ago

That's not a bug from our library.