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

TypeError when running FreeGPT4_Server.py #23

Closed
us254 opened this issue Oct 25, 2023 · 1 comment
Closed

TypeError when running FreeGPT4_Server.py #23

us254 opened this issue Oct 25, 2023 · 1 comment

Comments

@us254
Copy link

us254 commented Oct 25, 2023

While attempting to use FreeGPT4_Server.py, I encountered a TypeError. The error occurs when the server attempts to process a GET request.

The error message indicates that an issue arises in the create_message function of the Bing.py file, specifically when trying to use the "|" operator with two dictionaries. Here's the traceback for the error:

Traceback (most recent call last):
  File "/home/chris/.local/lib/python3.8/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/chris/.local/lib/python3.8/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/chris/.local/lib/python3.8/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/chris/.local/lib/python3.8/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/chris/.local/lib/python3.8/site-packages/asgiref/sync.py", line 277, in __call__
    return call_result.result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/home/chris/.local/lib/python3.8/site-packages/asgiref/sync.py", line 353, in main_wrap
    result = await self.awaitable(*args, **kwargs)
  File "FreeGPT4_Server.py", line 133, in index
    await PROVIDERS[args.provider].create_async(
  File "/home/chris/.local/lib/python3.8/site-packages/g4f/Provider/base_provider.py", line 122, in create_async
    return "".join([
  File "/home/chris/.local/lib/python3.8/site-packages/g4f/Provider/base_provider.py", line 122, in <listcomp>
    return "".join([
  File "/home/chris/.local/lib/python3.8/site-packages/g4f/Provider/Bing.py", line 447, in stream_generate
    await wss.send_str(create_message(conversation, prompt, tone, context))
  File "/home/chris/.local/lib/python3.8/site-packages/g4f/Provider/Bing.py", line 392, in create_message
    'message': Defaults.location | {
TypeError: unsupported operand type(s) for |: 'dict' and 'dict'

This error prevents the server from functioning as expected. Could you please provide guidance on how to resolve this issue?

@LyubomirT
Copy link

LyubomirT commented Feb 28, 2024

@us254 After inspecting the code, it seems that the issue is related to the G4F's Bing provider. Could you please let me know what version of g4f you have installed?

@aledipa aledipa closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants