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

Internal Error #171

Closed
TribSTox opened this issue Feb 15, 2024 · 10 comments · Fixed by #174
Closed

Internal Error #171

TribSTox opened this issue Feb 15, 2024 · 10 comments · Fixed by #174
Labels
bug bug!

Comments

@TribSTox
Copy link
Contributor

Describe the bug
While using the hugging-chat-api version 0.3.11, I encountered an error where the application throws an error message "ERROR:root:No type found in response: {'message': 'Internal Error'}" and fails with a ChatError indicating "Server returns an error: Internal Error". This issue started occurring without any prior changes to the code that had been working correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Set up environment variables for Hugging Face login and password.
  2. Log in using the Login class from hugchat.login.
  3. Save cookies to a directory.
  4. Initialize ChatBot with the saved cookies.
  5. Perform a query with chatbot.query("Just a test prompt", web_search=False, stream=False).
  6. Observe the error upon attempting to print the query result.
from hugchat import hugchat
from hugchat.login import Login
from dotenv import load_dotenv
import os

load_dotenv()
env = {
    'HUGGINGFACE_LOGIN': os.getenv('HUGGINGFACE_LOGIN'),
    'HUGGINGFACE_PASSWORD': os.getenv('HUGGINGFACE_PASSWORD'),
}

sign = Login(env["HUGGINGFACE_LOGIN"], env["HUGGINGFACE_PASSWORD"])
cookies = sign.login()
cookie_path_dir = "./cookies_snapshot"
sign.saveCookiesToDir(cookie_path_dir)

chatbot = hugchat.ChatBot(cookies=cookies.get_dict())
query_result = chatbot.query(
    "Just a test prompt",
    web_search=False,
    stream=False,
)

print(f"Response: {query_result}")

Expected behavior
I expected the function to return a response from the chatbot query without any errors, enabling the application to process the chatbot's response further.

Screenshots
Not applicable, as this is a console-based error.

Additional context

  • Operating System: Windows 10
  • Python version: Tested on both Python 3.10.0 and Python 3.12.1
  • Version of hugchat: 0.3.11, confirmed via pip show hugchat
  • The error seems related to how the hugchat library processes or expects certain response structures from the server. It's unclear whether this is due to a recent change in the API response format or an internal bug within the library.

Best regards.

@TribSTox TribSTox added the bug bug! label Feb 15, 2024
@jls42
Copy link

jls42 commented Feb 15, 2024

Hi,

Same here, it worked yesterday and today with the same code it doesn't work anymore.

OS : Ubuntu 22.04.3 LTS
hugchat version 0.3.11

.local/lib/python3.10/site-packages/hugchat/hugchat.py", line 730, in _stream_query
hugchat.exceptions.ChatError: Failed to parse response: {"message":"Internal Error"}

Best regards,

@JTremoureux
Copy link

Same error here
I guess Huggingchat change something to their xhr calls

@hyunsikhwang
Copy link

Same here

@Whitelisted1
Copy link
Contributor

I am also producing this error. It seems that HuggingFace has changed what kinds of requests the server expects.

@FERRAMOS888
Copy link

Same issue with my bot

@Soulter
Copy link
Owner

Soulter commented Feb 16, 2024

I'm trying to fix it.

@Soulter Soulter linked a pull request Feb 16, 2024 that will close this issue
@Soulter Soulter mentioned this issue Feb 16, 2024
@Soulter
Copy link
Owner

Soulter commented Feb 16, 2024

The bug has been solved, you can update hugchat to the latest version.

What causes this bug: message id was randomly generated in previous versions and did not point to a specified message id in a conversation

@jls42
Copy link

jls42 commented Feb 16, 2024

Many thx, ok here now. Best regards

@TribSTox
Copy link
Contributor Author

Thank you so much for your swift response and the efficient resolution of the issue! I've updated hugchat to the latest version and can confirm that the bug has been resolved. Your explanations regarding the origin of the bug are also greatly appreciated.

I also want to express my gratitude for your work on the hugchat library. It is an invaluable tool for my projects, and your dedication to maintaining and improving it is greatly appreciated by both the community and myself. Keep up the great work!

Cheers.

@FERRAMOS888
Copy link

FERRAMOS888 commented Feb 16, 2024

Thank you so much
Grate job

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

Successfully merging a pull request may close this issue.

7 participants