diff --git a/pkgs/development/python-modules/llm-gemini/default.nix b/pkgs/development/python-modules/llm-gemini/default.nix new file mode 100644 index 000000000000..636b71b7cff6 --- /dev/null +++ b/pkgs/development/python-modules/llm-gemini/default.nix @@ -0,0 +1,59 @@ +{ + lib, + callPackage, + buildPythonPackage, + fetchFromGitHub, + setuptools, + llm, + httpx, + ijson, + pytestCheckHook, + pytest-recording, + pytest-asyncio, + nest-asyncio, + writableTmpDirAsHomeHook, +}: +buildPythonPackage rec { + pname = "llm-gemini"; + version = "0.15"; + pyproject = true; + + src = fetchFromGitHub { + owner = "simonw"; + repo = "llm-gemini"; + tag = version; + hash = "sha256-NNzorEb3dVoKef+9eXzStcFAkQhnhMBVnwLBc2lA2+o="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + llm + httpx + ijson + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-recording + pytest-asyncio + nest-asyncio + writableTmpDirAsHomeHook + ]; + + pythonImportsCheck = [ "llm_gemini" ]; + + passthru.tests = { + llm-plugin = callPackage ./tests/llm-plugin.nix { }; + }; + + meta = { + description = "LLM plugin to access Google's Gemini family of models"; + homepage = "https://github.com/simonw/llm-gemini"; + changelog = "https://github.com/simonw/llm-gemini/releases/tag/${version}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ josh ]; + }; +} diff --git a/pkgs/development/python-modules/llm-gemini/tests/llm-plugin.nix b/pkgs/development/python-modules/llm-gemini/tests/llm-plugin.nix new file mode 100644 index 000000000000..d1f2f6ffbe67 --- /dev/null +++ b/pkgs/development/python-modules/llm-gemini/tests/llm-plugin.nix @@ -0,0 +1,22 @@ +{ + runCommand, + python, + yq, +}: +let + venv = python.withPackages (ps: [ + ps.llm + ps.llm-gemini + ]); +in +runCommand "llm-gemini-test-llm-plugin" + { + nativeBuildInputs = [ + venv + yq + ]; + } + '' + llm plugins | yq --exit-status 'any(.name == "llm-gemini")' + touch "$out" + '' diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 459ee752b591..25a805de2148 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7816,6 +7816,8 @@ self: super: with self; { llm-cmd = callPackage ../development/python-modules/llm-cmd { }; + llm-gemini = callPackage ../development/python-modules/llm-gemini { }; + llm-gguf = callPackage ../development/python-modules/llm-gguf { }; llm-jq = callPackage ../development/python-modules/llm-jq { };