Agora-X / Bing-Chat-API

An unofficial API for Bing Chat (GPT4)
The Unlicense
91 stars 17 forks source link

[Bug]: SyntaxError with package name #1

Open katanhich opened 10 months ago

katanhich commented 10 months ago

Is there an existing issue for this?

What happened?

Hi @ZackBradshaw I cant not import bing-chat due to SyntaxError. Here is the result:

from bing-chat import BingChat
         ^

SyntaxError: invalid syntax

Steps to reproduce the problem

from bing-chat import BingChat

What should have happened?

It should be imported properly

Version where the problem happens

1.9.4

What Python version are you running this with?

3.9

What is your operating system ?

Windows

Command Line Arguments

NO

Console logs

from bing-chat import BingChat
             ^
SyntaxError: invalid syntax

Additional information

No response

ZackBradshaw commented 10 months ago

Thanks for your issue report. I'm switching over to a more unified method for the pip package hopefully this will solve your issues . I'll ping you when this is done :)

marina-yurieva commented 9 months ago

I have the same issue. What's the fix for it?

dogweather commented 8 months ago

Has anyone found a workaround?

YashIngole commented 8 months ago

found any fix yet?

dogweather commented 8 months ago

I forked the repo, fixed this, and then found a ton of other issues. There's no test suite, so it's hard to know what works and what doesn't. I stopped after investing an hour of work.

farrukh-aftab-ahmed commented 7 months ago

Replace your code with this code.

import logging
from bing_chat import BingGPT
import asyncio

async def main():
    logging.basicConfig(level=logging.INFO)
    c = BingGPT.Chatbot()
    response = await c.ask("Hello, how are you?")
    messages = response['item']['messages']
    print("Chat history:", messages)
asyncio.run(main())
catpupu commented 6 months ago

Replace your code with this code.

import logging
from bing_chat import BingGPT
import asyncio

async def main():
    logging.basicConfig(level=logging.INFO)
    c = BingGPT.Chatbot()
    response = await c.ask("Hello, how are you?")
    messages = response['item']['messages']
    print("Chat history:", messages)
asyncio.run(main())

I got this error

Traceback (most recent call last):

  File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File c:\users\lucas\.spyder-py3\temp.py:18
    asyncio.run(main())

  File ~\anaconda3\Lib\asyncio\runners.py:186 in run
    raise RuntimeError(

RuntimeError: asyncio.run() cannot be called from a running event loop