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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
# build-system
hatchling,
# dependencies
aiohttp,
docstring-parser,
jinja2,
jiter,
openai,
pydantic,
requests,
rich,
tenacity,
typer,
# tests
anthropic,
diskcache,
fastapi,
google-genai,
google-generativeai,
pytest-asyncio,
pytestCheckHook,
python-dotenv,
redis,
}:
buildPythonPackage rec {
pname = "instructor";
version = "1.11.3";
pyproject = true;
src = fetchFromGitHub {
owner = "jxnl";
repo = "instructor";
tag = "v${version}";
hash = "sha256-VWFrMgfe92bHUK1hueqJLHQ7G7ATCgK7wXr+eqrVWcw=";
};
build-system = [ hatchling ];
pythonRelaxDeps = [
"jiter"
"openai"
"rich"
];
dependencies = [
aiohttp
docstring-parser
jinja2
jiter
openai
pydantic
requests
rich
tenacity
typer
];
nativeCheckInputs = [
anthropic
diskcache
fastapi
google-genai
google-generativeai
pytest-asyncio
pytestCheckHook
python-dotenv
redis
];
pythonImportsCheck = [ "instructor" ];
disabledTests = [
# Tests require OpenAI API key
"successfully"
"test_mode_functions_deprecation_warning"
"test_partial"
"test_provider_invalid_type_raises_error"
# Requires unpackaged `vertexai`
"test_json_preserves_description_of_non_english_characters_in_json_mode"
# Checks magic values and this fails on Python 3.13
"test_raw_base64_autodetect_jpeg"
"test_raw_base64_autodetect_png"
# Performance benchmarks that sometimes fail when running many parallel builds
"test_combine_system_messages_benchmark"
"test_extract_system_messages_benchmark"
# pydantic validation mismatch
"test_control_characters_not_allowed_in_anthropic_json_strict_mode"
"test_control_characters_allowed_in_anthropic_json_non_strict_mode"
];
disabledTestPaths = [
# Tests require OpenAI API key
"tests/llm/"
# Network and requires API keys
"tests/test_auto_client.py"
# annoying dependencies
"tests/docs"
"examples"
];
meta = {
description = "Structured outputs for llm";
homepage = "https://github.com/jxnl/instructor";
changelog = "https://github.com/jxnl/instructor/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ mic92 ];
mainProgram = "instructor";
};
}
|