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

ERROR:root:'async for' requires an object with __aiter__ method #2319

Open
MH140000 opened this issue Oct 31, 2024 · 9 comments
Open

ERROR:root:'async for' requires an object with __aiter__ method #2319

MH140000 opened this issue Oct 31, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@MH140000
Copy link

when i want use api after i send a message with openai lib, i got this error in log:
ERROR:root:'async for' requires an object with aiter method, got generator
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/g4f/api/init.py", line 198,
in streaming
async for chunk in response:
TypeError: 'async for' requires an object with aiter method, got generator

@MH140000
Copy link
Author

How can fix this?

@hqnicolas
Copy link

hqnicolas commented Oct 31, 2024

@MH140000
https://github.com/hqnicolas/continue4free
https://github.com/kqlio67/gpt4free
give a star

@MH140000
Copy link
Author

thanks very much

@ahmedashraf443
Copy link

Did you manage to fix it ?

@MH140000
Copy link
Author

MH140000 commented Nov 5, 2024

@kqvanity
Copy link

kqvanity commented Nov 8, 2024

@hqnicolas
Can either solution make a pr?

@DaVinchik
Copy link

I installed the latest version of the repository, when I try to use it through the API, I get this error:

Traceback (most recent call last):
  File "/app/g4f/api/__init__.py", line 198, in streaming
    async for chunk in response:
                       ^^^^^^^^
TypeError: 'async for' requires an object with __aiter__ method, got generator

I see that the error was fixed with previous updates, I also see that recommendations are given above, but I personally did not understand how to fix the error.
P.S. In general, I use it installed via Pip, I decided that this was the problem and installed the source, and then also tried to check it via Docker. This did not help cure the problem.

@hqnicolas
Copy link

@hqnicolas
Copy link

@hqnicolas Can either solution make a pr?

@kqvanity take this file and create a pull request....
https://github.com/hqnicolas/continue4free/blob/main/g4f/api/__init__.py
It's fix the problem....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants
@MH140000 @ahmedashraf443 @hqnicolas @DaVinchik @kqvanity @xtekky and others