1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 rustPlatform,
8
9 # dependencies
10 pydantic,
11
12 # optional-dependencies
13 fastapi,
14 uvicorn,
15}:
16
17buildPythonPackage rec {
18 pname = "openai-harmony";
19 version = "0.0.4";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "openai";
24 repo = "harmony";
25 rev = "v${version}";
26 hash = "sha256-2LOrMLrNR1D3isbjiv5w+1Ni9IMwMEPPTOnG1rm//ag=";
27 };
28
29 cargoDeps = rustPlatform.fetchCargoVendor {
30 inherit pname version src;
31 hash = "sha256-tQq6PFMYghIfJu8CddbXFKXxr41GJaElbCCQuSpnaqk=";
32 };
33
34 nativeBuildInputs = [
35 rustPlatform.cargoSetupHook
36 rustPlatform.maturinBuildHook
37 ];
38
39 dependencies = [
40 pydantic
41 ];
42
43 optional-dependencies = {
44 demo = [
45 fastapi
46 uvicorn
47 ];
48 };
49
50 pythonImportsCheck = [ "openai_harmony" ];
51
52 # Tests require internet access
53 doCheck = false;
54
55 meta = {
56 description = "Renderer for the harmony response format to be used with gpt-oss";
57 homepage = "https://github.com/openai/harmony";
58 license = lib.licenses.asl20;
59 maintainers = with lib.maintainers; [ GaetanLepage ];
60 };
61}