1{
2 lib,
3 callPackage,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9 llm,
10
11 # dependencies
12 click,
13 ollama,
14 pydantic,
15
16 # tests
17 pytestCheckHook,
18 pytest-asyncio,
19 pytest-mock,
20 writableTmpDirAsHomeHook,
21}:
22
23buildPythonPackage rec {
24 pname = "llm-ollama";
25 version = "0.10.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "taketwo";
30 repo = "llm-ollama";
31 tag = version;
32 hash = "sha256-IA9Tb82XB+Gr6YwMVqzsw1dPtT3GWK2W/ZtuDVznF1A";
33 };
34
35 build-system = [
36 setuptools
37 # Follows the reasoning from https://github.com/NixOS/nixpkgs/pull/327800#discussion_r1681586659 about including llm in build-system
38 llm
39 ];
40
41 dependencies = [
42 click
43 ollama
44 pydantic
45 ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 pytest-asyncio
50 pytest-mock
51 writableTmpDirAsHomeHook
52 ];
53
54 pythonImportsCheck = [
55 "llm_ollama"
56 ];
57
58 passthru.tests = {
59 llm-plugin = callPackage ./tests/llm-plugin.nix { };
60 };
61
62 meta = {
63 description = "LLM plugin providing access to Ollama models using HTTP API";
64 homepage = "https://github.com/taketwo/llm-ollama";
65 changelog = "https://github.com/taketwo/llm-ollama/releases/tag/${version}";
66 license = lib.licenses.asl20;
67 maintainers = with lib.maintainers; [ erethon ];
68 };
69}