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] AttributeError: 'IterListProvider' object has no attribute 'get_parameters' #2520

Open
blacsheep opened this issue Dec 30, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@blacsheep
Copy link

Bug description
go to the web page, toggle web search button, request "who are you?".

image

Environment
deployed by "docker-compose up -d"

The debugging info:

Web search: 'who are you?...' 5 Results 2057 Words
Debugging middleware caught exception in streamed response at a point where response headers were already sent.
Traceback (most recent call last):
  File "/home/g4f/.local/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__
    return self._next()
           ^^^^^^^^^^^^
  File "/home/g4f/.local/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
    for item in iterable:
                ^^^^^^^^^
  File "/app/g4f/gui/server/api.py", line 142, in _create_response_stream
    **provider_handler.get_parameters(as_json=True),
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'IterListProvider' object has no attribute 'get_parameters'. Did you mean: 'get_providers'?
@blacsheep blacsheep added the bug Something isn't working label Dec 30, 2024
@Taurinz359
Copy link

same

1 similar comment
@Kodiman1402
Copy link

same

@hmenke
Copy link

hmenke commented Dec 31, 2024

Possible patch:

diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index ca80f7f3..8b929ce4 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -138,8 +138,12 @@ class Api:
             ignore_stream=True,
             logging=False
         )
+        provider = provider_handler.get_providers(
+            stream=kwargs.get("stream", True),
+            ignored=kwargs.get("ignored", []),
+        )[0]
         params = {
-            **provider_handler.get_parameters(as_json=True),
+            **provider.get_parameters(as_json=True),
             "model": model,
             "messages": kwargs.get("messages"),
             "web_search": kwargs.get("web_search")

@jaypyles
Copy link

Possible patch:

diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index ca80f7f3..8b929ce4 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -138,8 +138,12 @@ class Api:
             ignore_stream=True,
             logging=False
         )
+        provider = provider_handler.get_providers(
+            stream=kwargs.get("stream", True),
+            ignored=kwargs.get("ignored", []),
+        )[0]
         params = {
-            **provider_handler.get_parameters(as_json=True),
+            **provider.get_parameters(as_json=True),
             "model": model,
             "messages": kwargs.get("messages"),
             "web_search": kwargs.get("web_search")

Worked for me 👍

@p1aintiff
Copy link

Possible patch:

diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index ca80f7f3..8b929ce4 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -138,8 +138,12 @@ class Api:
             ignore_stream=True,
             logging=False
         )
+        provider = provider_handler.get_providers(
+            stream=kwargs.get("stream", True),
+            ignored=kwargs.get("ignored", []),
+        )[0]
         params = {
-            **provider_handler.get_parameters(as_json=True),
+            **provider.get_parameters(as_json=True),
             "model": model,
             "messages": kwargs.get("messages"),
             "web_search": kwargs.get("web_search")

make it

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