Skip to content

Commit

Permalink
Website updates!
Browse files Browse the repository at this point in the history
  • Loading branch information
lunamidori5 committed Jun 18, 2024
1 parent c002182 commit 013ec46
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 5 deletions.
4 changes: 3 additions & 1 deletion content/howtos/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ To add your own How Tos, Please open a PR on this github - [https://github.com/l

This section includes other programs and how to setup, install, and use of LocalAI.
- [Midori AI Subsystem Manager]({{%relref "subsystem/manager" %}}) - [lunamidori5](https://github.com/lunamidori5)
- [Home Assistant x LocalAI]({{%relref "howtos/setup-with-HA" %}}) - [anto79_ops](https://github.com/Anto79-ops)
- [HA-OS Info]({{%relref "howtos/setup-with-HA" %}}) - [anto79_ops](https://github.com/Anto79-ops)
- [HA-OS x LocalAI]({{%relref "howtos/homellmxlocalai" %}}) - [Maxi1134](https://github.com/maxi1134)


## Thank you to our collaborators and volunteers
- [TwinFinz](https://github.com/TwinFinz): Help with the models template files and reviewing some code
- [Crunchy](https://github.com/dionysius): PR helping with both installers and removing 7zip need
- [Maxi1134](https://github.com/maxi1134): Making our new HA-OS page for setting up LLM with HA
- []()
73 changes: 73 additions & 0 deletions content/howtos/homellmxlocalai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
+++
disableToc = false
title = "HA-OS (HomeLLM) x LocalAI"
weight = 10
+++

_____

Home Assistant is an open-source home automation platform that allows users to control and monitor various smart devices in their homes. It supports a wide range of devices, including lights, thermostats, security systems, and more. The platform is designed to be user-friendly and customizable, enabling users to create automations and routines to make their homes more convenient and efficient. Home Assistant can be accessed through a web interface or a mobile app, and it can be installed on a variety of hardware platforms, such as Raspberry Pi or a dedicated server.

Currently, Home Assistant supports conversation-based agents and services. As of writing this, OpenAIs API is supported as a conversation agent; however, access to your homes devices and entities is possible through custom components. Local based services, such as LocalAI, are also available as a drop-in replacement for OpenAI services.

_____

In this guide I will detail the steps I've taken to get [Home-LLM](https://github.com/acon96/home-llm) and [Local-AI](https://github.com/mudler/LocalAI/) working together in conjunction with [Home-Assistant](https://www.home-assistant.io/)!

This guide assumes that you already have [Local-AI](https://github.com/mudler/LocalAI/) running (in or out of the subsystem).
If that is not done, you can [Follow this How To]({{%relref "howtos/by_hand/easy-setup-docker" %}}) or [Install Using Midori AI Subsystem](https://io.midori-ai.xyz/subsystem/manager/)!

_____

- 1: You will first need to [follow this guide to install Home-LLM](https://github.com/acon96/home-llm/blob/develop/docs/Setup.md)into your [Home-Assistant](https://www.home-assistant.io/) installation.


If you simply want to install the [Home-LLM](https://github.com/acon96/home-llm) component through HACS, you can press on this button:

[Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/redirect/hacs_repository/?category=Integration&repository=home-llm&owner=acon96)

- 2: Add `Home LLM Conversation` integration to HA.
- 1: Access the `Settings` page.
- 2: Click on `Devices & services`.
- 3: Click on `+ ADD INTEGRATION` on the lower-right part of the screen.
- 4: Type and then select `Local LLM Conversation`.
- 5: Select the `Generic OpenAI Compatible API`.
- 6: Enter the hostname or IP Address of your LocalAI host.
- 7: Enter the used port (Default is `8080` / `38080`).
- 8: Enter `mistral-7b-instruct-v0.3` as the `Model Name*`
- Leave `API Key` empty
- Do not check `Use HTTPS`
- leave `API Path*` as `/v1`
- 9: Press `Next`
- 10: Select `Assist` under `Selected LLM API`
- 11: Make sure the `Prompt Format*` is set to `Mistral`
- 12: Make sure `Enable in context learning (ICL) examples` is checked.
- 13: Press `Sumbit`
- 14: Press `Finish`

![photo](https://github.com/maxi1134/Home-Assistant-Config/blob/master/assets/home_llm_guide/home_llm_installation_video.gif?raw=true)


- 3: Configure the Voice assistant.
- 1: Access the `Settings` page.
- 2: Click on `Voice assistants`.
- 3: Click on `+ ADD ASSISTANT`.
- 4: Name the Assistant `HomeLLM`.
- 5: Select `English` as the Language.
- 6: Set the `Conversation agent` to the newly created `LLM Model 'mistral-7b-instruct-v0.3' (remote)`.
- 7: Set your `Speech-to-text` `Wake word`, and `Text-to-speech` to the ones you use. Leave to `None` if you don't have any.
- 8: Click `Create`

- 4: Select the newly created voice assistant as the default one.
- While remaining on the `Voice assistants` page click on the newly create assistant, and press the start at the top-right corner.


There you go! Your Assistant should now be working with Local-AI through Home-LLM!
- Make sure that the entities you want to control are exposted to Assist within Home-Assistant!

{{% notice style="warning" title="Notice" %}}
**Important Note:**

Any devices you choose to expose to the model will be added to the context and may have their state changed by the model. Only expose devices that you are comfortable with the model modifying, even if the modification is not what you intended. The model may occasionally hallucinate and issue commands to the wrong device. Use at your own risk.

{{% /notice %}}
12 changes: 8 additions & 4 deletions content/howtos/setup-with-HA.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
+++
disableToc = false
hidden = true
title = "Home Assistant x LocalAI"
weight = 10
+++
Expand Down Expand Up @@ -49,10 +50,6 @@ Once you have this information, proceed to “add Integration” in Home Assista

In order to utilize the conversation agent in HomeAssistant, you will need to configure it as a conversation agent. This can be done by following the the instructions [here](https://github.com/acon96/home-llm?tab=readme-ov-file#configuring-the-component-as-a-conversation-agent).

{{% notice note %}}
ANY DEVICES THAT YOU SELECT TO BE EXPOSED TO THE MODEL WILL BE ADDED AS CONTEXT AND POTENTIALLY HAVE THEIR STATE CHANGED BY THE MODEL. ONLY EXPOSE DEVICES THAT YOU ARE OK WITH THE MODEL MODIFYING THE STATE OF, EVEN IF IT IS NOT WHAT YOU REQUESTED. THE MODEL MAY OCCASIONALLY HALLUCINATE AND ISSUE COMMANDS TO THE WRONG DEVICE! USE AT YOUR OWN RISK.
{{% /notice %}}

## Changing the prompt

Example on how to use the prompt can be seen [here](https://github.com/acon96/home-llm?tab=readme-ov-file#model).
Expand All @@ -72,3 +69,10 @@ High level Overview of the setup:
- install the integration.
- fill the needed information. You must fill something in the API key (if you don't use api key just check the box "ignore authentication"), put the full url e.g. https://myLocalAIHostHere:8080/v1 (including /v1), Not sure: let the API version empty.
- configure the Home Assistant [Assist](https://www.home-assistant.io/voice_control/) using the new conversation agent.

{{% notice style="warning" title="Notice" %}}
**Important Note:**

Any devices you choose to expose to the model will be added to the context and may have their state changed by the model. Only expose devices that you are comfortable with the model modifying, even if the modification is not what you intended. The model may occasionally hallucinate and issue commands to the wrong device. Use at your own risk.

{{% /notice %}}

0 comments on commit 013ec46

Please sign in to comment.