xtekky / gpt4free

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

blackbox ai serves wrong model #2366

Closed DarkReaperBoy closed 1 week ago

DarkReaperBoy commented 2 weeks ago

i think this image explains enough. image

worth mentioning but not going to open separate issue over it: few models that are present in gui ain't in api version of g4f. like qwen coder in huggingface chat.

hlohaus commented 1 week ago

I have successfully updated the Blackbox provider and its model list.

DarkReaperBoy commented 1 week ago

@hlohaus i mean...

gui:

An error occured: Blackbox: UnboundLocalError: cannot access local variable 'logs' where it is not associated with a value

cli:

ERROR:g4f.gui.server.api:cannot access local variable 'logs' where it is not associated with a value
Traceback (most recent call last):
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 179, in _create_response_stream
    if logs:
       ^^^^
UnboundLocalError: cannot access local variable 'logs' where it is not associated with a value
127.0.0.1 - - [19/Nov/2024 20:19:23] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
ERROR:g4f.gui.server.api:cannot access local variable 'logs' where it is not associated with a value
Traceback (most recent call last):
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 179, in _create_response_stream
    if logs:
       ^^^^
UnboundLocalError: cannot access local variable 'logs' where it is not associated with a value
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fa745b43650>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fa7452abb90>
127.0.0.1 - - [19/Nov/2024 20:19:31] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
ERROR:g4f.gui.server.api:cannot access local variable 'logs' where it is not associated with a value
Traceback (most recent call last):
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 179, in _create_response_stream
    if logs:
       ^^^^
UnboundLocalError: cannot access local variable 'logs' where it is not associated with a value
127.0.0.1 - - [19/Nov/2024 20:19:48] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
ERROR:g4f.gui.server.api:cannot access local variable 'logs' where it is not associated with a value
Traceback (most recent call last):
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 179, in _create_response_stream
    if logs:
       ^^^^
UnboundLocalError: cannot access local variable 'logs' where it is not associated with a value
hlohaus commented 1 week ago

Hey, I just fixed the "cannot access local variable" issue in the latest update.

DarkReaperBoy commented 1 week ago

@hlohaus updated again, this time however... image it doesn't know to space? also, thanks for your time :pray:

DarkReaperBoy commented 1 week ago

also, during testing noticed that it generates the image link, but doesn't display: image

hlohaus commented 1 week ago

Yeah, it's not working for me either.

DarkReaperBoy commented 1 week ago

@hlohaus hai, so sonnet works fine (first message though, will use it for my programming classes), tysvm :heart: just tested blackbox images for sake of it and wanted to report :pray: image

hlohaus commented 1 week ago

Hey @DarkReaperBoy, can you send me the stack trace from your terminal for that exception? I just tested it again and it's working fine on my end.

DarkReaperBoy commented 1 week ago

Hey @DarkReaperBoy, can you send me the stack trace from your terminal for that exception? I just tested it again and it's working fine on my end.

@hlohaus hai, sure, take a look:

ERROR:g4f.gui.server.api:Invalid image format (from magic code).
Traceback (most recent call last):
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 176, in _create_response_stream
    images = asyncio.run(self._copy_images(chunk.get_list(), chunk.options.get("cookies")))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nako/.conda/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/nako/.conda/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nako/.conda/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 211, in _copy_images
    return await asyncio.gather(*[copy_image(image) for image in images])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/gui/server/api.py", line 205, in copy_image
    extension = is_accepted_format(f.read(12)).split("/")[-1]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nako/.conda/lib/python3.12/site-packages/g4f/image.py", line 124, in is_accepted_format
    raise ValueError("Invalid image format (from magic code).")
ValueError: Invalid image format (from magic code).
hlohaus commented 1 week ago

@DarkReaperBoy

The Blackbox is returning non-image files in your case, as indicated by the error message. However, the image generation feature is functioning properly for me.

DarkReaperBoy commented 1 week ago

makes sense since i'm in tourist in a sanctioned country. will look for bugs in g4f once outta the country.

DarkReaperBoy commented 1 week ago

@hlohaus literally same issue again in version 0.3.6.3 image sad to see as blackbox is the only sonnet provider that isn't annoyingly ratelimited (note: speaking of which, it was set on auto and picked blackbox, not me.)