add back working version of llm + llm-plugins

This commit is contained in:
Daylin Morgan 2024-11-04 12:24:08 -06:00
parent 149c74b3d9
commit 2a492684c2
Signed by: daylin
GPG key ID: 950D13E9719334AD
6 changed files with 110 additions and 14 deletions

View file

@ -19,7 +19,7 @@
# llm
''
vpn|desktop|hyprland|chrome
backups|hp-scanner
backups|hp-scanner|llm
podman|docker|vbox
''
|> listify

View file

@ -2,22 +2,18 @@
pkgs,
config,
mkOizysModule,
# enabled,
flake,
...
}:
let
inherit (pkgs) python3Packages;
# llm-ollama = python3Packages.callPackage ./llm-plugins/llm-ollama { };
llm-claude3 = python3Packages.callPackage ./llm-plugins/llm-claude-3 { };
in
mkOizysModule config "llm" {
# services.ollama = enabled;
environment.systemPackages = with pkgs; [
(python3.withPackages (ps: [
ps.llm
llm-claude3
]))
(python3.withPackages (ps:
with (flake.pkgs "self");
[
llm
llm-claude-3
]
))
];
}

View file

@ -1,7 +1,11 @@
{ pkgs, ... }:
let inherit (pkgs) python3Packages;
in
{
nph = pkgs.callPackage ./nim/nph { }; # doesn't compile with 2.2.0 :/
nimlangserver = pkgs.callPackage ./nim/nimlangserver { };
nimble = pkgs.callPackage ./nim/nimble { };
distrobox = pkgs.callPackage ./distrobox {};
llm = python3Packages.callPackage ./llm {};
llm-claude-3 = python3Packages.callPackage ./llm-plugins/llm-claude-3 {};
}

View file

@ -13,7 +13,7 @@
buildPythonPackage rec {
pname = "llm-claude-3";
version = "0.4";
version = "0.7";
pyproject = true;
src = fetchFromGitHub {

96
pkgs/llm/default.nix Normal file
View file

@ -0,0 +1,96 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,
setuptools,
click-default-group,
numpy,
openai,
pip,
pluggy,
pydantic,
python-ulid,
pyyaml,
sqlite-migrate,
cogapp,
pytest-httpx,
puremagic,
sqlite-utils,
}:
let
llm = buildPythonPackage rec {
pname = "llm";
version = "0.17.1";
pyproject = true;
build-system = [ setuptools ];
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "simonw";
repo = "llm";
rev = "refs/tags/${version}";
hash = "sha256-6OO0SIIxChM5HRJoUM4CYGbsINmc3i+iyL/oahLHhrY=";
};
# patches = [ ./001-disable-install-uninstall-commands.patch ];
dependencies = [
click-default-group
numpy
openai
pip
pluggy
pydantic
python-ulid
pyyaml
setuptools # for pkg_resources
sqlite-migrate
sqlite-utils
puremagic
];
nativeCheckInputs = [
cogapp
numpy
pytest-httpx
pytestCheckHook
];
doCheck = true;
pytestFlagsArray = [
"-svv"
"tests/"
];
pythonImportsCheck = [ "llm" ];
passthru = {
inherit withPlugins;
};
meta = with lib; {
homepage = "https://github.com/simonw/llm";
description = "Access large language models from the command-line";
changelog = "https://github.com/simonw/llm/releases/tag/${version}";
license = licenses.asl20;
mainProgram = "llm";
maintainers = with maintainers; [
aldoborrero
mccartykim
];
};
};
withPlugins = throw ''
llm.withPlugins was confusing to use and has been removed.
Please migrate to using python3.withPackages(ps: [ ps.llm ]) instead.
See https://nixos.org/manual/nixpkgs/stable/#python.withpackages-function for more usage examples.
'';
in
llm