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

context deadline exceeded (Client.Timeout or context cancellation while reading body) #21

Closed
hcws opened this issue Jan 31, 2023 · 4 comments

Comments

@hcws
Copy link

hcws commented Jan 31, 2023

when I ask a complex question , It will random interrupt.

请输入你的问题(quit 离开): 帮我写个关于 c++ 基础知识的博客

C++是一种面向对象的编程语言,它是一种多范式的编程语言,可以用于开发桌面应用程序、移动应用程序、服务器应用程序、游戏开发等。C++是一种非常强大的编程语言,它拥有非常强大的功能,可以帮助开发者实现复杂的功能。

C++的基础知识包括:

数据类型:C++支持多种数据类型,包括基本数据类型(int、float、char等)、枚举类型、结构体、类等。

变量:变量是程序中用于存储数据的容器,它们可以是基本数据类型,也可以是复合数据类型,如结构体和类。

运算符:C++支持多种运算符,包括算术运算符、关系运算符、逻辑运算符、位运算符等。

控制语句:C++支持多种控制语句,包括if-else、switch-case、while、do-while、for等。

函数:函数是程序中的一种重要组成部分,它可以实现特定功能,并且可以被多次调用。

模板:模板是C++中的一种重要概念,它可以帮助开发者实现代码的复用,提高程序的可维护性。context deadline exceeded (Client.Timeout or context cancellation while reading body)
@thegeorgenikhil
Copy link

Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out.
The default HTTP client provided has a timeout of 30 seconds

Making a custom HTTP client and setting a longer timeout solved it.

// passing a custom http client with a timeout of 600 seconds
// this is required because the default http client has a timeout of 30 seconds
httpClient := &http.Client{
      Timeout: time.Duration(600 * time.Second),
}
client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))

@qimo2020
Copy link

Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out. The default HTTP client provided has a timeout of 30 seconds

Making a custom HTTP client and setting a longer timeout solved it.

// passing a custom http client with a timeout of 600 seconds
// this is required because the default http client has a timeout of 30 seconds
httpClient := &http.Client{
      Timeout: time.Duration(600 * time.Second),
}
client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))

hello
Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)”
I used streaming call(client.CompletionStreamWithEngine), but the problem was not solved

@hcws
Copy link
Author

hcws commented Feb 18, 2023 via email

@qimo2020
Copy link

解决了,非常感谢

---Original--- From: @.> Date: Sat, Feb 18, 2023 18:53 PM To: @.>; Cc: @.@.>; Subject: Re: [PullRequestInc/go-gpt3] context deadline exceeded(Client.Timeout or context cancellation while reading body) (Issue #21) Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out. The default HTTP client provided has a timeout of 30 seconds Making a custom HTTP client and setting a longer timeout solved it. // passing a custom http client with a timeout of 600 seconds // this is required because the default http client has a timeout of 30 seconds httpClient := &http.Client{ Timeout: time.Duration(600 * time.Second), } client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient)) hello Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)” I used streaming call(client.CompletionStreamWithEngine), but the problem was not solved — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

你好,请问你的是流式调用么

@hcws hcws closed this as completed Feb 22, 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

3 participants