diff --git a/pkgs/by-name/ll/llm/package.nix b/pkgs/by-name/ll/llm/package.nix index 03e745890117..1038d798f2b3 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-github ? false, enable-llm-venice ? false, enable-llm-video-frames ? false, }: @@ -35,6 +36,7 @@ let llm-ollama llm-openai-plugin llm-openrouter + llm-templates-github llm-venice llm-video-frames ; @@ -57,6 +59,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-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-github/default.nix b/pkgs/development/python-modules/llm-templates-github/default.nix new file mode 100644 index 000000000000..f5e7d66b0f01 --- /dev/null +++ b/pkgs/development/python-modules/llm-templates-github/default.nix @@ -0,0 +1,41 @@ +{ + lib, + callPackage, + buildPythonPackage, + fetchFromGitHub, + setuptools, + llm, +}: + +buildPythonPackage rec { + pname = "llm-templates-github"; + version = "0.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "simonw"; + repo = "llm-templates-github"; + tag = version; + hash = "sha256-SFXrvpKrvfIP0JmXQt6OZ52kne4AEtiggbshyac9XQc="; + }; + + build-system = [ + setuptools + llm + ]; + dependencies = [ ]; + + pythonImportsCheck = [ "llm_templates_github" ]; + + passthru.tests = { + llm-plugin = callPackage ./tests/llm-plugin.nix { }; + }; + + meta = { + description = "Load LLM templates from GitHub repositories"; + homepage = "https://github.com/simonw/llm-templates-github"; + changelog = "https://github.com/simonw/llm-templates-github/releases/tag/${version}/CHANGELOG.md"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ philiptaron ]; + }; +} diff --git a/pkgs/development/python-modules/llm-templates-github/tests/llm-plugin.nix b/pkgs/development/python-modules/llm-templates-github/tests/llm-plugin.nix new file mode 100644 index 000000000000..a9569f069638 --- /dev/null +++ b/pkgs/development/python-modules/llm-templates-github/tests/llm-plugin.nix @@ -0,0 +1,22 @@ +{ + runCommand, + python, + yq, +}: +let + venv = python.withPackages (ps: [ + ps.llm + ps.llm-templates-github + ]); +in +runCommand "llm-templates-github-test-llm-plugin" + { + nativeBuildInputs = [ + venv + yq + ]; + } + '' + llm plugins | yq --exit-status 'any(.name == "llm-templates-github")' + touch "$out" + '' diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3934fc840e47..b4b89e9cb297 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-github = callPackage ../development/python-modules/llm-templates-github { }; + llm-venice = callPackage ../development/python-modules/llm-venice { }; llm-video-frames = callPackage ../development/python-modules/llm-video-frames { };