poe-platform / fastapi_poe

A helper library for writing Poe API bots using FastAPI
Apache License 2.0
135 stars 25 forks source link

You have exceeded rate limit to query bot using User API Key. Try again later. #109

Closed liku-amare closed 3 months ago

liku-amare commented 3 months ago

I am working on a project to test translation performance of few LLMs on Low resourced languages (specifically, Amharic). While iterating through my source sentences and getting translations from GPT-3.5 for each sentence, the API returned this error at the 8th sentence.

Traceback (most recent call last):
  File "D:\...\...\API calls\get_translations_poe.py", line 63, in <module>
    returned_message = asyncio.run(get_responses(api_key, model, message_prompt))
  File "D:\Anaconda\envs\fastpoe\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\Anaconda\envs\fastpoe\lib\asyncio\base_events.py", line 647, in run_until_complete
    return future.result()
  File "D:\...\...\API calls\get_translations_poe.py", line 41, in get_responses
    async for partial in get_bot_response(
  File "D:\Anaconda\envs\fastpoe\lib\site-packages\fastapi_poe\client.py", line 350, in stream_request
    async for message in stream_request_base(
  File "D:\Anaconda\envs\fastpoe\lib\site-packages\fastapi_poe\client.py", line 483, in stream_request_base
    async for message in ctx.perform_query_request(
  File "D:\Anaconda\envs\fastpoe\lib\site-packages\fastapi_poe\client.py", line 229, in perform_query_request
    raise BotError(event.data)
fastapi_poe.client.BotError: {"allow_retry": true, "text": "You have exceeded rate limit to query bot using User API Key. Try again later."}

I have more than 900k remaining monthly points, so that shouldn't be the issue. I need to translate around 1000 sentence using each model, that is, 1000 iterations. If there is a better way to do this, your recommendations are welcome too. Thanks.

boxter007 commented 3 months ago

You called the api too fast ,try to add sleep(10).

liku-amare commented 3 months ago

Thanks, the sleep(10) solved the issue.

liku-amare commented 3 months ago

Thanks, the sleep(10) solved the issue.

this acually solves the issue temporarily. It gave me the same error after running for an hour or so. I think I have to wait for sometime and retry.

krisyang1125 commented 3 months ago

The get_bot_response is mainly for testing calling bots via API and would expect a much lower rate limit. If you want to do something like you mentioned in the issue, I would suggest creating a server bot, using stream_request calls and run your queries via poe.com, which does not get rate limited.

liku-amare commented 3 months ago

The get_bot_response is mainly for testing calling bots via API and would expect a much lower rate limit. If you want to do something like you mentioned in the issue, I would suggest creating a server bot, using stream_request calls and run your queries via poe.com, which does not get rate limited.

what do you mean by "run your queries via poe.com" ?

krisyang1125 commented 3 months ago

Meaning interacting with the bot via Poe, either using web or the native app on mobile.