add llm package + plugins

This commit is contained in:
Daylin Morgan 2024-08-08 13:53:51 -05:00
parent 8aade59df9
commit 1f1cf3a6be
Signed by: daylin
GPG key ID: 950D13E9719334AD
6 changed files with 95 additions and 5 deletions

View file

@ -22,6 +22,7 @@
"tex"
"zig"
];
llm = enabled;
};
services.restic.backups.gdrive = {

View file

@ -1,8 +1,4 @@
{
pkgs,
enabled,
...
}:
{ pkgs, enabled, ... }:
{
networking.networkmanager = enabled;
services.fwupd = enabled;

24
modules/llm/default.nix Normal file
View file

@ -0,0 +1,24 @@
{
pkgs,
config,
enabled,
mkOizysModule,
...
}:
let
inherit (pkgs) python3Packages;
llm-ollama = python3Packages.callPackage ../../pkgs/llm-plugins/llm-ollama { };
llm-claude3 = python3Packages.callPackage ../../pkgs/llm-plugins/llm-claude-3 { };
llm = (
pkgs.llm.withPlugins [
llm-ollama
llm-claude3
]
);
in
mkOizysModule config "llm" {
services.ollama = enabled;
environment.systemPackages = [ llm ];
}

View file

@ -38,6 +38,8 @@ in
nix-ld
restic
llm
];
options.oizys = {

View file

@ -0,0 +1,34 @@
{
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
wheel,
# deps
anthropic,
...
}:
buildPythonPackage rec {
pname = "llm-claude-3";
version = "0.4";
pyproject = true;
src = fetchFromGitHub {
owner = "simonw";
repo = "llm-claude-3";
rev = version;
hash = "sha256-5qF5BK319PNzB4XsLdYvtyq/SxBDdHJ9IoKWEnvNRp4=";
};
nativeBuildInputs = [
setuptools
wheel
];
dependencies = [ anthropic ];
dontCheckRuntimeDeps = true;
}

View file

@ -0,0 +1,33 @@
{
buildPythonPackage,
fetchPypi,
# build-system
setuptools,
# deps
ollama,
pydantic,
...
}:
buildPythonPackage rec {
pname = "llm-ollama";
version = "0.5.0";
pyproject = true;
src = fetchPypi {
inherit version;
pname = "llm_ollama";
hash = "sha256-M3FF9fAZ2rr+toKoz/rLRPZxB7LIHqmZQXJBdKR4fVk=";
};
dependencies = [
ollama
pydantic
];
build-system = [ setuptools ];
# will only be used in environment with llm installed
dontCheckRuntimeDeps = true;
}