1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 anyio,
6 backoff,
7 httpx,
8 idna,
9 langchain,
10 llama-index,
11 openai,
12 packaging,
13 poetry-core,
14 pydantic,
15 requests,
16 wrapt,
17}:
18
19buildPythonPackage rec {
20 pname = "langfuse";
21 version = "2.60.4";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "langfuse";
26 repo = "langfuse-python";
27 tag = "v${version}";
28 hash = "sha256-wUTh53FatAblzIvYqy7D+kuxyWtKc426By8bsSLFa38=";
29 };
30
31 build-system = [ poetry-core ];
32
33 pythonRelaxDeps = [ "packaging" ];
34
35 dependencies = [
36 anyio
37 backoff
38 httpx
39 idna
40 packaging
41 pydantic
42 requests
43 wrapt
44 ];
45
46 optional-dependencies = {
47 langchain = [ langchain ];
48 llama-index = [ llama-index ];
49 openai = [ openai ];
50 };
51
52 pythonImportsCheck = [ "langfuse" ];
53
54 # tests require network access and openai api key
55 doCheck = false;
56
57 meta = {
58 description = "Instrument your LLM app with decorators or low-level SDK and get detailed tracing/observability";
59 homepage = "https://github.com/langfuse/langfuse-python";
60 changelog = "https://github.com/langfuse/langfuse-python/releases/tag/${src.tag}";
61 license = lib.licenses.mit;
62 maintainers = with lib.maintainers; [ natsukium ];
63 };
64}