Open
Description
Description
Hello, I'm running this code:
`use OpenAI\Laravel\Facades\OpenAI;
$yourApiKey = getenv('OPENAI_API_KEY');
$org = getenv('OPENAI_ORGANIZATION');
$client = OpenAI::client($yourApiKey, $org);
$result = $client->chat()->create([
'model' => 'gpt-4',
'messages' => [
['role' => 'user', 'content' => 'Hello!'],
],
]);
echo $result->choices[0]->message->content;
`
ENV is OK, the API works Okay when I use chat() function, but I need to create an assistant.
The error is that the client() method is not found (Call to undefined method OpenAI\Client::client()), but in vscode I can click on it and see the code, so it exists, obviously I installed both Client and Laravel packages and ran composer install and update after.
Steps To Reproduce
Install composer packages, setup env variables and run this code:
`
use OpenAI\Laravel\Facades\OpenAI;
$yourApiKey = getenv('OPENAI_API_KEY');
$org = getenv('OPENAI_ORGANIZATION');
$client = OpenAI::client($yourApiKey, $org);
$result = $client->chat()->create([
'model' => 'gpt-4',
'messages' => [
['role' => 'user', 'content' => 'Hello!'],
],
]);
echo $result->choices[0]->message->content;`
OpenAI PHP Client Version
latest
PHP Version
8.3.16
Notes
No response