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

Sending too many messages error #130

Closed
Vicccai opened this issue Oct 23, 2023 · 10 comments
Closed

Sending too many messages error #130

Vicccai opened this issue Oct 23, 2023 · 10 comments
Labels
bug bug! question Further information is requested

Comments

@Vicccai
Copy link

Vicccai commented Oct 23, 2023

Hi. I am running a basic example (with my email and passwd inputted appropriately):

from hugchat import hugchat
from hugchat.login import Login

sign = Login(user, pass)
cookies = sign.login()

chatbot = hugchat.ChatBot(cookies=cookies.get_dict())

query_result = chatbot.chat("Hi!")
print(query_result) # or query_result.text or query_result["text"]

I get the following error:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/hugchat/hugchat.py", line 414, in _stream_query
_type = obj['type']
~~~^^^^^^^^
KeyError: 'type'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/hugchat/hugchat.py", line 414, in _stream_query
_type = obj['type']
~~~^^^^^^^^
KeyError: 'type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/Desktop/ChatBot.py", line 11, in
query_result = chatbot.chat("Hi!")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hugchat/hugchat.py", line 637, in chat
return self.query(
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hugchat/hugchat.py", line 582, in query
return self._non_stream_query(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/hugchat/hugchat.py", line 490, in _non_stream_query
for resp in self._stream_query(
File "/usr/local/lib/python3.11/site-packages/hugchat/hugchat.py", line 443, in _stream_query
raise ChatError(f"Failed to parse response: {res}")
hugchat.exceptions.ChatError: Failed to parse response: {"message":"You are sending too many messages. Try again later."}

When I go to HuggingChat online, I see just a series of 15 of the same message (Hi!) in the most recent conversation. How can I fix this?

@github-actions
Copy link

Hi! Thanks for your issue, we will deal with your issue as soon as possible.

@ogios
Copy link
Collaborator

ogios commented Oct 23, 2023

it has request rate limit which means you can only send certain amount of request in a certain amount of time.
but i dont really know what strategy it sets, whether it's related to your ip address or just your account.

for now, just reduce your usage of huggingchat (in this account).

@Vicccai
Copy link
Author

Vicccai commented Oct 23, 2023

Hi, thanks for the reply. The issue is that each time I call chatbot.chat('Hi!'), it sends the Hi message 15+ times, which leads to the error. I never get a response back, even if it's the first time I call chat().

@kwon514
Copy link

kwon514 commented Oct 23, 2023

I get this same issue, with the message being sent many times when I look on the HuggingFace website. This seems to be an issue that has popped up recently - this did not happen previously.

@p2d0
Copy link

p2d0 commented Oct 23, 2023

Hi, thanks for the reply. The issue is that each time I call chatbot.chat('Hi!'), it sends the Hi message 15+ times, which leads to the error. I never get a response back, even if it's the first time I call chat().

Same

@Soulter Soulter added bug bug! question Further information is requested labels Oct 23, 2023
@Whitelisted1
Copy link
Contributor

Whitelisted1 commented Oct 24, 2023

This seems similar to this comment I left on another issue. I did some testing, though, and am unable to reproduce it now.
How often are these messages happening?

@kwon514
Copy link

kwon514 commented Oct 24, 2023

Oddly enough, I'm also unable to reproduce it now within the past 2ish hours, despite still having issues until then.

@Vicccai
Copy link
Author

Vicccai commented Oct 24, 2023

I think what happened is Hugging Chat sometimes is down/slow. Last night I was receiving network error on Hugging Chat and wouldn't get any responses. I think the way the API works is it resends the request if it doesn't receive a response, hence the sending too many messages. It's working fine now, with no network error on Hugging Chat.

@Vicccai Vicccai closed this as completed Oct 24, 2023
@MUZAMMILPERVAIZ
Copy link
Contributor

I am also receiving this error on first query

@Whitelisted1
Copy link
Contributor

Perhaps this error is due to issues with the HuggingChat servers. If you see the attached video, you will see that I am having a similar error with both the HuggingChat UI and with the hugchat library

hugchat.video.1.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bug! question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants