at master 2.3 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 7 # build-system 8 hatchling, 9 10 # dependencies 11 aiohttp, 12 docstring-parser, 13 jinja2, 14 jiter, 15 openai, 16 pydantic, 17 requests, 18 rich, 19 tenacity, 20 typer, 21 22 # tests 23 anthropic, 24 diskcache, 25 fastapi, 26 google-genai, 27 google-generativeai, 28 pytest-asyncio, 29 pytestCheckHook, 30 python-dotenv, 31 redis, 32}: 33 34buildPythonPackage rec { 35 pname = "instructor"; 36 version = "1.10.0"; 37 pyproject = true; 38 39 src = fetchFromGitHub { 40 owner = "jxnl"; 41 repo = "instructor"; 42 tag = version; 43 hash = "sha256-vknPfRHyLoLo2838p/fbjrqyaBORZzLp9+fN98yVDz0="; 44 }; 45 46 build-system = [ hatchling ]; 47 48 pythonRelaxDeps = [ "rich" ]; 49 50 dependencies = [ 51 aiohttp 52 docstring-parser 53 jinja2 54 jiter 55 openai 56 pydantic 57 requests 58 rich 59 tenacity 60 typer 61 ]; 62 63 nativeCheckInputs = [ 64 anthropic 65 diskcache 66 fastapi 67 google-genai 68 google-generativeai 69 pytest-asyncio 70 pytestCheckHook 71 python-dotenv 72 redis 73 ]; 74 75 pythonImportsCheck = [ "instructor" ]; 76 77 disabledTests = [ 78 # Tests require OpenAI API key 79 "successfully" 80 "test_mode_functions_deprecation_warning" 81 "test_partial" 82 83 # Requires unpackaged `vertexai` 84 "test_json_preserves_description_of_non_english_characters_in_json_mode" 85 86 # Checks magic values and this fails on Python 3.13 87 "test_raw_base64_autodetect_jpeg" 88 "test_raw_base64_autodetect_png" 89 90 # Performance benchmarks that sometimes fail when running many parallel builds 91 "test_combine_system_messages_benchmark" 92 "test_extract_system_messages_benchmark" 93 94 # pydantic validation mismatch 95 "test_control_characters_not_allowed_in_anthropic_json_strict_mode" 96 "test_control_characters_allowed_in_anthropic_json_non_strict_mode" 97 ]; 98 99 disabledTestPaths = [ 100 # Tests require OpenAI API key 101 "tests/llm/" 102 # Network and requires API keys 103 "tests/test_auto_client.py" 104 # annoying dependencies 105 "tests/docs" 106 "examples" 107 ]; 108 109 meta = { 110 description = "Structured outputs for llm"; 111 homepage = "https://github.com/jxnl/instructor"; 112 changelog = "https://github.com/jxnl/instructor/releases/tag/${src.tag}"; 113 license = lib.licenses.mit; 114 maintainers = with lib.maintainers; [ mic92 ]; 115 mainProgram = "instructor"; 116 }; 117}