HuggingChat integration

Hi everyone, I’ve just created an integration with HuggingChat allowing you to create a conversational agent like the OpenAI integration but without an API key and for free. All you need is a Hugging Face account and your login details.

I look forward to your comments :wink: !

2 Likes

It would be great if we could self host the server and be totally private.

2 Likes

I’m sorry but it’s not possible with this integration, but I can advise you to take a look at this post which explains how to have a voice assistant with LocalAI. However, you’ll get much poorer response time performance if you’re local.

I’d like to point out that HuggingFace doesn’t collect data (unless you want it to) from your cats and doesn’t communicate it.

Thank you for your comment and don’t hesitate to send me your suggestions!

1 Like

I would Absolutely love to use this integration, but keep running into a problem with my new home assistant installation of it saying I need HACS, As best as I can tell is a repository similar to git? Sorry, I’ve been staring in front of the computer all day so I’m mistaken in that my apologies… Anyways, any assistance or guidance you could give me would be much appreciated!!! I’m actually developing my own face assistant that I would like to integrate into this if at all possible, And I’ve seen that hugging faces for A home assistant 3, billion model, Making me even more interested in it!

is it possible to interact with HA identities ? (like [Custom Component] extended_openai_conversation: Let's control entities via ChatGPT - #140 by viperxeno)

At the moment, it’s not possible, but I’m trying to develop a new version based on the code of the extended_openai_conversation integration.

I can’t guarantee that this version will ever be released, but I very much hope so :wink:

2 Likes

If you want to integrate my Home Assistant integration without HACS, you can do this command:
git clone https://github.com/PhoenixR49/hass-huggingchat-conversation
Then integrate the contents of the custom_components folder into the custom_components folder in your HA config.

If you have any other problems, or if my explanation doesn’t solve your problem, please let me know :grin:

I’ve just found a solution!
To control entities, you can use Home Assistant’s basic automation:

  • A trigger on a certain phrase (like “Play a jazz playlist”)
  • Add the actions you want (like playing music on a speaker)
  • Process the response with the conversation agent created by the HuggingChat integration then set the response on a variable (like “jarvis”)
  • Reply the response generated by HuggingChat’s AI.

Here’s a complete example of automation:

alias: "Assist: Play Jazz"
description: "Play a jazz playlist using Assist and HuggingChat."
trigger:
  - platform: conversation
    command:
      - "Play a jazz playlist"
condition:
  - condition: not
    conditions:
      - condition: or
        conditions:
          - condition: state
            entity_id: media_player.speaker
            state: unavailable
          - condition: state
            entity_id: media_player.speaker
            state: unknown
action:
  - service: spotcast.start
    data:
      entity_id: media_player.speaker
      uri: spotify:playlist:37i9dQZF1DX2vYju3i0lNX
    enabled: true
  - service: conversation.process
    metadata: {}
    data:
      agent_id: your_agent_id
      text: Play a jazz playlist on Spotify
    response_variable: jarvis
  - set_conversation_response: "{{ jarvis.response.speech.plain.speech }}"
mode: single

Enjoy

1 Like

Can you kindly clarify how to use the integration after it’s downloaded via HACS?

1 Like

Once the integration has been installed via HACS, all you have to do is go to your integration settings and add a HuggingChat configuration by clicking on the “add integration” button.

Thank you for this awesome integration. I can enjoy LLMs even though my home assistant server is still running on a raspberry pi 4.

Can’t wait till we can “truly” control entities.

1 Like
1 Like

Thank you so much! I’ll look into it right away.

Is it possible to upload files (ie pictures)?

Home Assistant does not currently support file upload to Assist. You can, however, do so in HuggingChat.

Sorry my wording was incorrect. What I meant is:

Have you seen this? GitHub - valentinfrlch/ha-gpt4vision: Image Analyzer for Home Assistant using GPT Vision

Is there a way to get it to work with your integration?

Since HuggingChat doesn’t yet provide templates that can analyze images like GPT Vision, it’s not currently possible to integrate it into my integration.

Can you implement function calling so can control entities?

I installed the integration, got a huggingchat user name and password, and put it into the integration however when I try and use it I just get “Sorry, I had a problem talking to HuggingChat server: Server returns an error: An error occurred” is there something I’m missing to get this to work?

No, it’s not your fault, it’s due to a problem with the hugchat module (which lets you communicate with HuggingChat).
I’m currently working on a new version to fix this bug, so please install it when it’s available!