acheong08 / edgegpt Goto Github PK
View Code? Open in Web Editor NEWReverse engineered API of Microsoft's Bing Chat AI
License: The Unlicense
Reverse engineered API of Microsoft's Bing Chat AI
License: The Unlicense
Is this the normal speed of edge/binggpt? or am I doing something wrong?
I have to wait like 1-2min for a simple respond like: Hello I'm bing search, how can I help you?
File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/EdgeGPT.py", line 154, in __init__
conversation_signature=conversation.struct["conversationSignature"],
KeyError: 'conversationSignature'
— OS:linux
— python version:Python 3.10.4
python3 -m EdgeGPT -h
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong
!help for help
Type !exit to exit
Enter twice to send message
Initializing...
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 130, in init
self.struct = response.json()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 309, in
asyncio.run(main())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 270, in main
await bot.start()
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 216, in start
self.conversation = Conversation()
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 132, in init
raise Exception("Authentication failed. You have not been accepted into the beta.") from json.decoder.JSONDecodeError
TypeError: JSONDecodeError.init() missing 3 required positional arguments: 'msg', 'doc', and 'pos'
Bot:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/EdgeGPT.py", line 294, in
asyncio.run(main())
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/EdgeGPT.py", line 274, in main
(await bot.ask(prompt=prompt))["item"]["messages"][1]["adaptiveCards"][0][
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/EdgeGPT.py", line 210, in ask
return await self.chat_hub.ask(prompt=prompt)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/EdgeGPT.py", line 170, in ask
self.wss = await websockets.connect("wss://sydney.bing.com/sydney/ChatHub")
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/websockets/legacy/client.py", line 659, in await_impl_timeout
return await asyncio.wait_for(self.await_impl(), self.open_timeout)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 478, in wait_for
return fut.result()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/websockets/legacy/client.py", line 663, in await_impl
_transport, _protocol = await self._create_connection()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1111, in _create_connection_transport
await waiter
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/sslproto.py", line 528, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 944, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
{'value': 'Throttled', 'message': 'Request is throttled.', 'error': 'Request is throttled.', 'serviceVersion': '20230219.8'}}}
When I use the api multiple times, the request is throttled
code:
import asyncio
from EdgeGPT import Chatbot
async def main():
bot = Chatbot(cookiePath='cookie.txt')
print((await bot.ask(prompt="hello,who are you?")))
await bot.close()
if __name__ == "__main__":
asyncio.run(main())
error:
{'type': 2, 'invocationId': '0', 'item': {'firstNewMessageIndex': None, 'conversationId': '51D|BingProd|7AA9DBBD86992941648A09E8BEFF084C9D8C3B6DA01F5E929CC2ABD7B4E3B0D1', 'requestId': 'f2fe4018-cfec-430d-ae43-7f753881dde9', 'telemetry': {'metrics': None, 'startTime': '2023-02-22T03:11:44.2953465Z'}, 'result': {'value': 'Throttled', 'message': 'Request is throttled.', 'error': 'Request is throttled.', 'serviceVersion': '20230221.134'}}}
You can also use async request
I've looked through several closed issues, my issue is not included.
I'm sure I have the access to new bing.
This exception occurs from time to time. And as I looked through my cookie, I can not find _U anywhere (neither on chrome nor edge).
Chrome: www.bing.com
Edge: www.bing.com
Is this causing the issue?
— OS:linux
— python version:Python 3.10.4
python3 -m EdgeGPT -h
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong
!help for help
Type !exit to exit
Enter twice to send message
Initializing...
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 130, in init
self.struct = response.json()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 309, in
asyncio.run(main())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 270, in main
await bot.start()
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 216, in start
self.conversation = Conversation()
File "/usr/local/lib/python3.10/site-packages/EdgeGPT.py", line 132, in init
raise Exception("Authentication failed. You have not been accepted into the beta.") from json.decoder.JSONDecodeError
TypeError: JSONDecodeError.init() missing 3 required positional arguments: 'msg', 'doc', and 'pos'
Initializing...
Traceback (most recent call last):
File "C:\Users\ibrahim.l\Desktop\MicroEdgeGPT.py", line 61, in
asyncio.run(main())
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users\ibrahim.l\Desktop\MicroEdgeGPT.py", line 33, in main
bot = Chatbot()
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 213, in init
self.chat_hub: ChatHub = ChatHub(Conversation())
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 113, in init
open(os.environ.get("COOKIE_FILE"), "r", encoding="utf-8").read()
TypeError: expected str, bytes or os.PathLike object, not NoneType
python3 -m EdgeGPT
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong
!help for help
Type !exit to exit
Enter twice to send message
Initializing...
You:
Hi
Bot:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/EdgeGPT.py", line 351, in <module>
asyncio.run(main())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/EdgeGPT.py", line 317, in main
(await bot.ask(prompt=prompt))["item"]["messages"][1]["adaptiveCards"][0][
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/EdgeGPT.py", line 245, in ask
return await self.chat_hub.ask(prompt=prompt)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/EdgeGPT.py", line 171, in ask
self.wss = await websockets.connect("wss://sydney.bing.com/sydney/ChatHub")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websockets/legacy/client.py", line 659, in __await_impl_timeout__
return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
return fut.result()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websockets/legacy/client.py", line 663, in __await_impl__
_transport, _protocol = await self._create_connection()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
transport, protocol = await self._create_connection_transport(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
await waiter
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py", line 534, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 975, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
setup.cfg
references
license_files=LICENSE
But there is no file LICENSE
.
What is the license of this software?
Regards!
I'm in the waiting list of bing chat. Can use this project?
env: win10+python39
I do follow the readme,run developer code crash into bug:
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong
!help for help
Type !exit to exit
Enter twice to send message
Initializing...
Traceback (most recent call last):
File "D:\Users\dell\anaconda3\envs\python39\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "D:\Users\dell\anaconda3\envs\python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "D:\Users\dell\anaconda3\envs\python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Users\dell\anaconda3\envs\python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\e\project\shida\work\chat-group\chatgpt-test\bing_web\bingai.py", line 43, in <module>
asyncio.run(main())
File "D:\Users\dell\anaconda3\envs\python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\Users\dell\anaconda3\envs\python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\e\project\shida\work\chat-group\chatgpt-test\bing_web\bingai.py", line 10, in main
await bot.start()
File "D:\Users\dell\anaconda3\envs\python39\lib\site-packages\EdgeGPT.py", line 210, in start
self.conversation = Conversation()
File "D:\Users\dell\anaconda3\envs\python39\lib\site-packages\EdgeGPT.py", line 129, in __init__
self.struct = response.json()
File "D:\Users\dell\anaconda3\envs\python39\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Whether the alternate of bing-chat has no authority
i try to run it on replit and store the cookie in json, It doesn't seem safe
Is there any other way to login?
hello, this is bing. i'm sorry, but i cannot perform this task. it is beyond my capabilities as a chat mode of bing search. i can only help you with web searches, creative content, and general chat. 😔
Do we know what the capabilities are / aren't for this chatbot?
@acheong08 in the description for requirements it said something about the public cookies.json file, earlier in a another issue you said that you removed it. If that's true the description needs to be updated.
Hello!
How to continue a conversation instead of starting new chat? Is it possible to update Developer demo or write here how to pass conversion id into the next request?
Thank You
raceback (most recent call last):
File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 135, in __init__
self.struct = response.json()
File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 293, in <module>
asyncio.run(main())
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 254, in main
bot = Chatbot()
File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 203, in __init__
self.chat_hub: ChatHub = ChatHub(Conversation())
File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 137, in __init__
raise Exception(
TypeError: __init__() missing 3 required positional arguments: 'msg', 'doc', and 'pos'
Shouldn't reset
function use the same signature as the __init__
?
Current reset
https://github.com/acheong08/EdgeGPT/blob/master/src/EdgeGPT.py#L263 uses:
self.chat_hub = ChatHub(Conversation())
However, __init__
https://github.com/acheong08/EdgeGPT/blob/master/src/EdgeGPT.py#L235 uses:
self.chat_hub: ChatHub = ChatHub(Conversation(cookiePath))
I think it should use the same path used on object creation; it's looking for environment variable (fallback maybe?).
Traceback:
raceback (most recent call last):
File "/home/capitano/telegrambots/Edge-GPT-Telegram-Bot/venv/lib/python3.8/site-packages/telegram/ext/_application.py", line 1104, in process_update
await coroutine
File "/home/capitano/telegrambots/Edge-GPT-Telegram-Bot/venv/lib/python3.8/site-packages/telegram/ext/_handler.py", line 141, in handle_update
return await self.callback(update, context)
File "./edge.py", line 40, in new
await ut.CONV[cid][0].reset()
File "/home/capitano/telegrambots/Edge-GPT-Telegram-Bot/venv/lib/python3.8/site-packages/EdgeGPT.py", line 263, in reset
self.chat_hub = ChatHub(Conversation())
File "/home/capitano/telegrambots/Edge-GPT-Telegram-Bot/venv/lib/python3.8/site-packages/EdgeGPT.py", line 133, in __init__
f = open(os.environ.get("COOKIE_FILE"), encoding="utf-8").read()
TypeError: expected str, bytes or os.PathLike object, not NoneType
I am running the program but when starting it gives the following error
Traceback (most recent call last):
File "C:\Users\ibrahim.l\Desktop\MicroEdgeGPT.py", line 60, in
asyncio.run(main())
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users\ibrahim.l\Desktop\MicroEdgeGPT.py", line 33, in main
bot = Chatbot()
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 239, in init
self.chat_hub: ChatHub = ChatHub(Conversation())
File "C:\Users\ibrahim.l\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 154, in init
conversation_signature=conversation.struct["conversationSignature"],
KeyError: 'conversationSignature'
when I run the code given as example, it hints "Authentication failed"
File "/usr/local/Cellar/[email protected]/3.9.12_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/Cellar/[email protected]/3.9.12_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/Users/annlee/PycharmProjects/chatgpt.py", line 5, in main
bot = Chatbot()
File "/usr/local/lib/python3.9/site-packages/EdgeGPT.py", line 218, in init
self.chat_hub: ChatHub = ChatHub(Conversation())
File "/usr/local/lib/python3.9/site-packages/EdgeGPT.py", line 111, in init
raise Exception("Authentication failed")
Exception: Authentication failed
for cookie in cookie_file:
self.session.cookies.set(cookie["name"], cookie["value"])
# url = "https://www.bing.com/turing/conversation/create"
url="https://cn.bing.com/turing/conversation/create"
# Send GET request
response = self.session.get(
url,
timeout_seconds=30,
headers=headers,
)
Get the url https://www.bing.com/turing/conversation/create will get a 302 response which redirect to new url,The Authentication fail.
change the new url works.Maybe it’s about the region.
C:\Users\Harry>python -m EdgeGPT --bing-cookie <cookies>
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong
!help for help
Type !exit to exit
Enter twice to send message
Initializing...
You:
你好
Bot:
Traceback (most recent call last):
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 489, in finish_recv
return ov.getresult()
OSError: [WinError 64] 指定的网络名不再可用。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 333, in <module>
asyncio.run(main())
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 304, in main
async for final, response in bot.ask_stream(prompt=prompt):
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 232, in ask_stream
async for response in self.chat_hub.ask_stream(prompt=prompt):
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\site-packages\EdgeGPT.py", line 178, in ask_stream
self.wss = await websockets.connect("wss://sydney.bing.com/sydney/ChatHub")
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\client.py", line 659, in __await_impl_timeout__
return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 445, in wait_for
return fut.result()
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\client.py", line 663, in __await_impl__
_transport, _protocol = await self._create_connection()
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1097, in create_connection
transport, protocol = await self._create_connection_transport(
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1127, in _create_connection_transport
await waiter
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 286, in _loop_reading
length = fut.result()
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 821, in _poll
value = callback(transferred, key, ov)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 493, in finish_recv
raise ConnectionResetError(*exc.args)
ConnectionResetError: [WinError 64] 指定的网络名不再可用。
This is not an issue… more of a public service announcement on how to get access quickly and not be on the waitlist
Steps to get off waitlist (this worked for me)
It's working at the beginning, but after a while I got this error whenever I run EdgeGPT using command line or call the API
!help for help
Type !exit to exit
Enter twice to send message
Initializing...
Traceback (most recent call last):
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\util\connection.py", line 95, in create_connection
raise err
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\util\connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connection.py", line 179, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x00000264BDCE5450>, 'Connection to images.duti.tech timed out. (connect timeout=10)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='images.duti.tech', port=443): Max retries exceeded with url: /allow (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000264BDCE5450>, 'Connection to images.duti.tech timed out. (connect timeout=10)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 333, in
asyncio.run(main())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 278, in main
bot = Chatbot()
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 218, in init
self.chat_hub: ChatHub = ChatHub(Conversation())
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 109, in init
response = requests.post(url, timeout=10)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\adapters.py", line 553, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='images.duti.tech', port=443): Max retries exceeded with url: /allow (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000264BDCE5450>, 'Connection to images.duti.tech timed out. (connect timeout=10)'))
Same as Title. What's the rate limit per account and per IP address? Thanks for your time!
I ran normally on my personal computer, when i change a computer, it reported a bug. After checking it, I found that
conversation. struct={'result ': {'value': 'UnauthorizedRequest', 'message': 'Sorry, you need to login first to access this service.'}}
it led to
self. request=ChatHubRequest(
conversation_ signature=conversation.struct["conversationSignature"],
client_ id=conversation.struct["clientId"],
conversation_ id=conversation.struct["conversationId"],
)
Error.
Excuse me, is the version I downloaded too low or does it need other configurations?
Do you have any recommendations on how much this should be used?
I got some cases that require search results from BingSearch lead the wss.recv() got wrong data.
I reviewed the source code and think that was because in class ChatHub function ask_stream()
the response.get("type") == 2
condition was too weak. Also I found another project meet the same issue and suggested their solution from the link below:
https://github.com/waylaidwanderer/node-chatgpt-api/commit/dc3f1684e274ffd97f338e43c795fadad72a6835
bad cases belike: (this is what wss.recv() returns):
{
'type': 2,
'invocationId': '0',
'item': {
'firstNewMessageIndex': None,
'suggestedResponses': None,
'conversationId': '51D|BingProd|5F280A5594CD4BD12917A1F59CA185EACC15B51D34F2F1B896E037508390BC23',
'requestId': 'f4bd880d-618e-4be1-96cc-64994cf73505',
'telemetry': {
'metrics': None,
'startTime': '2023-02-13T11:31:37.6746944Z'
},
'result': {
'value': 'InternalError',
'message': 'Unhandled Dependency Failure: Bing',
'error': 'Unhandled Dependency Failure: Bing\n ---> ServiceClient failure for Bing',
'exception': 'Microsoft.TuringBot.Common.ServiceInternalError: Unhandled Dependency Failure: Bing\r\n ---> Microsoft.TuringBot.Common.ServiceClientException: ServiceClient failure for Bing\r\n ---> System.Net.Http.HttpRequestException: Failed to call "Bing" at "https://www.bing.com/api/v7/search?appid=[REDACTED]&q=%e4%ba%ac%e4%b8%9c%e7%9a%84%e8%b4%a6%e5%8f%b7%e5%ae%89%e5%85%a8%e6%9c%89%e4%bb%80%e4%b9%88%e4%bc%98%e5%8a%bf%ef%bc%9f&format=json&conversation=true&screenshotstyle=small&setLang=en-us&mkt=en-us". StatusCode=Redirect - ReasonPhrase=Found.\r\n at BotClientLibrary.ServiceClients.ServiceClient.SendHttpRequest(String url, HttpRequestMessage request, TelemetryScope scope, CancellationToken cancellationToken, String serviceName, ServiceClientOptions options) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\ServiceClients\\ServiceClient.cs:line 546\r\n at BotClientLibrary.ServiceClients.ServiceClient.Run(Conversation conversation, Message message, CancellationToken cancellationToken, BatchRequest batchRequest, ServiceClientOptions options) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\ServiceClients\\ServiceClient.cs:line 355\r\n --- End of inner exception stack trace ---\r\n at BotClientLibrary.ServiceClients.PassageFinder.PassageFinder.Run(Conversation conversation, Message message, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\ServiceClients\\PassageFinder\\PassageFinder.cs:line 138\r\n at BotClientLibrary.Extensions.DeepLeoOrchestrator.DoWebSearch(ExtensionResponse result, Conversation conversation, Message searchQueryMessage, DeepLeoConfiguration config, Dictionary`2 searchResultScenarioMapping, DeepLeoMessageFactory messageFactory, IEnumerable`1 searchResultFilters, RenderCardMessageFilter renderCardFilter, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\Extensions\\DeepLeoOrchestrator.cs:line 463\r\n at BotClientLibrary.Extensions.DeepLeoOrchestrator.RunDeepLeoEngine(ExtensionResponse result, Conversation conversation, TuringBotConfiguration config, Message message, DeepLeoMessageFactory messageFactory) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\Extensions\\DeepLeoOrchestrator.cs:line 336\r\n at BotClientLibrary.Extensions.DeepLeoOrchestrator.Run(ExtensionRequest request, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\Extensions\\DeepLeoOrchestrator.cs:line 149\r\n at BotClientLibrary.Extensions.ExtensionRunner.RunExtension(Conversation conversation, ExtensionConfig extension, ExtensionRequestOptions customOptions, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\Extensions\\ExtensionRunner.cs:line 375\r\n at BotClientLibrary.Extensions.ExtensionRunner.RunExtensions(Conversation conversation, CancellationToken cancellationToken, ComponentPriority minPriority, ComponentPriority maxPriority, ExtensionRequestOptions customOptions) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\Extensions\\ExtensionRunner.cs:line 99\r\n at BotClientLibrary.ServiceClients.Orchestrator.PreOrchestrate(Conversation conversation, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\ServiceClients\\Orchestrator.cs:line 568\r\n at BotClientLibrary.BotConnection.InternalRun(Conversation conversation, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\BotConnection.cs:line 638\r\n at BotClientLibrary.BotConnection.ExecuteBotTurn(Conversation conversation, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\BotConnection.cs:line 396\r\n --- End of inner exception stack trace ---\r\n at BotClientLibrary.BotConnection.ExecuteBotTurn(Conversation conversation, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\BotConnection.cs:line 396\r\n at BotClientLibrary.BotConnection.ExecuteBotTurn(Conversation conversation, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\BotConnection.cs:line 396\r\n at BotClientLibrary.BotConnection.Run(CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\BotClientLibrary\\BotConnection.cs:line 136\r\n at Microsoft.Falcon.TuringBot.ChatApiImplementation.Run(BaseRequest request, BaseResponse response, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\Service\\Implementation\\ApiImplementation\\ChatApiImplementation.cs:line 88\r\n at Microsoft.Falcon.TuringBot.RequestProcessor.Run(BaseRequest request, BaseResponse response, IRequestContextInitializer contextInitializer, IRequestValidator requestValidator, IApiImplementation apiImplementation, IAsyncApiEndStep apiEndStep, String apiName, CancellationToken cancellationToken) in C:\\a\\_work\\1\\s\\services\\TuringBot\\src\\Service\\Implementation\\RequestProcessor.cs:line 206',
'serviceVersion': '20230212.2'
}
}
}
Public access not available now in india time : 11:52 AM
There seems to be a limitation on the total number of messages within a conversation, which forces users to click "New Topic" manually.
Any chance to fix this?
tbh it would be very weird to auto click "New Topic" after receiving the limitation signal because the conversation will no longer be consistent.
Initializing...
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 333, in
asyncio.run(main())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 278, in main
bot = Chatbot()
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 218, in init
self.chat_hub: ChatHub = ChatHub(Conversation())
File "C:\Users\pcesi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\EdgeGPT.py", line 111, in init
raise Exception("Authentication failed")
Exception: Authentication failed
Does the daily limit apply when using this?
May use Bing-chat. This name can give you more information so that everyone knows where he comes from.
Hi, first of all, amazing tool, thank you!
I was reading the code and saw ask
and ask_stream
functions, what is the difference? ask
when you want to use it only for 1 question, and ask_stream
if you want to have a conversation?
Just passing by, scrolling through the code. And recognized the signalr protocol
Lines 176 to 178 in f17417b
Was just curious if you thought of using a preexisting signalr client instead of implementing the protocol.
@acheong08 you mentioned in the description that there is a public cookies.json file... does that still exist?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.