1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pytestCheckHook, 6 pythonOlder, 7 pybind11, 8 setuptools, 9 wheel, 10 aiohttp, 11 diskcache, 12 fastapi, 13 gptcache, 14 msal, 15 numpy, 16 openai, 17 ordered-set, 18 platformdirs, 19 protobuf, 20 pyformlang, 21 requests, 22 tiktoken, 23 torch, 24 uvicorn, 25}: 26 27buildPythonPackage rec { 28 pname = "guidance"; 29 version = "0.1.11"; 30 pyproject = true; 31 32 disabled = pythonOlder "3.8"; 33 34 src = fetchFromGitHub { 35 owner = "guidance-ai"; 36 repo = "guidance"; 37 rev = "refs/tags/${version}"; 38 hash = "sha256-dvIJeSur3DdNBhrEPNPghxqmDEEig59Iz83LWksim6U="; 39 }; 40 41 nativeBuildInputs = [ pybind11 ]; 42 43 build-system = [ 44 setuptools 45 wheel 46 ]; 47 48 dependencies = [ 49 aiohttp 50 diskcache 51 fastapi 52 gptcache 53 msal 54 numpy 55 openai 56 ordered-set 57 platformdirs 58 protobuf 59 pyformlang 60 requests 61 tiktoken 62 uvicorn 63 ]; 64 65 nativeCheckInputs = [ 66 pytestCheckHook 67 torch 68 ]; 69 70 disabledTests = [ 71 # require network access 72 "test_select_simple" 73 "test_commit_point" 74 "test_token_healing" 75 "test_fstring" 76 "test_fstring_custom" 77 "test_token_count" 78 "test_gpt2" 79 "test_recursion_error" 80 "test_openai_class_detection" 81 "test_openai_chat_without_roles" 82 ]; 83 84 disabledTestPaths = [ 85 # require network access 86 "tests/library/test_gen.py" 87 ]; 88 89 preCheck = '' 90 export HOME=$TMPDIR 91 ''; 92 93 pythonImportsCheck = [ "guidance" ]; 94 95 __darwinAllowLocalNetworking = true; 96 97 meta = with lib; { 98 description = "A guidance language for controlling large language models"; 99 homepage = "https://github.com/guidance-ai/guidance"; 100 changelog = "https://github.com/guidance-ai/guidance/releases/tag/${src.rev}"; 101 license = licenses.mit; 102 maintainers = with maintainers; [ natsukium ]; 103 }; 104}