at master 2.0 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 pybind11, 8 setuptools, 9 10 # dependencies 11 guidance-stitch, 12 jinja2, 13 llguidance, 14 numpy, 15 psutil, 16 pydantic, 17 requests, 18 19 # optional-dependencies 20 openai, 21 22 # tests 23 huggingface-hub, 24 jsonschema, 25 pytestCheckHook, 26 tokenizers, 27 torch, 28 writableTmpDirAsHomeHook, 29}: 30 31buildPythonPackage rec { 32 pname = "guidance"; 33 version = "0.3.0"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "guidance-ai"; 38 repo = "guidance"; 39 tag = version; 40 hash = "sha256-ZKHCnLGZdpr/R+vu7crijnKUFc+LMMxIdN9f6hYL7dk="; 41 }; 42 43 build-system = [ 44 pybind11 45 setuptools 46 ]; 47 48 pythonRelaxDeps = [ 49 "llguidance" 50 ]; 51 52 dependencies = [ 53 guidance-stitch 54 jinja2 55 llguidance 56 numpy 57 psutil 58 pydantic 59 requests 60 ]; 61 62 optional-dependencies = { 63 azureai = [ 64 # azure-ai-inference 65 openai 66 ]; 67 openai = [ openai ]; 68 }; 69 70 nativeCheckInputs = [ 71 huggingface-hub 72 jsonschema 73 pytestCheckHook 74 tokenizers 75 torch 76 writableTmpDirAsHomeHook 77 ]; 78 79 enabledTestPaths = [ "tests/unit" ]; 80 81 disabledTests = [ 82 # require network access 83 "test_ll_backtrack_stop" 84 "test_ll_dolphin" 85 "test_ll_fighter" 86 "test_ll_max_tokens" 87 "test_ll_nice_man" 88 "test_ll_nullable_bug" 89 "test_ll_nullable_lexeme" 90 "test_ll_pop_tokens" 91 "test_ll_stop_quote_comma" 92 "test_llparser" 93 "test_str_method_smoke" 94 95 # flaky tests 96 "test_remote_mock_gen" # frequently fails when building packages in parallel 97 ]; 98 99 preCheck = '' 100 rm tests/conftest.py 101 ''; 102 103 pythonImportsCheck = [ "guidance" ]; 104 105 __darwinAllowLocalNetworking = true; 106 107 meta = { 108 description = "Guidance language for controlling large language models"; 109 homepage = "https://github.com/guidance-ai/guidance"; 110 changelog = "https://github.com/guidance-ai/guidance/releases/tag/${src.tag}"; 111 license = lib.licenses.mit; 112 maintainers = with lib.maintainers; [ natsukium ]; 113 }; 114}