1{
2 lib,
3 aiolimiter,
4 azure-identity,
5 azure-storage-blob,
6 buildPythonPackage,
7 fetchPypi,
8 hatchling,
9 httpx,
10 json-repair,
11 openai,
12 pydantic,
13 pytest-asyncio,
14 pytestCheckHook,
15 pythonOlder,
16 tenacity,
17 tiktoken,
18}:
19
20buildPythonPackage rec {
21 pname = "fnllm";
22 version = "0.0.12";
23 pyproject = true;
24
25 disabled = pythonOlder "3.11";
26
27 src = fetchPypi {
28 inherit pname version;
29 hash = "sha256-qWZ//i1Xd6vWp3TlZz+TNJQGb1Ym8/edn4BV8e5wkjM=";
30 };
31
32 build-system = [ hatchling ];
33
34 dependencies = [
35 aiolimiter
36 httpx
37 json-repair
38 pydantic
39 tenacity
40 ];
41
42 optional-dependencies = {
43 azure = [
44 azure-identity
45 azure-storage-blob
46 ];
47 openai = [
48 openai
49 tiktoken
50 ];
51 };
52
53 nativeCheckInputs = [
54 pytest-asyncio
55 pytestCheckHook
56 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
57
58 pythonImportsCheck = [ "fnllm" ];
59
60 disabledTests = [
61 # Tests require network access
62 "chat"
63 "embeddings"
64 "rate_limited"
65 "test_default_operations"
66 "test_estimate_request_tokens"
67 "test_replace_value"
68 ];
69
70 disabledTestPaths = [
71 "tests/unit/caching/test_blob.py"
72 ];
73
74 meta = {
75 description = "A function-based LLM protocol and wrapper";
76 homepage = "https://github.com/microsoft/essex-toolkit/tree/main/python/fnllm";
77 license = lib.licenses.mit;
78 maintainers = with lib.maintainers; [ fab ];
79 };
80}