From 56df419440c70d8af8ec2a1349d8bf509b0690ff Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Thu, 8 May 2025 14:27:46 -0700 Subject: [PATCH] python3Packages.llm-templates-fabric: init at 0.2 --- pkgs/by-name/ll/llm/package.nix | 3 ++ .../llm-templates-fabric/default.nix | 41 +++++++++++++++++++ .../llm-templates-fabric/tests/llm-plugin.nix | 22 ++++++++++ pkgs/top-level/python-packages.nix | 2 + 4 files changed, 68 insertions(+) create mode 100644 pkgs/development/python-modules/llm-templates-fabric/default.nix create mode 100644 pkgs/development/python-modules/llm-templates-fabric/tests/llm-plugin.nix diff --git a/pkgs/by-name/ll/llm/package.nix b/pkgs/by-name/ll/llm/package.nix index 1038d798f2b3..dadb591f64c5 100644 --- a/pkgs/by-name/ll/llm/package.nix +++ b/pkgs/by-name/ll/llm/package.nix @@ -14,6 +14,7 @@ enable-llm-ollama ? false, enable-llm-openai-plugin ? false, enable-llm-openrouter ? false, + enable-llm-templates-fabric ? false, enable-llm-templates-github ? false, enable-llm-venice ? false, enable-llm-video-frames ? false, @@ -36,6 +37,7 @@ let llm-ollama llm-openai-plugin llm-openrouter + llm-templates-fabric llm-templates-github llm-venice llm-video-frames @@ -59,6 +61,7 @@ toPythonApplication ( ++ lib.optionals enable-llm-ollama [ llm-ollama ] ++ lib.optionals enable-llm-openai-plugin [ llm-openai-plugin ] ++ lib.optionals enable-llm-openrouter [ llm-openrouter ] + ++ lib.optionals enable-llm-templates-fabric [ llm-templates-fabric ] ++ lib.optionals enable-llm-templates-github [ llm-templates-github ] ++ lib.optionals enable-llm-venice [ llm-venice ] ++ lib.optionals enable-llm-video-frames [ llm-video-frames ]; diff --git a/pkgs/development/python-modules/llm-templates-fabric/default.nix b/pkgs/development/python-modules/llm-templates-fabric/default.nix new file mode 100644 index 000000000000..0bbc11af790a --- /dev/null +++ b/pkgs/development/python-modules/llm-templates-fabric/default.nix @@ -0,0 +1,41 @@ +{ + lib, + callPackage, + buildPythonPackage, + fetchFromGitHub, + setuptools, + llm, +}: + +buildPythonPackage rec { + pname = "llm-templates-fabric"; + version = "0.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "simonw"; + repo = "llm-templates-fabric"; + tag = version; + hash = "sha256-tfkSjeT9WstUsNCtVr3fMzqELFCtfYphqf3xFGvHaV0="; + }; + + build-system = [ + setuptools + llm + ]; + dependencies = [ ]; + + pythonImportsCheck = [ "llm_templates_fabric" ]; + + passthru.tests = { + llm-plugin = callPackage ./tests/llm-plugin.nix { }; + }; + + meta = { + description = "Load LLM templates from Fabric"; + homepage = "https://github.com/simonw/llm-templates-fabric"; + changelog = "https://github.com/simonw/llm-templates-fabric/releases/tag/${version}/CHANGELOG.md"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ philiptaron ]; + }; +} diff --git a/pkgs/development/python-modules/llm-templates-fabric/tests/llm-plugin.nix b/pkgs/development/python-modules/llm-templates-fabric/tests/llm-plugin.nix new file mode 100644 index 000000000000..b00bdfbcaa9e --- /dev/null +++ b/pkgs/development/python-modules/llm-templates-fabric/tests/llm-plugin.nix @@ -0,0 +1,22 @@ +{ + runCommand, + python, + yq, +}: +let + venv = python.withPackages (ps: [ + ps.llm + ps.llm-templates-fabric + ]); +in +runCommand "llm-templates-fabric-test-llm-plugin" + { + nativeBuildInputs = [ + venv + yq + ]; + } + '' + llm plugins | yq --exit-status 'any(.name == "llm-templates-fabric")' + touch "$out" + '' diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b4b89e9cb297..defa383199f3 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8320,6 +8320,8 @@ self: super: with self; { llm-openrouter = callPackage ../development/python-modules/llm-openrouter { }; + llm-templates-fabric = callPackage ../development/python-modules/llm-templates-fabric { }; + llm-templates-github = callPackage ../development/python-modules/llm-templates-github { }; llm-venice = callPackage ../development/python-modules/llm-venice { };