Closed Zillion01 closed 10 months ago
Hi @Zillion01
You can already achieve this by passing your customised Guzzle client to the factory.
OpenAI::factory()
->withApiKey($apiKey)
->withOrganization($organization)
->withHttpClient(new \GuzzleHttp\Client(['timeout' => $timeout]))
->make();
Hi @gehrisandro
Thanks a lot, works great! 👍
I need to start using factory also :)
I agree that the workaround suggested does work, but would it not be better to implement it the other way so it is compatible with future versions? For example, now you have to add "->withHttpHeader('OpenAI-Beta', 'assistants=v1')" for this code to work. It would be great if we could pass more options when creating the client.
I noticed OpenAI (for example Chat) is sometimes unresponsive.
A Symfony command for example will hang then.
I would suggest to implement a timeout. Since this is easy with Guzzle. It would be nice to be able to do:
$client = \OpenAI::client($apiKey, $organization, $timeOut);
Also see https://docs.guzzlephp.org/en/stable/request-options.html#timeout
Thanks!