diff options
Diffstat (limited to 'Omni/Bild')
-rw-r--r-- | Omni/Bild/Deps.nix | 4 | ||||
-rw-r--r-- | Omni/Bild/Deps/Python.nix | 2 | ||||
-rw-r--r-- | Omni/Bild/Deps/llm-ollama.nix | 57 | ||||
-rw-r--r-- | Omni/Bild/Deps/openai-python.nix | 99 | ||||
-rw-r--r-- | Omni/Bild/Nixpkgs.nix | 52 | ||||
-rw-r--r-- | Omni/Bild/Python.nix | 17 | ||||
-rw-r--r-- | Omni/Bild/Sources.json | 37 |
7 files changed, 215 insertions, 53 deletions
diff --git a/Omni/Bild/Deps.nix b/Omni/Bild/Deps.nix index 0b23f9f..f25c947 100644 --- a/Omni/Bild/Deps.nix +++ b/Omni/Bild/Deps.nix @@ -24,11 +24,9 @@ _self: super: { ]; }; - llm = super.overrideSrc super.llm super.sources.llm; - nostr-rs-relay = super.callPackage ./Deps/nostr-rs-relay.nix {}; - ollama = super.ollama.override {acceleration = "cuda";}; + ollama = super.unstable.ollama.override {acceleration = "cuda";}; radicale = super.radicale.overrideAttrs (_old: {doCheck = false;}); } diff --git a/Omni/Bild/Deps/Python.nix b/Omni/Bild/Deps/Python.nix index bb01139..3a0562d 100644 --- a/Omni/Bild/Deps/Python.nix +++ b/Omni/Bild/Deps/Python.nix @@ -2,9 +2,11 @@ "cryptography" "flask" "llm" + "llm-ollama" "ludic" "mypy" "nltk" + "ollama" "openai" "requests" "slixmpp" diff --git a/Omni/Bild/Deps/llm-ollama.nix b/Omni/Bild/Deps/llm-ollama.nix index 15b26cc..3956bb7 100644 --- a/Omni/Bild/Deps/llm-ollama.nix +++ b/Omni/Bild/Deps/llm-ollama.nix @@ -1,47 +1,62 @@ { + lib, buildPythonPackage, fetchFromGitHub, - lib, + # build-system + setuptools, llm, + # dependencies + click, ollama, + pydantic, + # tests pytestCheckHook, - setuptools, - pythonOlder, }: buildPythonPackage rec { pname = "llm-ollama"; - version = "0.3.0"; + version = "0.8.2"; pyproject = true; - disabled = pythonOlder "3.8"; - src = fetchFromGitHub { owner = "taketwo"; - repo = pname; - rev = "refs/tags/${version}"; - hash = "sha256-Ar0Ux8BNGY0i764CEk7+48J6jnndlRIIMPZ9tFpXiy4="; + repo = "llm-ollama"; + tag = version; + hash = "sha256-/WAugfkI4izIQ7PoKM9epd/4vFxYPvsiwDbEqqTdMq4="; }; - nativeBuildInputs = [setuptools]; + build-system = [ + setuptools + # Follows the reasoning from https://github.com/NixOS/nixpkgs/pull/327800#discussion_r1681586659 about including llm in build-system + llm + ]; - buildInputs = [llm ollama]; + dependencies = [ + click + ollama + pydantic + ]; - propagatedBuildInputs = [ollama]; + nativeCheckInputs = [ + pytestCheckHook + ]; + # These tests try to access the filesystem and fail disabledTests = [ - # wants to mkdir in the /homeless-shelter - "test_registered_models" + "test_registered_model" + "test_registered_chat_models" + "test_registered_embedding_models" + "test_registered_models_when_ollama_is_down" ]; - nativeCheckInputs = [pytestCheckHook]; - - pythonImportsCheck = ["llm_ollama"]; + pythonImportsCheck = [ + "llm_ollama" + ]; - meta = with lib; { + meta = { + description = "LLM plugin providing access to Ollama models using HTTP API"; homepage = "https://github.com/taketwo/llm-ollama"; - description = "LLM plugin providing access to local Ollama models usting HTTP API"; changelog = "https://github.com/taketwo/llm-ollama/releases/tag/${version}"; - license = licenses.asl20; - maintainers = with maintainers; [bsima]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [erethon]; }; } diff --git a/Omni/Bild/Deps/openai-python.nix b/Omni/Bild/Deps/openai-python.nix new file mode 100644 index 0000000..79db11c --- /dev/null +++ b/Omni/Bild/Deps/openai-python.nix @@ -0,0 +1,99 @@ +{ + lib, + buildPythonPackage, + pythonOlder, + # build-system + hatchling, + hatch-fancy-pypi-readme, + # dependencies + anyio, + distro, + httpx, + jiter, + pydantic, + sniffio, + tqdm, + typing-extensions, + numpy, + pandas, + pandas-stubs, + # check deps + pytestCheckHook, + dirty-equals, + inline-snapshot, + nest-asyncio, + pytest-asyncio, + pytest-mock, + respx, + sources, +}: +buildPythonPackage rec { + pname = "openai"; + version = sources.openai-python.version; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = sources.openai-python; + + build-system = [ + hatchling + hatch-fancy-pypi-readme + ]; + + dependencies = [ + anyio + distro + httpx + jiter + pydantic + sniffio + tqdm + typing-extensions + ]; + + optional-dependencies = { + datalib = [ + numpy + pandas + pandas-stubs + ]; + }; + + pythonImportsCheck = ["openai"]; + + nativeCheckInputs = [ + pytestCheckHook + dirty-equals + inline-snapshot + nest-asyncio + pytest-asyncio + pytest-mock + respx + ]; + + pytestFlagsArray = [ + "-W" + "ignore::DeprecationWarning" + ]; + + disabledTests = [ + # Tests make network requests + "test_copy_build_request" + "test_basic_attribute_access_works" + ]; + + disabledTestPaths = [ + # Test makes network requests + "tests/api_resources" + ]; + + meta = with lib; { + description = "Python client library for the OpenAI API"; + homepage = "https://github.com/openai/openai-python"; + changelog = "https://github.com/openai/openai-python/releases/tag/v${version}"; + license = licenses.mit; + maintainers = with maintainers; [malo]; + mainProgram = "openai"; + }; +} diff --git a/Omni/Bild/Nixpkgs.nix b/Omni/Bild/Nixpkgs.nix index fb9a6b1..3418673 100644 --- a/Omni/Bild/Nixpkgs.nix +++ b/Omni/Bild/Nixpkgs.nix @@ -15,25 +15,35 @@ let # package overlays, because of the 'null' from 'overrideSource' depsOverlay = _: pkgs: pkgs.overridePinnedDeps pkgs.overrideSource; - overlays = [ - (_: _: {inherit sources;}) - (import ./CcacheWrapper.nix) - (import ./Functions.nix) - depsOverlay - (import ./Deps.nix) - (import ./Python.nix) - (import ./Haskell.nix) - # backport newer packages from unstable - (_: _: {unstable = nixos-unstable-small.pkgs;}) - (import "${sources.nvidia-patch-nixos}/overlay.nix") - ]; + this = { + nixos-24_11 = import sources.nixos-24_11 { + inherit system config; + overlays = [ + (_: _: {inherit sources;}) + (import ./CcacheWrapper.nix) + (import ./Functions.nix) + depsOverlay + (_: _: {unstable = this.nixos-unstable-small.pkgs;}) + (import ./Deps.nix) + (import ./Python.nix) + (import ./Haskell.nix) + (import "${sources.nvidia-patch-nixos}/overlay.nix") + ]; + }; - nixos-unstable-small = - import sources.nixos-unstable-small {inherit system config overlays;}; -in { - nixos-24_05 = import sources.nixos-24_05 {inherit system config overlays;}; - - nixos-24_11 = import sources.nixos-24_11 {inherit system config overlays;}; - - inherit nixos-unstable-small; -} + nixos-unstable-small = import sources.nixos-unstable-small { + inherit system config; + overlays = [ + (_: _: {inherit sources;}) + (import ./CcacheWrapper.nix) + (import ./Functions.nix) + depsOverlay + (import ./Deps.nix) + (import ./Python.nix) + (import ./Haskell.nix) + (import "${sources.nvidia-patch-nixos}/overlay.nix") + ]; + }; + }; +in + this diff --git a/Omni/Bild/Python.nix b/Omni/Bild/Python.nix index 035b11c..36abe25 100644 --- a/Omni/Bild/Python.nix +++ b/Omni/Bild/Python.nix @@ -1,13 +1,28 @@ _self: super: { python312 = super.python312.override { - packageOverrides = _pyself: pysuper: + packageOverrides = pyself: pysuper: with pysuper.pkgs.python312Packages; let dontCheck = p: p.overridePythonAttrs (_: {doCheck = false;}); in { interegular = callPackage ./Deps/interegular.nix {}; ipython = dontCheck pysuper.ipython; + llm = super.overrideSrc pysuper.llm super.sources.llm; + llm-ollama = pysuper.pkgs.python312.pkgs.callPackage ./Deps/llm-ollama.nix { + ollama = pyself.ollama; + }; + llm-sentence-transformers = callPackage ./Deps/llm-sentence-transformers.nix {}; ludic = callPackage ./Deps/ludic.nix {}; mypy = dontCheck pysuper.mypy; + ollama = pysuper.ollama.overridePythonAttrs (old: rec { + dependencies = old.dependencies ++ [pysuper.pydantic]; + version = super.sources.ollama-python.version; + src = super.sources.ollama-python; + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail "0.0.0" "${version}" + ''; + }); + openai = callPackage ./Deps/openai-python.nix {}; outlines = callPackage ./Deps/outlines.nix {}; perscache = callPackage ./Deps/perscache.nix {}; tokenizers = dontCheck pysuper.tokenizers; diff --git a/Omni/Bild/Sources.json b/Omni/Bild/Sources.json index 5d3706d..02472c3 100644 --- a/Omni/Bild/Sources.json +++ b/Omni/Bild/Sources.json @@ -69,12 +69,12 @@ "homepage": "https://llm.datasette.io", "owner": "simonw", "repo": "llm", - "rev": "0.13.1", - "sha256": "0305xpmigk219i2n1slgpz3jwvpx5pdp5s8dkjz85w75xivakbin", + "rev": "41d64a8f1239322e12aa11c17450054f0c654ed7", + "sha256": "1vyg0wmcxv8910iz4cx9vjb3y4fq28423p62cgzr308ra8jii719", "type": "tarball", - "url": "https://github.com/simonw/llm/archive/0.13.1.tar.gz", + "url": "https://github.com/simonw/llm/archive/41d64a8f1239322e12aa11c17450054f0c654ed7.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz", - "version": "0.13.1" + "version": "0.21" }, "niv": { "branch": "master", @@ -152,10 +152,10 @@ "homepage": "", "owner": "nixos", "repo": "nixpkgs", - "rev": "a5e6a9e979367ee14f65d9c38119c30272f8455f", - "sha256": "08yfk81kpsizdzlbi8whpaarb0w0rw9aynlrvhn5gr5dfpv9hbsf", + "rev": "ff0654c494b7484c4854ddabecdb91b0b7f7c4d0", + "sha256": "0iq3ygljsf28qzlawdxyipd467ha9chy75sj938wgvxc4qaaipk6", "type": "tarball", - "url": "https://github.com/nixos/nixpkgs/archive/a5e6a9e979367ee14f65d9c38119c30272f8455f.tar.gz", + "url": "https://github.com/nixos/nixpkgs/archive/ff0654c494b7484c4854ddabecdb91b0b7f7c4d0.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, "nvidia-patch-nixos": { @@ -170,6 +170,29 @@ "url": "https://github.com/icewind1991/nvidia-patch-nixos/archive/bb8ac52eff4c4e8df0a18ab444263f2619d0d25a.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, + "ollama-python": { + "branch": "main", + "description": "Ollama Python library", + "homepage": "https://ollama.com", + "owner": "ollama", + "repo": "ollama-python", + "rev": "ee349ecc6d05ea57c9e91bc9345e2db3bc79bb5b", + "sha256": "1dkrdkw7gkr9ilfb34qh9vwm0231csg7raln69p00p4mvx2w53gi", + "type": "tarball", + "url": "https://github.com/ollama/ollama-python/archive/refs/tags/v0.4.5.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/refs/tags/v<version>.tar.gz", + "version": "0.4.5" + }, + "openai-python": { + "branch": "main", + "description": "The official Python library for the OpenAI API", + "homepage": "https://pypi.org/project/openai/", + "owner": "openai", + "repo": "https://github.com/openai/openai-python", + "rev": "5e3e4d1b0f16ccc4469a90a5bff09cafe0de7a2e", + "type": "git", + "version": "1.56.1" + }, "outlines": { "branch": "main", "description": "Generative Model Programming", |