rakyll/openai-go

Client.Timeout or context cancellation while reading body

teslapatrick opened this issue · 1 comments

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)

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

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