From 3f8e227f543b31a20dd35e35bd9396530f7deebe Mon Sep 17 00:00:00 2001 From: Aos Dabbagh <25783780+aos@users.noreply.github.com> Date: Fri, 14 Feb 2025 13:06:11 -0500 Subject: [PATCH] python3Packages.llm-anthropic: init at 0.12 Closes #327800 Closes #372713 (Note: This is just #373495 upgraded to `0.12`. Seems like something happened with git/Github and my PR was automatically closed.) This is a plugin for the already packaged `llm` software. There exists 2 PRs related to this: - #327800: the original - #372713: forks the original and updates as it had no activity for multiple months As helpfully pointed out by @ShaddyDC (https://github.com/NixOS/nixpkgs/pull/372713#issuecomment-2586795561) this is now superseded by `llm-anthropic`, of which this is meant to package. (We also have other PRs that have been commited that add similr plugins at #359379 and #344746.) --- .../python-modules/llm-anthropic/default.nix | 55 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 57 insertions(+) create mode 100644 pkgs/development/python-modules/llm-anthropic/default.nix diff --git a/pkgs/development/python-modules/llm-anthropic/default.nix b/pkgs/development/python-modules/llm-anthropic/default.nix new file mode 100644 index 000000000000..d3788ffa7642 --- /dev/null +++ b/pkgs/development/python-modules/llm-anthropic/default.nix @@ -0,0 +1,55 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + llm, + anthropic, + pytestCheckHook, + pytest-asyncio, + pytest-recording, + nix-update-script, +}: + +buildPythonPackage rec { + pname = "llm-anthropic"; + version = "0.12"; + pyproject = true; + + src = fetchFromGitHub { + owner = "simonw"; + repo = "llm-anthropic"; + tag = version; + hash = "sha256-7+5j5jZBFfaaqnfjvLTI+mz1PUuG8sB5nD59UCpJuR4="; + }; + + build-system = [ + setuptools + llm + ]; + dependencies = [ anthropic ]; + + # Otherwise tests will fail to create directory + # Permission denied: '/homeless-shelter' + preCheck = '' + export HOME=$(mktemp -d) + ''; + + nativeCheckInputs = [ + pytestCheckHook + pytest-asyncio + pytest-recording + ]; + + pythonImportsCheck = [ "llm_anthropic" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "LLM access to models by Anthropic, including the Claude series"; + homepage = "https://github.com/simonw/llm-anthropic"; + changelog = "https://github.com/simonw/llm-anthropic/releases/tag/${version}/CHANGELOG.md"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ aos ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 782cf2c469a9..7a2a51d130e0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7697,6 +7697,8 @@ self: super: with self; { llm = callPackage ../development/python-modules/llm { }; + llm-anthropic = callPackage ../development/python-modules/llm-anthropic { }; + llm-cmd = callPackage ../development/python-modules/llm-cmd { }; llm-gguf = callPackage ../development/python-modules/llm-gguf { };