gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

OpenAI style Api on port 1337 doesn't work

Open Wu-jiyan opened this issue 1 year ago • 7 comments

Bug description I deployed this project with docker on a Hong Kong server. When I updated the image to 0.3.10. The api on port 1337 cannot work porperly. Though ai can answer on the site on port 8080. (My English isn't very good😢)

Environment

  • docker image version: 0.3.10
  • location: Hong Kong

Additional context

ERROR:root:RetryProvider failed:
Bing: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Liaobots: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Traceback (most recent call last):
  File "/app/g4f/api/__init__.py", line 165, in streaming
    async for chunk in response:
  File "/app/g4f/client/async_client.py", line 63, in iter_append_model_and_provider
    async for chunk in response:
  File "/app/g4f/client/async_client.py", line 37, in iter_response
    async for chunk in response:
  File "/app/g4f/client/helper.py", line 46, in cast_iter_async
    for chunk in iter:
  File "/app/g4f/providers/retry_provider.py", line 95, in create_completion
    raise_exceptions(exceptions)
  File "/app/g4f/providers/retry_provider.py", line 231, in raise_exceptions
    raise RetryProviderError("RetryProvider failed:\n" + "\n".join([
g4f.errors.RetryProviderError: RetryProvider failed:
Bing: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Liaobots: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
INFO:     154.64.252.2:44614 - "POST /v1/chat/completions HTTP/1.1" 200 OK
ERROR:root:RetryProvider failed:
Liaobots: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Bing: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Traceback (most recent call last):
  File "/app/g4f/api/__init__.py", line 165, in streaming
    async for chunk in response:
  File "/app/g4f/client/async_client.py", line 63, in iter_append_model_and_provider
    async for chunk in response:
  File "/app/g4f/client/async_client.py", line 37, in iter_response
    async for chunk in response:
  File "/app/g4f/client/helper.py", line 46, in cast_iter_async
    for chunk in iter:
  File "/app/g4f/providers/retry_provider.py", line 95, in create_completion
    raise_exceptions(exceptions)
  File "/app/g4f/providers/retry_provider.py", line 231, in raise_exceptions
    raise RetryProviderError("RetryProvider failed:\n" + "\n".join([
g4f.errors.RetryProviderError: RetryProvider failed:
Liaobots: ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Bing: ValueError: Can't patch loop of type <class 'uvloop.Loop'>

Wu-jiyan avatar May 07 '24 13:05 Wu-jiyan

This is independent of the release version. Somehow the repositories have been updated and any release will contain this error. You can “fix” this by replacing the site-packages directory taken from the earlier venv in gpt4free/.venv/lib/python3.9/. It helped me. But I didn’t understand exactly which software was updated and which one needed to be rolled back. If you figure it out, please indicate a specific lib. Most likely, you need to edit the requirements.txt file indicating the version of this lib.

al-1-fenix avatar May 09 '24 11:05 al-1-fenix

I'm also facing same problem. v0.3.0.8 is working fine.

Mahesh0253 avatar May 09 '24 11:05 Mahesh0253

i have the same problem

sharemen avatar May 10 '24 08:05 sharemen

I have the same problem too!

asiryan avatar May 12 '24 22:05 asiryan

I have the same problem too!

1xiongyuwen1 avatar May 13 '24 02:05 1xiongyuwen1

Me too ,Have u solved this problem?

cloudygtosis avatar May 13 '24 14:05 cloudygtosis

loop='asyncio'

AHiXilTOr avatar May 13 '24 16:05 AHiXilTOr

I fixed the uvloop issue.

hlohaus avatar May 19 '24 01:05 hlohaus