Open qimo2020 opened 1 year ago
hello
Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)”
codes:
httpClient := &http.Client{ Timeout: time.Duration(600 * time.Second), } client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))
I used streaming call(client.CompletionStreamWithEngine), but the problem was not solved
Recently I started having this problem too, even if on curl request the request is working properly (ie is not an outage from openAI). Do you guys have any clue?
@qimo2020 to fix this you just need to set a timeout to their client when instantiating it, like in the example below:
client := gpt3.NewClient(apiKey, gpt3.WithTimeout(time.Second*300))
If you dont set a custom timeout, will be used their standard timeout time which is 30 seconds (you can read the snippet here)
hello The code reported an error: “context deadline exceeded (Client.Timeout or context cancellation while reading body)”