小编ops*_*psv的帖子

OpenAI GPT-3 API 错误:“请求超时”

我不断收到如下错误

Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out. (read timeout=600)

当我运行下面的代码时

def generate_gpt3_response(user_text, print_output=False):
    """
    Query OpenAI GPT-3 for the specific key and get back a response
    :type user_text: str the user's text to query for
    :type print_output: boolean whether or not to print the raw output JSON
    """
    time.sleep(5)
    completions = ai.Completion.create(
        engine='text-davinci-003',  # Determines the quality, speed, and cost.
        temperature=0.5,            # Level of creativity in the response
        prompt=user_text,           # What the user typed in
        max_tokens=150,             # Maximum …
Run Code Online (Sandbox Code Playgroud)

python openai-api gpt-3

9
推荐指数
1
解决办法
2万
查看次数

如何删除除字符串之间的特殊字符 (+) 之外的特殊字符?

我想根据一些规则删除数据中的“+”。

假设我的数据如下所示

++
+coke
coke+burger+
+
coke+burger+fries
coke+burger+fries+
Run Code Online (Sandbox Code Playgroud)

在这里,我希望最终处理的数据如下所示,以便所有不在字符串之间的“+”都被删除。

coke
coke+burger
coke+burger+fries
coke+burger+fries
Run Code Online (Sandbox Code Playgroud)

谢谢。

我尝试删除特殊字符,但它删除了所有“+”。

python special-characters

0
推荐指数
1
解决办法
52
查看次数

标签 统计

python ×2

gpt-3 ×1

openai-api ×1

special-characters ×1