Skip to content
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 configuration support #45

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Conversation

gehrisandro
Copy link
Collaborator

This PR allows to configure the HTTP timeout via the openai.php configuration file.

    'request_timeout' => env('OPENAI_REQUEST_TIMEOUT', 30),

@gehrisandro gehrisandro mentioned this pull request May 27, 2023
return OpenAI::factory()
->withApiKey($apiKey)
->withOrganization($organization)
->withHttpClient(new \GuzzleHttp\Client(['timeout' => config('openai.request_timeout', 30)]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is possibly a breaking change:

  • If currently the requests are taking longer than 30 seconds
  • If there are other HTTP clients installed, it's currently maybe not using the Guzzle Client (I think this one is unlikely and even if so, it should not change the behaviour)

But anyway I suggest to create a new major release.

@gehrisandro gehrisandro merged commit 7a0978d into main Jun 14, 2023
@nunomaduro nunomaduro deleted the add-timeout-configuration branch June 14, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants