Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to access HuggingChat using requests in Python but I am getting a response code of 500 for some reason. What I have so far is something like this:

hf_url = "https://huggingface.co/chat"
resp = session.post(hf_url + f"/conversation/{self.now_conversation}", json=req_json, stream=True)

The JSON objects holds the "inputs" field and other "parameters" such as temperature, top_p, etc.

req_json = {
            "inputs": text,
            "parameters": {
                "temperature": temperature,
                "top_p": top_p,

Is there no API I can directly use? If not, is there a auth I am missing here? I inspected the request going from my browser when I chat with HuggingChat and didn't really find anything. Thanks!

If it can help you, there is an unofficial implementation github.com/Soulter/hugging-chat-api – VICTOR RODEÑO SANCHEZ May 9 at 15:43

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.