xtekky / gpt4free

The official gpt4free repository | various collection of powerful language models
https://g4f.ai
GNU General Public License v3.0
61.1k stars 13.31k forks source link

g4f.errors.RetryProviderError #2023

Closed AlenaSapfirova closed 5 months ago

AlenaSapfirova commented 5 months ago

Hello! Help me please. I get error

UserWarning: Curlm alread closed! quitting from process_data warnings.warn("Curlm alread closed! quitting from process_data") ERROR:aiogram.event:Cause exception while process update id=21758054 by bot id=6063358722 RetryProviderError: RetryProvider failed: Feedough: ClientResponseError: 403, message='Forbidden', url=URL('https://www.feedough.com/wp-admin/admin-ajax.php') Aichatos: ClientConnectorError: Cannot connect to host api.binjie.fun:443 ssl:default [getaddrinfo failed] ChatgptNext: ClientResponseError: 429, message='Too Many Requests', url=URL('https://chat.fstha.com/api/openai/v1/chat/completions') Cnote: ClientResponseError: 404, message='Not Found', url=URL('https://p1api.xjai.pro/freeapi/chat-process') OpenaiChat: CloudflareError: Response 403: Cloudflare detected You: CloudflareError: Response 403: Cloudflare detected Traceback (most recent call last): File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 309, in _process_update response = await self.feed_update(bot, update, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 158, in feed_update response = await self.update.wrap_outer_middleware( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\middlewares\error.py", line 25, in call return await handler(event, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\middlewares\user_context.py", line 49, in call return await handler(event, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\fsm\middleware.py", line 42, in call return await handler(event, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\event\telegram.py", line 121, in trigger return await wrapped_inner(event, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\event\handler.py", line 43, in call return await wrapped() ^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\dispatcher.py", line 276, in _listen_update return await self.propagate_event(update_type=update_type, event=event, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\router.py", line 142, in propagate_event return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\router.py", line 137, in _wrapped return await self._propagate_event( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\router.py", line 170, in _propagate_event response = await router.propagate_event(update_type=update_type, event=event, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\router.py", line 142, in propagate_event return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\router.py", line 137, in _wrapped return await self._propagate_event( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\router.py", line 162, in _propagate_event response = await observer.trigger(event, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\event\telegram.py", line 121, in trigger return await wrapped_inner(event, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\aiogram\dispatcher\event\handler.py", line 43, in call return await wrapped() ^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\config_data\handlers\handlers.py", line 68, in add_new_request response = await gpt.generate_post_gpt4(message.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\config_data\gpt\gpt_services.py", line 38, in generate_post_gpt4 response = await client_gpt4.chat.completions.create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Dev\Orders\instabot\venv\Lib\site-packages\g4f\client\async_client.py", line 71, in iter_append_model_and_provider async for chunk in response: File "C:\Dev\Orders\instabot\venv\Lib\site-packages\g4f\client\async_client.py", line 42, in iter_response async for chunk in response: File "C:\Dev\Orders\instabot\venv\Lib\site-packages\g4f\providers\retry_provider.py", line 143, in create_async_generator raise_exceptions(exceptions) File "C:\Dev\Orders\instabot\venv\Lib\site-packages\g4f\providers\retry_provider.py", line 324, in raise_exceptions raise RetryProviderError("RetryProvider failed:\n" + "\n".join([ g4f.errors.RetryProviderError: RetryProvider failed: Feedough: ClientResponseError: 403, message='Forbidden', url=URL('https://www.feedough.com/wp-admin/admin-ajax.php') Aichatos: ClientConnectorError: Cannot connect to host api.binjie.fun:443 ssl:default [getaddrinfo failed] ChatgptNext: ClientResponseError: 429, message='Too Many Requests', url=URL('https://chat.fstha.com/api/openai/v1/chat/completions') Cnote: ClientResponseError: 404, message='Not Found', url=URL('https://p1api.xjai.pro/freeapi/chat-process') OpenaiChat: CloudflareError: Response 403: Cloudflare detected You: CloudflareError: Response 403: Cloudflare detected

my code

client_gpt4 = AsyncClient(

This is the default and can be omitted

api_key=os.getenv("OPENAI_API_KEY"),

) async def generate_post_gpt4(promt): response = await client_gpt4.chat.completions.create( model="gpt-3.5-turbo", messages=[{"role": "user", "content": promt}] ) print(response) return response.choices[0].message.content

What I doing wrong?

AlenaSapfirova commented 5 months ago

add some information I m change my code (without api_key open ai) from g4f.client import AsyncClient import asyncio import sys

if sys.platform.startswith('win'): asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

async def generate_post(promt): client = AsyncClient() response = await client.chat.completions.create( model="gpt-3.5-turbo", messages=[{"role": "user", "content": promt}], )

print(response.choices[0].message.content)

I get the same error. I have seen one handling of this error. And there it arose due to the long inactivity of the bot, but in my case the bot was launched a couple of minutes ago just for the test

github-actions[bot] commented 5 months ago

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

github-actions[bot] commented 5 months ago

Closing due to inactivity.