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