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

Client.Timeout or context cancellation while reading body #14

Closed
teslapatrick opened this issue Mar 13, 2023 · 1 comment
Closed

Client.Timeout or context cancellation while reading body #14

teslapatrick opened this issue Mar 13, 2023 · 1 comment

Comments

@teslapatrick
Copy link

Timeout: 30 * time.Second,

Can we increase the timeout period or set the environmental variable? Sometimes there will be a timeout when encountering extensive data.

Failed to complete: context deadline exceeded (Client.Timeout or context cancellation while reading body)
@rakyll
Copy link
Owner

rakyll commented Mar 13, 2023

You can provide a custom timeout by using a custom HTTPClient.

sess := openai.NewSession(....)
sess.HTTPClient = &http.Client{
         Timeout: 120 * time.Second,
}

@rakyll rakyll closed this as completed Mar 13, 2023
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

No branches or pull requests

2 participants