about summary refs log tree commit diff
path: root/pkgs/development/python-modules/llmx/default.nix
blob: d5ddcfdaec42579d8dfbfb6d32148510229f275d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools-scm,
  setuptools,
  pythonOlder,
  pydantic,
  openai,
  tiktoken,
  diskcache,
  cohere,
  google-auth,
  typer,
  pyyaml,
  transformers,
  fastapi,
  uvicorn,
  accelerate,
}:

buildPythonPackage rec {
  pname = "llmx";
  version = "0.0.21a0";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-OEo6wIaDTktzAsP0rOmhxjFSHygTR/EpcRI6AXsu+6M=";
  };

  disabled = pythonOlder "3.9";

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    pydantic
    openai
    tiktoken
    diskcache
    cohere
    google-auth
    typer
    pyyaml
  ];

  passthru.optional-dependencies = {
    web = [
      fastapi
      uvicorn
    ];
    transformers = [
      accelerate
      transformers
    ] ++ transformers.optional-dependencies.torch;
  };

  # Tests of llmx try to access openai, google, etc.
  doCheck = false;

  pythonImportsCheck = [ "llmx" ];

  meta = with lib; {
    description = "Library for LLM Text Generation";
    homepage = "https://github.com/victordibia/llmx";
    mainProgram = "llmx";
    license = licenses.mit;
    maintainers = with maintainers; [ moraxyc ];
  };
}