diff --git a/pkgs/development/python-modules/llm-lmstudio/default.nix b/pkgs/development/python-modules/llm-lmstudio/default.nix new file mode 100644 index 000000000000..35ea01899c26 --- /dev/null +++ b/pkgs/development/python-modules/llm-lmstudio/default.nix @@ -0,0 +1,59 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, + httpx, + llm, + requests, + pytest, + pytest-asyncio, + pytest-mock, + pytest-vcr, +}: + +buildPythonPackage rec { + pname = "llm-lmstudio"; + version = "0.2.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "agustif"; + repo = "llm-lmstudio"; + rev = "v${version}"; + hash = "sha256-dPrkvoVLDIk/JxUhvUUyjMzovH+Q/O13eTdA6qvdKxY="; + }; + + build-system = [ + setuptools + wheel + ]; + + dependencies = [ + httpx + llm + requests + ]; + + optional-dependencies = { + test = [ + pytest + pytest-asyncio + pytest-mock + pytest-vcr + ]; + }; + + pythonImportsCheck = [ + "llm_lmstudio" + ]; + + meta = { + description = "Plugin to use local models via LM Studio API with https://llm.datasette.io"; + homepage = "https://github.com/agustif/llm-lmstudio"; + changelog = "https://github.com/agustif/llm-lmstudio/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ dwt ]; + }; +} diff --git a/pkgs/development/python-modules/llm/default.nix b/pkgs/development/python-modules/llm/default.nix index a943c405d447..2580d22ef2a3 100644 --- a/pkgs/development/python-modules/llm/default.nix +++ b/pkgs/development/python-modules/llm/default.nix @@ -81,6 +81,7 @@ let llm-hacker-news ? false, llm-jq ? false, llm-llama-server ? false, + llm-lmstudio ? false, llm-mistral ? false, llm-ollama ? false, llm-openai-plugin ? false, diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e8ef24a53722..ca8a5c2e04fe 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8904,6 +8904,8 @@ self: super: with self; { llm-llama-server = callPackage ../development/python-modules/llm-llama-server { }; + llm-lmstudio = callPackage ../development/python-modules/llm-lmstudio { }; + llm-mistral = callPackage ../development/python-modules/llm-mistral { }; llm-ollama = callPackage ../development/python-modules/llm-ollama { };