langtrace-python-sdk 2.0.3__py3-none-any.whl → 2.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- examples/anthropic_example/completion.py +1 -1
- examples/chroma_example/basic.py +1 -1
- examples/cohere_example/chat.py +7 -3
- examples/cohere_example/chat_stream.py +7 -2
- examples/cohere_example/embed.py +2 -1
- examples/cohere_example/rerank.py +2 -1
- examples/cohere_example/tools.py +21 -5
- examples/fastapi_example/basic_route.py +1 -1
- examples/hiveagent_example/basic.py +1 -1
- examples/langchain_example/groq_example.py +3 -1
- examples/langchain_example/langgraph_example.py +11 -12
- examples/llamaindex_example/agent.py +1 -1
- examples/llamaindex_example/basic.py +1 -1
- examples/openai_example/async_tool_calling_nonstreaming.py +11 -4
- examples/openai_example/async_tool_calling_streaming.py +41 -29
- examples/openai_example/chat_completion.py +12 -8
- examples/openai_example/embeddings_create.py +2 -1
- examples/openai_example/function_calling.py +11 -6
- examples/openai_example/images_generate.py +2 -1
- examples/openai_example/tool_calling.py +1 -1
- examples/openai_example/tool_calling_nonstreaming.py +11 -3
- examples/openai_example/tool_calling_streaming.py +42 -29
- examples/perplexity_example/basic.py +1 -1
- examples/pinecone_example/basic.py +4 -1
- examples/qdrant_example/basic.py +8 -6
- langtrace_python_sdk/constants/instrumentation/groq.py +0 -2
- langtrace_python_sdk/extensions/langtrace_exporter.py +4 -12
- langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +1 -2
- langtrace_python_sdk/instrumentation/anthropic/patch.py +14 -4
- langtrace_python_sdk/instrumentation/chroma/patch.py +4 -2
- langtrace_python_sdk/instrumentation/cohere/instrumentation.py +6 -3
- langtrace_python_sdk/instrumentation/groq/instrumentation.py +3 -1
- langtrace_python_sdk/instrumentation/groq/patch.py +26 -11
- langtrace_python_sdk/instrumentation/langchain/patch.py +4 -2
- langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +1 -2
- langtrace_python_sdk/instrumentation/langchain_community/patch.py +4 -3
- langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +3 -1
- langtrace_python_sdk/instrumentation/langchain_core/patch.py +4 -2
- langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +17 -8
- langtrace_python_sdk/instrumentation/langgraph/patch.py +47 -26
- langtrace_python_sdk/instrumentation/llamaindex/patch.py +3 -1
- langtrace_python_sdk/instrumentation/openai/instrumentation.py +7 -3
- langtrace_python_sdk/instrumentation/openai/patch.py +40 -19
- langtrace_python_sdk/instrumentation/pinecone/patch.py +4 -2
- langtrace_python_sdk/instrumentation/qdrant/patch.py +4 -2
- langtrace_python_sdk/langtrace.py +128 -64
- langtrace_python_sdk/types/__init__.py +29 -0
- langtrace_python_sdk/utils/llm.py +2 -4
- langtrace_python_sdk/utils/with_root_span.py +3 -3
- langtrace_python_sdk/version.py +1 -1
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/METADATA +2 -2
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/RECORD +59 -58
- tests/chroma/test_chroma.py +26 -20
- tests/langchain/test_langchain.py +29 -16
- tests/langchain/test_langchain_community.py +28 -15
- tests/langchain/test_langchain_core.py +52 -26
- tests/pinecone/test_pinecone.py +27 -18
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/WHEEL +0 -0
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
examples/anthropic_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
examples/anthropic_example/completion.py,sha256=
|
|
3
|
+
examples/anthropic_example/completion.py,sha256=PVxAth2vqbX_QN2DGVOt2mTGuUiGk4O5w7RFhHzsxA8,714
|
|
4
4
|
examples/chroma_example/__init__.py,sha256=Tq6pae7fHA7dwuDslabB5MTNedL21gu2RaZicpxSyLU,25
|
|
5
|
-
examples/chroma_example/basic.py,sha256=
|
|
5
|
+
examples/chroma_example/basic.py,sha256=qngW9EQtIeuBFjyWdPPiJAE1xnVimKqkglJQz9cqueM,867
|
|
6
6
|
examples/cohere_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
examples/cohere_example/chat.py,sha256=
|
|
8
|
-
examples/cohere_example/chat_stream.py,sha256=
|
|
9
|
-
examples/cohere_example/embed.py,sha256=
|
|
10
|
-
examples/cohere_example/rerank.py,sha256=
|
|
11
|
-
examples/cohere_example/tools.py,sha256=
|
|
12
|
-
examples/fastapi_example/basic_route.py,sha256=
|
|
13
|
-
examples/hiveagent_example/basic.py,sha256=
|
|
7
|
+
examples/cohere_example/chat.py,sha256=0iNVE3sxX6fZBSRozzx9a8M7HI4QtP1BIjNguBO32rw,915
|
|
8
|
+
examples/cohere_example/chat_stream.py,sha256=9hT5whG_W002jxHSXgpQR6imaoQJ10ydte3cFuXc8fE,638
|
|
9
|
+
examples/cohere_example/embed.py,sha256=9yNyl2_aJun-0n1v4B_H6PlCeO7LQDIuMagRzwC3OWs,523
|
|
10
|
+
examples/cohere_example/rerank.py,sha256=Zy1H7TwXHOGulYAMkfOe-hB0YmJIfwfPurYxj__l_98,1145
|
|
11
|
+
examples/cohere_example/tools.py,sha256=I_uCDHQiLRD4uCmeXRUTYNtTgO_efy809Pik1j-Usfw,1683
|
|
12
|
+
examples/fastapi_example/basic_route.py,sha256=VXb9r8usZRqQOwS4bzonsP0jFYhvfZecbK8zYcOxAl4,1125
|
|
13
|
+
examples/hiveagent_example/basic.py,sha256=Sd7I5w8w5Xx7ODaydTY30yiq9HwJDMKHQywrZjgehP0,441
|
|
14
14
|
examples/langchain_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
examples/langchain_example/basic.py,sha256=mSVcE-Kx7jNS4U_zrm5WZI98xyw6WTrhd2GMVGgn9Cg,2653
|
|
16
|
-
examples/langchain_example/groq_example.py,sha256=
|
|
17
|
-
examples/langchain_example/langgraph_example.py,sha256=
|
|
16
|
+
examples/langchain_example/groq_example.py,sha256=9dBbOWZCVJ29PpB1NbJhc9MThmtwrlOpdNIxPl7d8f8,787
|
|
17
|
+
examples/langchain_example/langgraph_example.py,sha256=7C2a4Sg0PKbbab03CVkStO3MzT7C-O1UtdmObvBXurM,2005
|
|
18
18
|
examples/langchain_example/tool.py,sha256=8T8_IDbgA58XbsfyH5_xhA8ZKQfyfyFxF8wor-PsRjA,2556
|
|
19
19
|
examples/llamaindex_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
examples/llamaindex_example/agent.py,sha256=
|
|
21
|
-
examples/llamaindex_example/basic.py,sha256=
|
|
20
|
+
examples/llamaindex_example/agent.py,sha256=41uxHpMKqIB4irD8YHu6Y0QI3pDfz79huUHroQwhfDA,2774
|
|
21
|
+
examples/llamaindex_example/basic.py,sha256=kcl2RykIzq1Lv9KePzp_TCcdp_PFXxt3vsspb5p-5HI,651
|
|
22
22
|
examples/llamaindex_example/data/abramov.txt,sha256=Ou-GyWZm5AjHLgxviBoRE9ikNv5MScsF0cd--0vVVhI,32667
|
|
23
23
|
examples/openai_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
examples/openai_example/async_tool_calling_nonstreaming.py,sha256=
|
|
25
|
-
examples/openai_example/async_tool_calling_streaming.py,sha256=
|
|
26
|
-
examples/openai_example/chat_completion.py,sha256=
|
|
27
|
-
examples/openai_example/embeddings_create.py,sha256=
|
|
28
|
-
examples/openai_example/function_calling.py,sha256=
|
|
29
|
-
examples/openai_example/images_generate.py,sha256=
|
|
30
|
-
examples/openai_example/tool_calling.py,sha256=
|
|
31
|
-
examples/openai_example/tool_calling_nonstreaming.py,sha256=
|
|
32
|
-
examples/openai_example/tool_calling_streaming.py,sha256=
|
|
33
|
-
examples/perplexity_example/basic.py,sha256=
|
|
24
|
+
examples/openai_example/async_tool_calling_nonstreaming.py,sha256=7mP6Anonj7B8owPBfbhxyux4mdgp3XCuym1xAx6SLls,3874
|
|
25
|
+
examples/openai_example/async_tool_calling_streaming.py,sha256=PQMHSWAN1DfgjK88b8LVSredmov0uH9Fgn1FHoCVv1M,7054
|
|
26
|
+
examples/openai_example/chat_completion.py,sha256=f2rMHJU1Dph_fAOv9qCksvtldl1s9UitEeLsvyoSpGA,1253
|
|
27
|
+
examples/openai_example/embeddings_create.py,sha256=d05rArTWxsmCxOdTRaGw3n9Yt1HXxOHHCtciCHIwBGc,502
|
|
28
|
+
examples/openai_example/function_calling.py,sha256=rrnrFw2HyV_gv4TdwUr299baP4tIupz6EQWWmLDtJkU,2265
|
|
29
|
+
examples/openai_example/images_generate.py,sha256=SZNY8Visk7JUpx5QhNxTNINHmPAGdCUayF-Q7_iCr50,470
|
|
30
|
+
examples/openai_example/tool_calling.py,sha256=_IV7KoSI_37u1TTZWdVa58BYjkDfhSurvM86xwaNNhY,2316
|
|
31
|
+
examples/openai_example/tool_calling_nonstreaming.py,sha256=Yc848IooZRXNynHL6z0kOgJ4qbmL_NOufcb2VmWRukI,3847
|
|
32
|
+
examples/openai_example/tool_calling_streaming.py,sha256=mV1RbyAoVhumGRPpqPWQ6PMhnJyeifrlELd2-K1qJ_w,7015
|
|
33
|
+
examples/perplexity_example/basic.py,sha256=bp7n27gaugJkaFVyt8pjaEfi66lYcqP6eFFjPewUShY,668
|
|
34
34
|
examples/pinecone_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
examples/pinecone_example/basic.py,sha256=
|
|
35
|
+
examples/pinecone_example/basic.py,sha256=9IWMoMLozMTpxjY8BFBg2EpUNY5dDjU1xocEG9XsXP0,966
|
|
36
36
|
examples/qdrant_example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
-
examples/qdrant_example/basic.py,sha256=
|
|
37
|
+
examples/qdrant_example/basic.py,sha256=DCMjHSuBZKkhEjCkwy5d5La9WMyW0lCWqtcZWiFCEm4,1425
|
|
38
38
|
langtrace_python_sdk/__init__.py,sha256=q2TAsxGIv4wFIQA7G-HGxlnzO89bhPU5TgI42sPHLj0,740
|
|
39
|
-
langtrace_python_sdk/langtrace.py,sha256=
|
|
40
|
-
langtrace_python_sdk/version.py,sha256=
|
|
39
|
+
langtrace_python_sdk/langtrace.py,sha256=7eJB-aF-iZssv4pvm3nzVHXYFLJAcfP8SMVGekOgldQ,6438
|
|
40
|
+
langtrace_python_sdk/version.py,sha256=xEb7Z4b8xalXXExBg42XPAhbJKniHzcsEPjp-6S3ppg,22
|
|
41
41
|
langtrace_python_sdk/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=5MNjnAOg-4am78J3gVMH6FSwq5N8TOj72ugkhsw4vi0,46
|
|
43
43
|
langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -45,52 +45,53 @@ langtrace_python_sdk/constants/instrumentation/anthropic.py,sha256=YX3llt3zwDY6X
|
|
|
45
45
|
langtrace_python_sdk/constants/instrumentation/chroma.py,sha256=hiPGYdHS0Yj4Kh3eaYBbuCAl_swqIygu80yFqkOgdak,955
|
|
46
46
|
langtrace_python_sdk/constants/instrumentation/cohere.py,sha256=tf9sDfb5K3qOAHChEE5o8eYWPZ1io58VsOjZDCZPxfw,577
|
|
47
47
|
langtrace_python_sdk/constants/instrumentation/common.py,sha256=nrWGQf6m-GV_v8-RGbaFrrEeUWZ6pNcYzUWCy-PoQpc,726
|
|
48
|
-
langtrace_python_sdk/constants/instrumentation/groq.py,sha256=
|
|
48
|
+
langtrace_python_sdk/constants/instrumentation/groq.py,sha256=VFXmIl4aqGY_fS0PAmjPj_Qm7Tibxbx7Ur_e7rQpqXc,134
|
|
49
49
|
langtrace_python_sdk/constants/instrumentation/openai.py,sha256=9VF6ic9Ed3bpSvdp6iNmrpx2Ppo6DPav3hoUcqSQSv0,1048
|
|
50
50
|
langtrace_python_sdk/constants/instrumentation/pinecone.py,sha256=Xaqqw-xBO0JJLGk75hiCUQGztNm0HiVaLQvjtYK7VJM,472
|
|
51
51
|
langtrace_python_sdk/constants/instrumentation/qdrant.py,sha256=yL7BopNQTXW7L7Z-gVM2PdusKD7r9qqcATvczFd7NtQ,1999
|
|
52
52
|
langtrace_python_sdk/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
langtrace_python_sdk/extensions/langtrace_exporter.py,sha256=
|
|
53
|
+
langtrace_python_sdk/extensions/langtrace_exporter.py,sha256=s-4zc7lba1va_JUReFdLgyBKlvwV1KmBt_OzVmWReQg,3610
|
|
54
54
|
langtrace_python_sdk/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
55
|
langtrace_python_sdk/instrumentation/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
|
-
langtrace_python_sdk/instrumentation/anthropic/instrumentation.py,sha256
|
|
57
|
-
langtrace_python_sdk/instrumentation/anthropic/patch.py,sha256=
|
|
56
|
+
langtrace_python_sdk/instrumentation/anthropic/instrumentation.py,sha256=-srgE8qumAn0ulQYZxMa8ch-9IBH0XgBW_rfEnGk6LI,1684
|
|
57
|
+
langtrace_python_sdk/instrumentation/anthropic/patch.py,sha256=koAo6bA6nnRDk01fcrArqnyAmgzjxV20ofITMQyKVws,8427
|
|
58
58
|
langtrace_python_sdk/instrumentation/chroma/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
59
|
langtrace_python_sdk/instrumentation/chroma/instrumentation.py,sha256=nT6PS6bsrIOO9kLV5GuUeRjMe6THHHAZGvqWBP1dYog,1807
|
|
60
|
-
langtrace_python_sdk/instrumentation/chroma/patch.py,sha256=
|
|
60
|
+
langtrace_python_sdk/instrumentation/chroma/patch.py,sha256=qytjkZxntUe7XyAvVoiEvFgUIXNU52o9BnYLAnQ9M20,2809
|
|
61
61
|
langtrace_python_sdk/instrumentation/cohere/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
|
-
langtrace_python_sdk/instrumentation/cohere/instrumentation.py,sha256=
|
|
62
|
+
langtrace_python_sdk/instrumentation/cohere/instrumentation.py,sha256=YQFHZIBd7SSPD4b6Va-ZR0thf_AuBCqj5yzHLHJVWnM,2121
|
|
63
63
|
langtrace_python_sdk/instrumentation/cohere/patch.py,sha256=hdSWArP0cdfGs0Q5KhkaowkwrYQIzxvF8NpY4sg8p2Q,26563
|
|
64
64
|
langtrace_python_sdk/instrumentation/groq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
|
-
langtrace_python_sdk/instrumentation/groq/instrumentation.py,sha256=
|
|
66
|
-
langtrace_python_sdk/instrumentation/groq/patch.py,sha256=
|
|
65
|
+
langtrace_python_sdk/instrumentation/groq/instrumentation.py,sha256=Ttf07XVKhdYY1_fqJc7QWiSdmgEhEVyQB_3Az2_wqYo,1832
|
|
66
|
+
langtrace_python_sdk/instrumentation/groq/patch.py,sha256=Fo5QbNwScFwhvmXZQezbjF0AdajsHQ8a0f8nKsVFjF8,26068
|
|
67
67
|
langtrace_python_sdk/instrumentation/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
langtrace_python_sdk/instrumentation/langchain/instrumentation.py,sha256=_Z4AeNb2hBPSCvMRxE-mUfmkUO_wP_tGGtu-jppWPiI,3462
|
|
69
|
-
langtrace_python_sdk/instrumentation/langchain/patch.py,sha256=
|
|
69
|
+
langtrace_python_sdk/instrumentation/langchain/patch.py,sha256=2BT_-DjfSPTmyHDqnpj-gVrMFxRSZugVC-YRPXnuupU,3796
|
|
70
70
|
langtrace_python_sdk/instrumentation/langchain_community/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
|
-
langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py,sha256
|
|
72
|
-
langtrace_python_sdk/instrumentation/langchain_community/patch.py,sha256
|
|
71
|
+
langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py,sha256=-9E2-8-XR5PQ5ON-_ib53p5Tp0uD4MT4Ioh4MlWlF2k,5192
|
|
72
|
+
langtrace_python_sdk/instrumentation/langchain_community/patch.py,sha256=uyRUp02M9mYjLsr36ZBCvJC7s40AGry3R_EcjvXaoWk,3751
|
|
73
73
|
langtrace_python_sdk/instrumentation/langchain_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
-
langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py,sha256=
|
|
75
|
-
langtrace_python_sdk/instrumentation/langchain_core/patch.py,sha256=
|
|
74
|
+
langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py,sha256=KNXHtlnq80akLACF-vbPCo9oVXhnVjYIM1Lo7kNRwEg,5937
|
|
75
|
+
langtrace_python_sdk/instrumentation/langchain_core/patch.py,sha256=Kqpv77ZKrZ4QMit36JtN59ubtWE8pX6t8gg6OOmIii0,8458
|
|
76
76
|
langtrace_python_sdk/instrumentation/langgraph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
|
-
langtrace_python_sdk/instrumentation/langgraph/instrumentation.py,sha256=
|
|
78
|
-
langtrace_python_sdk/instrumentation/langgraph/patch.py,sha256=
|
|
77
|
+
langtrace_python_sdk/instrumentation/langgraph/instrumentation.py,sha256=SUZZhWSIbcfsF1S5NtEqW8QzkRM_pKAuXB7pwk5tsOU,2526
|
|
78
|
+
langtrace_python_sdk/instrumentation/langgraph/patch.py,sha256=fr90kuPokwxP2BGP2tU793ReDOp2FtehKMcsxS9tS_0,4589
|
|
79
79
|
langtrace_python_sdk/instrumentation/llamaindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
80
|
langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py,sha256=8iAg-Oxwf2W4S60qRfO5mvzORYxublgq7FdGWqUB4q8,2965
|
|
81
|
-
langtrace_python_sdk/instrumentation/llamaindex/patch.py,sha256=
|
|
81
|
+
langtrace_python_sdk/instrumentation/llamaindex/patch.py,sha256=q99qmEBNH54Oi_sHCIGBQFpIE4zaNKVjIWARlX8fJ-M,4189
|
|
82
82
|
langtrace_python_sdk/instrumentation/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
|
-
langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=
|
|
84
|
-
langtrace_python_sdk/instrumentation/openai/patch.py,sha256=
|
|
83
|
+
langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=G2HSZfr6DuP2n-8v0h91M60m0DJWFBcru4-1FQJl-5A,2726
|
|
84
|
+
langtrace_python_sdk/instrumentation/openai/patch.py,sha256=kQxc_E1IlOgHZnlc0HbpGjM5rZCDR3YpNFChp2X9GbM,37263
|
|
85
85
|
langtrace_python_sdk/instrumentation/pinecone/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
86
|
langtrace_python_sdk/instrumentation/pinecone/instrumentation.py,sha256=52GbkfRK-sxXBXhHmHRRO2BGNd6zZVHDp8njLS1CQX0,2314
|
|
87
|
-
langtrace_python_sdk/instrumentation/pinecone/patch.py,sha256=
|
|
87
|
+
langtrace_python_sdk/instrumentation/pinecone/patch.py,sha256=ebz57WgmlTnY-FDwQgJ-_eqsknEmDWfh-AiNow4G94s,2705
|
|
88
88
|
langtrace_python_sdk/instrumentation/qdrant/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
89
|
langtrace_python_sdk/instrumentation/qdrant/instrumentation.py,sha256=vl2eKSP55aqDo1JiRlvOUBrr6kddvG9Z5dCYew2OG08,1816
|
|
90
|
-
langtrace_python_sdk/instrumentation/qdrant/patch.py,sha256=
|
|
90
|
+
langtrace_python_sdk/instrumentation/qdrant/patch.py,sha256=skVziJbvoR7XYTI6KmsiQlclTmQEeLeJ5UrJLvi7fjw,2807
|
|
91
|
+
langtrace_python_sdk/types/__init__.py,sha256=QYK-kRkyfXDdzjjKmXVxi0vZ6Wpbxdf0CoZbTXO0JT8,787
|
|
91
92
|
langtrace_python_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
92
|
-
langtrace_python_sdk/utils/llm.py,sha256=
|
|
93
|
-
langtrace_python_sdk/utils/with_root_span.py,sha256=
|
|
93
|
+
langtrace_python_sdk/utils/llm.py,sha256=Cl710-0rfr15g1xNkOpLpgCn84pNlfMflcQ4S5jSRu0,2010
|
|
94
|
+
langtrace_python_sdk/utils/with_root_span.py,sha256=MXF-FmG47P0GtJQNffKM_3XGrJHVAC4hMB6GmwtnA4M,2454
|
|
94
95
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
95
96
|
tests/conftest.py,sha256=0Jo6iCZTXbdvyJVhG9UpYGkLabL75378oauCzmt-Sa8,603
|
|
96
97
|
tests/utils.py,sha256=hP8sTH-M8WO6zlLkSFHPf6483ZcKEcnxul6JIIb1pLM,1396
|
|
@@ -99,7 +100,7 @@ tests/anthropic/test_anthropic.py,sha256=p4WhcECJ_zctirtkAX6WejrlNfZzo90fSSxqQki
|
|
|
99
100
|
tests/anthropic/cassettes/test_anthropic.yaml,sha256=z7YAqA_BBgI-hw7uyVMdLoIZdBYhKwl9cuTzUu9nAZs,2332
|
|
100
101
|
tests/anthropic/cassettes/test_anthropic_streaming.yaml,sha256=D0w4-6dfsgrhbNLJEj8gZBV0yXfrAfA9u90Yu8Ac-TY,11675
|
|
101
102
|
tests/anthropic/cassettes/test_async_anthropic_streaming.yaml,sha256=hQZPY2vwBaW3BWllLd0lcGQ73DjA8C3Ips1Hx9pA-ao,8373
|
|
102
|
-
tests/chroma/test_chroma.py,sha256=
|
|
103
|
+
tests/chroma/test_chroma.py,sha256=bVWC_OwmarTgVzKxZy5lrXpJzu9v9Ko6uQdktxOVh74,2430
|
|
103
104
|
tests/cohere/conftest.py,sha256=jBbyg-tut-ZJN5_5D64sGmaPIhT_nQQQAiW43kl5Rz4,621
|
|
104
105
|
tests/cohere/test_cohere_chat.py,sha256=MioEIXB5e-4t99Vt-KpLlxd4diPbp3S6eNfnPWjEDXM,4564
|
|
105
106
|
tests/cohere/test_cohere_embed.py,sha256=bFKDzUnypMyLefAOHR-6dEgvt0yys2Yw7-F0zc0uQyc,1250
|
|
@@ -108,9 +109,9 @@ tests/cohere/cassettes/test_cohere_chat.yaml,sha256=_Az6Kfhp1XmoK6zwTxqbnRYTmsm0
|
|
|
108
109
|
tests/cohere/cassettes/test_cohere_chat_streaming.yaml,sha256=TdWe64Pyfa5Ho9lqTMIW41YntUmUwmYQc55qWntbvas,10610
|
|
109
110
|
tests/cohere/cassettes/test_cohere_embed.yaml,sha256=YAxJ3otY9N6jJQOKi50nQA4xY9-dknm1oXEP8KiCH5U,27312
|
|
110
111
|
tests/cohere/cassettes/test_cohere_rerank.yaml,sha256=m5EAKAM5JEcGMyUlmjaxU-cNLiXKcenSFQyU-UaUI0U,2392
|
|
111
|
-
tests/langchain/test_langchain.py,sha256=
|
|
112
|
-
tests/langchain/test_langchain_community.py,sha256=
|
|
113
|
-
tests/langchain/test_langchain_core.py,sha256=
|
|
112
|
+
tests/langchain/test_langchain.py,sha256=p1YkeL1U23b0E3vhEcXonwMa3QGUswQjKNReMbV0ndA,2576
|
|
113
|
+
tests/langchain/test_langchain_community.py,sha256=B7Z7YRx7v9507wEyDnXV1NKVYo4r2XU0YplugfYVsJ0,2615
|
|
114
|
+
tests/langchain/test_langchain_core.py,sha256=LBeoK27-uDethSvBGykYAlCVfEwljQrN7sZL91TVCPw,4467
|
|
114
115
|
tests/openai/conftest.py,sha256=BkehS6heg-O91Nzoc4546OSiAzy8KgSgk7VCO3A11zM,700
|
|
115
116
|
tests/openai/test_chat_completion.py,sha256=-TwCAF2czsiGZqETQvMOgmIJgdFWycJ9nOeO5q65AJs,5804
|
|
116
117
|
tests/openai/test_embeddings.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -120,8 +121,8 @@ tests/openai/cassettes/test_async_image_generation.yaml,sha256=_LYZcrqxrnSqcWVQn
|
|
|
120
121
|
tests/openai/cassettes/test_chat_completion.yaml,sha256=YkNFgK9VHAzNqGWuxFcTiE194GdEie8eDf1FSsffjd8,2944
|
|
121
122
|
tests/openai/cassettes/test_chat_completion_streaming.yaml,sha256=nkx_TemQMYSZxUF_b-LCEFwCRDm0AkQHLf4sdJVuZBw,2592394
|
|
122
123
|
tests/openai/cassettes/test_image_generation.yaml,sha256=gn5aSVp6V6_hb_rt2NnkAWd_idzDxo-7VzhZII0Wslw,3562
|
|
123
|
-
tests/pinecone/test_pinecone.py,sha256=
|
|
124
|
-
langtrace_python_sdk-2.0.
|
|
125
|
-
langtrace_python_sdk-2.0.
|
|
126
|
-
langtrace_python_sdk-2.0.
|
|
127
|
-
langtrace_python_sdk-2.0.
|
|
124
|
+
tests/pinecone/test_pinecone.py,sha256=iFuAqzbfrxHzH_J2kDCbezqYv1m-yeQiHiO3rMKTuYc,2735
|
|
125
|
+
langtrace_python_sdk-2.0.5.dist-info/METADATA,sha256=cOseMAA5zkwb-uP451n57vptbNZf2pHgU_tm3lhfzX0,9582
|
|
126
|
+
langtrace_python_sdk-2.0.5.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
|
127
|
+
langtrace_python_sdk-2.0.5.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
128
|
+
langtrace_python_sdk-2.0.5.dist-info/RECORD,,
|
tests/chroma/test_chroma.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from unittest.mock import MagicMock, patch, call
|
|
2
|
-
from langtrace_python_sdk.constants.instrumentation.common import
|
|
3
|
-
SERVICE_PROVIDERS
|
|
2
|
+
from langtrace_python_sdk.constants.instrumentation.common import SERVICE_PROVIDERS
|
|
4
3
|
from langtrace_python_sdk.constants.instrumentation.openai import APIS
|
|
5
|
-
from opentelemetry.trace.status import StatusCode,Status
|
|
4
|
+
from opentelemetry.trace.status import StatusCode, Status
|
|
6
5
|
from langtrace_python_sdk.instrumentation.chroma.patch import collection_patch
|
|
7
6
|
from opentelemetry.trace import SpanKind
|
|
8
7
|
from tests.utils import common_setup
|
|
@@ -14,11 +13,14 @@ class TestChromaPatch(unittest.TestCase):
|
|
|
14
13
|
data = {
|
|
15
14
|
"status": "success",
|
|
16
15
|
}
|
|
16
|
+
|
|
17
17
|
def setUp(self):
|
|
18
|
-
|
|
19
|
-
self.
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
self.chroma_mock, self.tracer, self.span = common_setup(
|
|
19
|
+
self.data, "chromadb.Collection.add"
|
|
20
|
+
)
|
|
21
|
+
self.wrapped_method = MagicMock(return_value="mocked method result")
|
|
22
|
+
self.instance = MagicMock()
|
|
23
|
+
self.instance.name = "aa"
|
|
22
24
|
|
|
23
25
|
def tearDown(self):
|
|
24
26
|
self.chroma_mock.stop()
|
|
@@ -35,18 +37,22 @@ class TestChromaPatch(unittest.TestCase):
|
|
|
35
37
|
self.assertEqual(result, "mocked method result")
|
|
36
38
|
|
|
37
39
|
# Assert the span is started with the correct parameters
|
|
38
|
-
self.assertTrue(
|
|
40
|
+
self.assertTrue(
|
|
41
|
+
self.tracer.start_as_current_span.called_once_with(
|
|
42
|
+
"chromadb.Collection.add", kind=SpanKind.CLIENT
|
|
43
|
+
)
|
|
44
|
+
)
|
|
39
45
|
|
|
40
46
|
# Verify span attributes are set as expected
|
|
41
47
|
expected_attributes = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
49
|
+
"langtrace.service.name": "Chroma",
|
|
50
|
+
"langtrace.service.type": "vectordb",
|
|
51
|
+
"langtrace.service.version": "1.2.3",
|
|
52
|
+
"langtrace.version": "1.0.0",
|
|
53
|
+
"db.system": "chromadb",
|
|
54
|
+
"db.operation": "add",
|
|
55
|
+
"db.collection.name": "aa",
|
|
50
56
|
}
|
|
51
57
|
for key, value in expected_attributes.items():
|
|
52
58
|
self.span.set_attribute.assert_has_calls([call(key, value)], any_order=True)
|
|
@@ -55,10 +61,10 @@ class TestChromaPatch(unittest.TestCase):
|
|
|
55
61
|
|
|
56
62
|
for key, value in expected_attributes.items():
|
|
57
63
|
self.assertIn(call(key, value), actual_calls)
|
|
58
|
-
|
|
64
|
+
|
|
59
65
|
# Assert the span status is set to OK
|
|
60
66
|
self.span.set_status.assert_called_with(StatusCode.OK)
|
|
61
|
-
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
unittest.main()
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import unittest
|
|
3
2
|
from unittest.mock import MagicMock, call
|
|
4
3
|
from langtrace_python_sdk.instrumentation.langchain.patch import generic_patch
|
|
@@ -10,15 +9,17 @@ from opentelemetry.trace.status import Status, StatusCode
|
|
|
10
9
|
from tests.utils import common_setup
|
|
11
10
|
import json
|
|
12
11
|
|
|
12
|
+
|
|
13
13
|
class TestGenericPatch(unittest.TestCase):
|
|
14
14
|
data = {"key": "value"}
|
|
15
|
+
|
|
15
16
|
def setUp(self):
|
|
16
17
|
self.langchain_mock, self.tracer, self.span = common_setup(self.data, None)
|
|
17
18
|
|
|
18
19
|
def tearDown(self):
|
|
19
20
|
# Clean up after each test case
|
|
20
21
|
pass
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
def test_generic_patch(self):
|
|
23
24
|
# Arrange
|
|
24
25
|
method_name = "example_method"
|
|
@@ -26,44 +27,56 @@ class TestGenericPatch(unittest.TestCase):
|
|
|
26
27
|
trace_input = False # Change as per your requirement
|
|
27
28
|
args = (1, 2, 3)
|
|
28
29
|
task = "split_text"
|
|
29
|
-
kwargs = {
|
|
30
|
-
version = importlib.metadata.version(
|
|
30
|
+
kwargs = {"key": "value"}
|
|
31
|
+
version = importlib.metadata.version("langchain")
|
|
31
32
|
|
|
32
33
|
# Act
|
|
33
|
-
wrapped_function = generic_patch(
|
|
34
|
+
wrapped_function = generic_patch(
|
|
35
|
+
"langchain.text_splitter",
|
|
36
|
+
task,
|
|
37
|
+
self.tracer,
|
|
38
|
+
version,
|
|
39
|
+
trace_output,
|
|
40
|
+
trace_input,
|
|
41
|
+
)
|
|
34
42
|
result = wrapped_function(self.langchain_mock, MagicMock(), args, kwargs)
|
|
35
43
|
|
|
36
44
|
# Assert
|
|
37
|
-
self.assertTrue(
|
|
38
|
-
|
|
45
|
+
self.assertTrue(
|
|
46
|
+
self.tracer.start_as_current_span.called_once_with(
|
|
47
|
+
method_name, kind=SpanKind.CLIENT
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
|
|
39
51
|
service_provider = "Langchain"
|
|
40
52
|
expected_attributes = {
|
|
41
|
-
|
|
53
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
42
54
|
"langtrace.service.name": service_provider,
|
|
43
55
|
"langtrace.service.type": "framework",
|
|
44
56
|
"langtrace.service.version": version,
|
|
45
57
|
"langtrace.version": "1.0.0",
|
|
46
58
|
"langchain.task.name": task,
|
|
47
59
|
}
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
|
|
50
61
|
self.assertTrue(
|
|
51
62
|
self.span.set_attribute.has_calls(
|
|
52
|
-
[call(key, value) for key, value in expected_attributes.items()],
|
|
63
|
+
[call(key, value) for key, value in expected_attributes.items()],
|
|
64
|
+
any_order=True,
|
|
53
65
|
)
|
|
54
66
|
)
|
|
55
|
-
|
|
67
|
+
|
|
56
68
|
actual_calls = self.span.set_attribute.call_args_list
|
|
57
69
|
|
|
58
70
|
for key, value in expected_attributes.items():
|
|
59
71
|
self.assertIn(call(key, value), actual_calls)
|
|
60
|
-
|
|
72
|
+
|
|
61
73
|
self.assertEqual(self.span.set_status.call_count, 1)
|
|
62
74
|
self.assertTrue(self.span.set_status.has_calls([call(Status(StatusCode.OK))]))
|
|
63
75
|
|
|
64
|
-
expected_result_data = {"key": "value"
|
|
76
|
+
expected_result_data = {"key": "value"}
|
|
65
77
|
|
|
66
78
|
self.assertEqual(result.key, expected_result_data["key"])
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
unittest.main()
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import unittest
|
|
3
2
|
from unittest.mock import MagicMock, Mock, patch, call
|
|
4
3
|
from langtrace_python_sdk.instrumentation.langchain_community.patch import generic_patch
|
|
@@ -10,8 +9,11 @@ from langtrace_python_sdk.constants.instrumentation.openai import APIS
|
|
|
10
9
|
from opentelemetry.trace.status import Status, StatusCode
|
|
11
10
|
import json
|
|
12
11
|
from tests.utils import common_setup
|
|
12
|
+
|
|
13
|
+
|
|
13
14
|
class TestGenericPatch(unittest.TestCase):
|
|
14
15
|
data = {"key": "value"}
|
|
16
|
+
|
|
15
17
|
def setUp(self):
|
|
16
18
|
self.langchain_mock, self.tracer, self.span = common_setup(self.data, None)
|
|
17
19
|
|
|
@@ -23,47 +25,58 @@ class TestGenericPatch(unittest.TestCase):
|
|
|
23
25
|
# Arrange
|
|
24
26
|
method_name = "example_method"
|
|
25
27
|
trace_output = False
|
|
26
|
-
trace_input = False
|
|
28
|
+
trace_input = False
|
|
27
29
|
args = (1, 2, 3)
|
|
28
30
|
task = "vector_store"
|
|
29
|
-
kwargs = {
|
|
31
|
+
kwargs = {"key": "value"}
|
|
30
32
|
version = importlib.metadata.version("langchain-community")
|
|
31
33
|
|
|
32
34
|
# Act
|
|
33
|
-
wrapped_function = generic_patch(
|
|
35
|
+
wrapped_function = generic_patch(
|
|
36
|
+
"langchain_community.vectorstores.faiss",
|
|
37
|
+
task,
|
|
38
|
+
self.tracer,
|
|
39
|
+
version,
|
|
40
|
+
trace_output,
|
|
41
|
+
trace_input,
|
|
42
|
+
)
|
|
34
43
|
result = wrapped_function(self.langchain_mock, MagicMock(), args, kwargs)
|
|
35
44
|
|
|
36
45
|
# Assert
|
|
37
|
-
self.assertTrue(
|
|
38
|
-
|
|
46
|
+
self.assertTrue(
|
|
47
|
+
self.tracer.start_as_current_span.called_once_with(
|
|
48
|
+
method_name, kind=SpanKind.CLIENT
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
|
|
39
52
|
service_provider = "Langchain Community"
|
|
40
53
|
expected_attributes = {
|
|
41
|
-
|
|
54
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
42
55
|
"langtrace.service.name": service_provider,
|
|
43
56
|
"langtrace.service.type": "framework",
|
|
44
57
|
"langtrace.service.version": version,
|
|
45
58
|
"langtrace.version": "1.0.0",
|
|
46
59
|
"langchain.task.name": task,
|
|
47
60
|
}
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
|
|
50
62
|
self.assertTrue(
|
|
51
63
|
self.span.set_attribute.has_calls(
|
|
52
|
-
[call(key, value) for key, value in expected_attributes.items()],
|
|
64
|
+
[call(key, value) for key, value in expected_attributes.items()],
|
|
65
|
+
any_order=True,
|
|
53
66
|
)
|
|
54
67
|
)
|
|
55
|
-
|
|
68
|
+
|
|
56
69
|
actual_calls = self.span.set_attribute.call_args_list
|
|
57
70
|
|
|
58
71
|
for key, value in expected_attributes.items():
|
|
59
72
|
self.assertIn(call(key, value), actual_calls)
|
|
60
|
-
|
|
73
|
+
|
|
61
74
|
self.assertEqual(self.span.set_status.call_count, 1)
|
|
62
75
|
self.assertTrue(self.span.set_status.has_calls([call(Status(StatusCode.OK))]))
|
|
63
76
|
|
|
64
|
-
expected_result_data = {"key": "value"
|
|
77
|
+
expected_result_data = {"key": "value"}
|
|
65
78
|
self.assertEqual(result.key, expected_result_data["key"])
|
|
66
79
|
|
|
67
80
|
|
|
68
|
-
if __name__ ==
|
|
69
|
-
unittest.main()
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
unittest.main()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
1
|
import unittest
|
|
3
2
|
from unittest.mock import MagicMock, Mock, patch, call
|
|
4
|
-
from langtrace_python_sdk.instrumentation.langchain_core.patch import
|
|
3
|
+
from langtrace_python_sdk.instrumentation.langchain_core.patch import (
|
|
4
|
+
generic_patch,
|
|
5
|
+
runnable_patch,
|
|
6
|
+
)
|
|
5
7
|
from opentelemetry.trace import SpanKind
|
|
6
8
|
from opentelemetry.trace import get_tracer
|
|
7
9
|
import importlib.metadata
|
|
@@ -10,8 +12,11 @@ from langtrace_python_sdk.constants.instrumentation.openai import APIS
|
|
|
10
12
|
from opentelemetry.trace.status import Status, StatusCode
|
|
11
13
|
import json
|
|
12
14
|
from tests.utils import common_setup
|
|
15
|
+
|
|
16
|
+
|
|
13
17
|
class TestGenericPatch(unittest.TestCase):
|
|
14
18
|
data = {"items": "value"}
|
|
19
|
+
|
|
15
20
|
def setUp(self):
|
|
16
21
|
self.langchain_mock, self.tracer, self.span = common_setup(self.data, None)
|
|
17
22
|
|
|
@@ -23,67 +28,88 @@ class TestGenericPatch(unittest.TestCase):
|
|
|
23
28
|
# Arrange
|
|
24
29
|
method_name = "example_method"
|
|
25
30
|
trace_output = False
|
|
26
|
-
trace_input = True
|
|
31
|
+
trace_input = True
|
|
27
32
|
task = "retriever"
|
|
28
33
|
args = (1, 2, 3)
|
|
29
|
-
kwargs = {
|
|
34
|
+
kwargs = {"key": "value"}
|
|
30
35
|
version = importlib.metadata.version("langchain-core")
|
|
31
36
|
|
|
32
37
|
# Act
|
|
33
|
-
wrapped_function = generic_patch(
|
|
38
|
+
wrapped_function = generic_patch(
|
|
39
|
+
"langchain_core.retrievers",
|
|
40
|
+
task,
|
|
41
|
+
self.tracer,
|
|
42
|
+
version,
|
|
43
|
+
trace_output,
|
|
44
|
+
trace_input,
|
|
45
|
+
)
|
|
34
46
|
result = wrapped_function(self.langchain_mock, MagicMock(), args, kwargs)
|
|
35
47
|
|
|
36
48
|
# Assert
|
|
37
|
-
self.assertTrue(
|
|
38
|
-
|
|
49
|
+
self.assertTrue(
|
|
50
|
+
self.tracer.start_as_current_span.called_once_with(
|
|
51
|
+
method_name, kind=SpanKind.CLIENT
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
|
|
39
55
|
service_provider = "Langchain Core"
|
|
40
56
|
expected_attributes = {
|
|
41
|
-
|
|
57
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
42
58
|
"langtrace.service.name": service_provider,
|
|
43
59
|
"langtrace.service.type": "framework",
|
|
44
60
|
"langtrace.service.version": version,
|
|
45
61
|
"langtrace.version": "1.0.0",
|
|
46
62
|
"langchain.task.name": task,
|
|
47
63
|
}
|
|
48
|
-
|
|
64
|
+
|
|
49
65
|
self.assertTrue(
|
|
50
66
|
self.span.set_attribute.has_calls(
|
|
51
|
-
[call(key, value) for key, value in expected_attributes.items()],
|
|
67
|
+
[call(key, value) for key, value in expected_attributes.items()],
|
|
68
|
+
any_order=True,
|
|
52
69
|
)
|
|
53
70
|
)
|
|
54
|
-
|
|
71
|
+
|
|
55
72
|
actual_calls = self.span.set_attribute.call_args_list
|
|
56
73
|
for key, value in expected_attributes.items():
|
|
57
74
|
self.assertIn(call(key, value), actual_calls)
|
|
58
75
|
|
|
59
|
-
|
|
60
76
|
self.assertEqual(self.span.set_status.call_count, 1)
|
|
61
77
|
self.assertTrue(self.span.set_status.has_calls([call(Status(StatusCode.OK))]))
|
|
62
78
|
|
|
63
|
-
expected_result_data = {"items": "value"
|
|
79
|
+
expected_result_data = {"items": "value"}
|
|
64
80
|
self.assertEqual(result.items, expected_result_data["items"])
|
|
65
81
|
|
|
66
82
|
def test_runnable_patch(self):
|
|
67
83
|
# Arrange
|
|
68
84
|
method_name = "example_method"
|
|
69
85
|
trace_output = False
|
|
70
|
-
trace_input = True
|
|
86
|
+
trace_input = True
|
|
71
87
|
args = (1, 2, 3)
|
|
72
|
-
kwargs = {
|
|
88
|
+
kwargs = {"key": "value"}
|
|
73
89
|
version = importlib.metadata.version("langchain-core")
|
|
74
90
|
|
|
75
91
|
# Act
|
|
76
|
-
wrapped_function = runnable_patch(
|
|
77
|
-
|
|
92
|
+
wrapped_function = runnable_patch(
|
|
93
|
+
"langchain_core.runnables.passthrough",
|
|
94
|
+
"runnablepassthrough",
|
|
95
|
+
self.tracer,
|
|
96
|
+
version,
|
|
97
|
+
trace_output,
|
|
98
|
+
trace_input,
|
|
99
|
+
)
|
|
78
100
|
|
|
79
101
|
result = wrapped_function(self.langchain_mock, MagicMock(), args, kwargs)
|
|
80
102
|
|
|
81
103
|
# Assert
|
|
82
|
-
self.assertTrue(
|
|
83
|
-
|
|
104
|
+
self.assertTrue(
|
|
105
|
+
self.tracer.start_as_current_span.called_once_with(
|
|
106
|
+
method_name, kind=SpanKind.CLIENT
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
|
|
84
110
|
service_provider = "Langchain Core"
|
|
85
111
|
expected_attributes = {
|
|
86
|
-
|
|
112
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
87
113
|
"langtrace.service.name": service_provider,
|
|
88
114
|
"langtrace.service.type": "framework",
|
|
89
115
|
"langtrace.service.version": version,
|
|
@@ -93,23 +119,23 @@ class TestGenericPatch(unittest.TestCase):
|
|
|
93
119
|
|
|
94
120
|
self.assertTrue(
|
|
95
121
|
self.span.set_attribute.has_calls(
|
|
96
|
-
[call(key, value) for key, value in expected_attributes.items()],
|
|
122
|
+
[call(key, value) for key, value in expected_attributes.items()],
|
|
123
|
+
any_order=True,
|
|
97
124
|
)
|
|
98
125
|
)
|
|
99
|
-
|
|
126
|
+
|
|
100
127
|
actual_calls = self.span.set_attribute.call_args_list
|
|
101
128
|
|
|
102
129
|
for key, value in expected_attributes.items():
|
|
103
130
|
self.assertIn(call(key, value), actual_calls)
|
|
104
131
|
|
|
105
|
-
|
|
106
132
|
self.assertEqual(self.span.set_status.call_count, 1)
|
|
107
133
|
self.assertTrue(self.span.set_status.has_calls([call(Status(StatusCode.OK))]))
|
|
108
134
|
|
|
109
|
-
expected_result_data = {"items": "value"
|
|
135
|
+
expected_result_data = {"items": "value"}
|
|
110
136
|
|
|
111
137
|
self.assertEqual(result.items, expected_result_data["items"])
|
|
112
138
|
|
|
113
139
|
|
|
114
|
-
if __name__ ==
|
|
115
|
-
unittest.main()
|
|
140
|
+
if __name__ == "__main__":
|
|
141
|
+
unittest.main()
|