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]: Call to undefined method OpenAI\Client::factory() in Laravel #329

Closed agiche closed 5 months ago

agiche commented 5 months ago

Description

Hi team,

We get the following error when trying to set different client. Call to undefined method OpenAI\Client::factory()

Composer info:"openai-php/laravel": "^0.6.0",

Steps To Reproduce

Install "openai-php/laravel" over composer.

use OpenAI\Laravel\Facades\OpenAI; Try to set a client using the example code provided in the docs.

OpenAI PHP Client Version

"openai-php/laravel": "^0.6.0",

PHP Version

8.1.18

Notes

No response

gehrisandro commented 5 months ago

Hi @agiche

Please make sure you are using the latest version (v0.8.x) and you don't have to you the factory. You can use the endpoint directly on the facade. See https://github.com/openai-php/laravel?tab=readme-ov-file#get-started

If this does not help, feel free to reopen the issue.