feat(hass): switch to ollama with mistral-nemo
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-09-11 13:07:51 -04:00
parent 20cd2a0611
commit 3207e56df2
10 changed files with 74 additions and 6 deletions

View file

@ -1,5 +1,4 @@
{ {
pkgs,
self, self,
wakewords-src, wakewords-src,
... ...
@ -18,7 +17,8 @@
]; ];
customComponents = builtins.attrValues { customComponents = builtins.attrValues {
inherit (self.legacyPackages.${pkgs.system}.hass-components) home-llm; # Switched to HASS Ollama integration
# inherit (self.legacyPackages.${pkgs.system}.hass-components) home-llm;
# Home-llm prompt: # Home-llm prompt:
/* /*
You are 'Homie', a helpful AI Assistant that controls the devices in a house. Complete the following task as instructed. You are 'Homie', a helpful AI Assistant that controls the devices in a house. Complete the following task as instructed.

View file

@ -4,7 +4,6 @@
pkgs, pkgs,
... ...
}: { }: {
# Setup Bluetooth # Setup Bluetooth
hardware.bluetooth = { hardware.bluetooth = {
enable = true; enable = true;
@ -78,6 +77,11 @@
# Setup MPD # Setup MPD
services.home-assistant.extraComponents = [ services.home-assistant.extraComponents = [
"mpd" "mpd"
# BT components
"ibeacon"
"led_ble"
"kegtron"
]; ];
services.mpd = { services.mpd = {
enable = true; enable = true;

View file

@ -14,7 +14,6 @@
"caldav" "caldav"
"holiday" "holiday"
"isal" "isal"
"led_ble"
"met" "met"
"spotify" "spotify"
"upnp" "upnp"

View file

@ -26,7 +26,7 @@ in {
host = tailscaleIP; host = tailscaleIP;
port = 11434; port = 11434;
loadModels = ["fixt/home-3b-v3"]; loadModels = ["mistral-nemo"];
environmentVariables.OLLAMA_DEBUG = "1"; environmentVariables.OLLAMA_DEBUG = "1";
}; };
}; };

View file

@ -233,6 +233,22 @@
"type": "github" "type": "github"
} }
}, },
"extended-openai-conversation-src": {
"flake": false,
"locked": {
"lastModified": 1708531177,
"narHash": "sha256-BwBroYcPQX3pv4iFR1ynmC5xQRTVAFAsOGfDGyXkES4=",
"owner": "jekalmin",
"repo": "extended_openai_conversation",
"rev": "1b20b56e81e5e5067b72a2ba2c8f51dd0a73eef1",
"type": "github"
},
"original": {
"owner": "jekalmin",
"repo": "extended_openai_conversation",
"type": "github"
}
},
"firefox-gx-src": { "firefox-gx-src": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1677,6 +1693,7 @@
"dracul-ha-src": "dracul-ha-src", "dracul-ha-src": "dracul-ha-src",
"dracula-plymouth-src": "dracula-plymouth-src", "dracula-plymouth-src": "dracula-plymouth-src",
"eisa-scripts-src": "eisa-scripts-src", "eisa-scripts-src": "eisa-scripts-src",
"extended-openai-conversation-src": "extended-openai-conversation-src",
"firefox-gx-src": "firefox-gx-src", "firefox-gx-src": "firefox-gx-src",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"flakegen": "flakegen", "flakegen": "flakegen",

View file

@ -58,6 +58,12 @@
repo = "mpv-scripts"; repo = "mpv-scripts";
type = "github"; type = "github";
}; };
extended-openai-conversation-src = {
flake = false;
owner = "jekalmin";
repo = "extended_openai_conversation";
type = "github";
};
firefox-gx-src = { firefox-gx-src = {
flake = false; flake = false;
owner = "Godiesc"; owner = "Godiesc";

View file

@ -181,6 +181,12 @@ let
owner = "acon96"; owner = "acon96";
repo = "home-llm"; repo = "home-llm";
} }
{
name = "extended-openai-conversation-src";
owner = "jekalmin";
repo = "extended_openai_conversation";
}
{ {
name = "wakewords-src"; name = "wakewords-src";
owner = "fwartner"; owner = "fwartner";

View file

@ -4,4 +4,5 @@ pkgs.lib.makeScope pkgs.newScope (hass: let
hass.callPackage file (inputs // {}); hass.callPackage file (inputs // {});
in { in {
home-llm = buildHassComponent ./home-llm.nix; home-llm = buildHassComponent ./home-llm.nix;
extended-openai-conversation = buildHassComponent ./extended-openai-conversation.nix;
}) })

View file

@ -0,0 +1,33 @@
{
extended-openai-conversation-src,
buildHomeAssistantComponent,
fetchFromGitHub,
python312Packages,
...
}: let
inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${extended-openai-conversation-src}/custom_components/extended_openai_conversation/manifest.json");
openai = python312Packages.openai.overrideAttrs (o: rec {
version = "1.3.8";
src = fetchFromGitHub {
owner = "openai";
repo = "openai-python";
rev = "refs/tags/v${version}";
hash = "sha256-yU0XWEDYl/oBPpYNFg256H0Hn5AaJiP0vOQhbRLnAxQ=";
};
disabledTests = o.disabledTests ++ ["test_retrying_timeout_errors_doesnt_leak" "test_retrying_status_errors_doesnt_leak"];
});
in
buildHomeAssistantComponent {
owner = "jekalmin";
inherit (manifest) domain version;
src = extended-openai-conversation-src;
propagatedBuildInputs = [openai];
}

View file

@ -4,7 +4,9 @@
python3Packages, python3Packages,
... ...
}: let }: let
manifest = builtins.fromJSON (builtins.readFile "${home-llm-src}/custom_components/llama_conversation/manifest.json"); inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${home-llm-src}/custom_components/llama_conversation/manifest.json");
in in
buildHomeAssistantComponent { buildHomeAssistantComponent {
owner = "acon96"; owner = "acon96";