-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Add Timeout Param #39
Comments
Can you make a pull request adding that feature? |
Hmmm, it doesn't even look like the PSR7 lib that is used here to make HTTP calls supports timeouts at all if I'm looking through their code correctly? Would potentially require a wrapper around the requests to handle this since it's not supported native. |
Might it be possible to use one of these options?
Afterall a Guzzle Client is being used by the OpenAI Class |
This can now be achieved by using the newly introduced factory: $client = OpenAI::factory()
->withHttpClient(new \GuzzleHttp\Client(['timeout' => 2.0]))
->make(); |
The official Python library allows a timeout to be set on requests. It would be really helpful for production applications to be able to set up a timeout on requests so we don't keep our web workers hanging if there is hiccups in connections or issues on the OpenAI side.
The text was updated successfully, but these errors were encountered: