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

apikey访问频率问题 #19

Open
reckonzzz opened this issue Apr 23, 2023 · 2 comments
Open

apikey访问频率问题 #19

reckonzzz opened this issue Apr 23, 2023 · 2 comments

Comments

@reckonzzz
Copy link

openai.error.RateLimitError: Rate limit reached for default-gpt-3.5-turbo in organization org-PanV93eoQzPe3QALIzkJ8Iof on requests per min. Limit: 3 / min. Please try again in 20s.

请问这是因为访问频率过快吗?怎么解决这个问题呢?

@talkingwallace
Copy link
Owner

看起来是的 要不等一阵再试试看 或者降低一下发送频率

@namasikanam
Copy link

namasikanam commented Jun 17, 2023

改一下 gpt_reader/bot/openai.pyOpenAIBotCore 这个类的 communicate 函数就好了。

def communicate(self, msg: List[dict], return_raw_text=True):
    received = False
    while not received:
        try:
            response = openai.ChatCompletion.create(
                model=self.model,
                messages=msg,
                temperature=self.temperature
            )
        except openai.error.RateLimitError:
            time.sleep(20)
        else:
            received = True

    if return_raw_text:
        return response["choices"][0]["message"]["content"]
    else:
        return response

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