summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/openai-harmony/default.nix
blob: 7de7f6ed64689e68d7772684c6d1023fc80f3cea (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  rustPlatform,

  # dependencies
  pydantic,

  # optional-dependencies
  fastapi,
  uvicorn,
}:

buildPythonPackage rec {
  pname = "openai-harmony";
  version = "0.0.8";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "openai";
    repo = "harmony";
    rev = "v${version}";
    hash = "sha256-CaEldCrjBkjwsVeTzpiAFl/llAnUwJGTlU8Pt8YTV1E=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit pname version src;
    hash = "sha256-HeUK/S9nUDRTVkLf8CPrHfjBbyGZezZGu5P8XkfStVQ=";
  };

  nativeBuildInputs = [
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
  ];

  dependencies = [
    pydantic
  ];

  optional-dependencies = {
    demo = [
      fastapi
      uvicorn
    ];
  };

  pythonImportsCheck = [ "openai_harmony" ];

  # Tests require internet access
  doCheck = false;

  meta = {
    description = "Renderer for the harmony response format to be used with gpt-oss";
    homepage = "https://github.com/openai/harmony";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
}