langtrace-python-sdk 2.0.4__py3-none-any.whl → 2.0.6__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.
Files changed (59) hide show
  1. examples/anthropic_example/completion.py +1 -1
  2. examples/chroma_example/basic.py +1 -1
  3. examples/cohere_example/chat.py +7 -3
  4. examples/cohere_example/chat_stream.py +7 -2
  5. examples/cohere_example/embed.py +2 -1
  6. examples/cohere_example/rerank.py +2 -1
  7. examples/cohere_example/tools.py +21 -5
  8. examples/fastapi_example/basic_route.py +1 -1
  9. examples/hiveagent_example/basic.py +1 -1
  10. examples/langchain_example/groq_example.py +3 -1
  11. examples/langchain_example/langgraph_example.py +11 -12
  12. examples/llamaindex_example/agent.py +1 -1
  13. examples/llamaindex_example/basic.py +1 -1
  14. examples/openai_example/async_tool_calling_nonstreaming.py +11 -4
  15. examples/openai_example/async_tool_calling_streaming.py +41 -29
  16. examples/openai_example/chat_completion.py +12 -8
  17. examples/openai_example/embeddings_create.py +2 -1
  18. examples/openai_example/function_calling.py +11 -6
  19. examples/openai_example/images_generate.py +2 -1
  20. examples/openai_example/tool_calling.py +1 -1
  21. examples/openai_example/tool_calling_nonstreaming.py +11 -3
  22. examples/openai_example/tool_calling_streaming.py +42 -29
  23. examples/perplexity_example/basic.py +1 -1
  24. examples/pinecone_example/basic.py +4 -1
  25. examples/qdrant_example/basic.py +8 -6
  26. langtrace_python_sdk/constants/instrumentation/groq.py +0 -2
  27. langtrace_python_sdk/extensions/langtrace_exporter.py +4 -12
  28. langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +1 -2
  29. langtrace_python_sdk/instrumentation/anthropic/patch.py +14 -4
  30. langtrace_python_sdk/instrumentation/chroma/patch.py +4 -2
  31. langtrace_python_sdk/instrumentation/cohere/instrumentation.py +6 -3
  32. langtrace_python_sdk/instrumentation/groq/instrumentation.py +3 -1
  33. langtrace_python_sdk/instrumentation/groq/patch.py +26 -11
  34. langtrace_python_sdk/instrumentation/langchain/patch.py +4 -2
  35. langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +1 -2
  36. langtrace_python_sdk/instrumentation/langchain_community/patch.py +4 -3
  37. langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +3 -1
  38. langtrace_python_sdk/instrumentation/langchain_core/patch.py +4 -2
  39. langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +17 -8
  40. langtrace_python_sdk/instrumentation/langgraph/patch.py +47 -26
  41. langtrace_python_sdk/instrumentation/llamaindex/patch.py +3 -1
  42. langtrace_python_sdk/instrumentation/openai/instrumentation.py +7 -3
  43. langtrace_python_sdk/instrumentation/openai/patch.py +40 -17
  44. langtrace_python_sdk/instrumentation/pinecone/patch.py +4 -2
  45. langtrace_python_sdk/instrumentation/qdrant/patch.py +4 -2
  46. langtrace_python_sdk/langtrace.py +131 -64
  47. langtrace_python_sdk/types/__init__.py +29 -0
  48. langtrace_python_sdk/utils/llm.py +2 -4
  49. langtrace_python_sdk/utils/with_root_span.py +3 -3
  50. langtrace_python_sdk/version.py +1 -1
  51. {langtrace_python_sdk-2.0.4.dist-info → langtrace_python_sdk-2.0.6.dist-info}/METADATA +2 -2
  52. {langtrace_python_sdk-2.0.4.dist-info → langtrace_python_sdk-2.0.6.dist-info}/RECORD +59 -58
  53. tests/chroma/test_chroma.py +26 -20
  54. tests/langchain/test_langchain.py +29 -16
  55. tests/langchain/test_langchain_community.py +28 -15
  56. tests/langchain/test_langchain_core.py +52 -26
  57. tests/pinecone/test_pinecone.py +27 -18
  58. {langtrace_python_sdk-2.0.4.dist-info → langtrace_python_sdk-2.0.6.dist-info}/WHEEL +0 -0
  59. {langtrace_python_sdk-2.0.4.dist-info → langtrace_python_sdk-2.0.6.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=g7xiDDlnA-bc_tbfOsDVeCOMja-y_9v9ByYKhK83Rt4,717
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=RT4yi8mhN_bgTbeGZnHEscLT9z_VlFnHekIM9psefLk,870
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=iPxOp8BGyBreHw0_pZRInUPwubALVvAJbWecdvy3sNU,868
8
- examples/cohere_example/chat_stream.py,sha256=SEcE8dTemOP8XZUxd08gn8nnBNlZfWa2t4tqnmmC7_Y,609
9
- examples/cohere_example/embed.py,sha256=PzhEBNUdBlHKXBT95c3wp5GFtNvPu58ywHlcPE3MkVE,525
10
- examples/cohere_example/rerank.py,sha256=mFCX4nNfKDmxqyCPqWCWqKjRS0XXH4M9txT-tzcKliw,1147
11
- examples/cohere_example/tools.py,sha256=kBN3cqMeBy-jOlSnFszx0bud6niEy1SsBehLMimBWVw,1434
12
- examples/fastapi_example/basic_route.py,sha256=O0gaAdYgdbZ1LElV5JuJyq-FZMHcfJCysqQPpKa8fNI,1128
13
- examples/hiveagent_example/basic.py,sha256=MuzPMHtrhkxv2T7Ke8Rz3TsSum_XZ0IyPc2ufOt0U1Y,444
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=GaQTufs4UPoWAimNbeH1wFGkM6NcSEfbzHy1jE2EL8M,773
17
- examples/langchain_example/langgraph_example.py,sha256=h9tuPrLJ857U7Iz0RshW1LWbPjWYco-WvEP7t-xnJZY,1998
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=_iIXy9lfDz6ySf6aTeeRqejlfGnXZ7msxLBjGiJth3E,2777
21
- examples/llamaindex_example/basic.py,sha256=gvns3oDUy0c4I5ewnj9-B36_1La8y6qD3VQaq6v3syM,654
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=foomPKwpju0PMazdE3xNrdZWguUYMnNXibqq01-uBvc,3806
25
- examples/openai_example/async_tool_calling_streaming.py,sha256=TayOsb0jcYYlFpnWWUYxwCVKuJhTfGfE8LkjYJNGSz4,6900
26
- examples/openai_example/chat_completion.py,sha256=ib5lj89lnDBK2iErsQmBTlsWMbRUxyoqNQDIKHGrHVI,1235
27
- examples/openai_example/embeddings_create.py,sha256=fqmTXdzqFabUbtu9dzoL-TR0fEURnv8zI_oLQoX_l6o,504
28
- examples/openai_example/function_calling.py,sha256=wyGMlvTPnBe4MFGcnMt-B0_cmiVmd5pEBbr6ATexxaA,2187
29
- examples/openai_example/images_generate.py,sha256=xV9XAJnax4TmCXsyDnzSL9zhh2VtojwpfWf0k7nGCOQ,472
30
- examples/openai_example/tool_calling.py,sha256=M2zq2zW_qXQr1GlAUePnglICZTzC5j5QA8hTzyHnOi4,2319
31
- examples/openai_example/tool_calling_nonstreaming.py,sha256=RrJaLbbs82bkCZ8tIu6u9re95gDDgUb6nT3TYbDBTn0,3778
32
- examples/openai_example/tool_calling_streaming.py,sha256=WnWWlgDqKuqN2DtWbpJs_JvmmQehBZp0Ke3ZXvCJdQw,6860
33
- examples/perplexity_example/basic.py,sha256=oTLwEYlvpD4wEnqEUrUSlQ0SeQ0u50Jeab4ggkikQg0,671
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=OkYjN3J5kxw-kloOV3Q-iyI6opkbarWsMom-_AMP2ZA,893
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=2JDMsBllnRvVDuuZ91FkAkpXgnavUP4mqXa51CtfHP8,1421
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=HuGbzXM_oqIzpfFDyV2nxuEe4C3SCxDlS1qFzswXzY4,4762
40
- langtrace_python_sdk/version.py,sha256=ZOg41aCgKEuObK5WhegikXektFWPJaeZ-TMDh0Ke95M,22
39
+ langtrace_python_sdk/langtrace.py,sha256=z6CL_e2aQUXJlTUzel0IL2zBVAa5lxRR01b88GfaBuY,6576
40
+ langtrace_python_sdk/version.py,sha256=4Yxft_MNOtwQG58mZpa8eoM0XBHa8VNkTPH9_i0gDaM,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=gi-l7hIczdkpjCV8-9VqxY9tQLHEK-As3WESlP8gkus,136
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=3KKeWSLECAxO-FMTndwF5Evv39t9-GG7p67DfYJpNEY,4194
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=Tum7OhRRim2cTxlMdYk3iFjWTtQdx9HBd8TtbZ02l64,1690
57
- langtrace_python_sdk/instrumentation/anthropic/patch.py,sha256=TU9Z8f7Yniu7NCBoqKHF__V1dUF6fJOKVvvw4ZHGBS8,8249
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=gGBX-zLQcOWUWt596PudOJftZcHge0mA_X1ltW3C800,2802
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=XAs95fPBh2TTd6E1qUbi-FUg7PClW3Y6P1eOq2f38VA,2228
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=LHzJkICjflnvAhRzEM7s-Pd9tRKlI3qLOYg0_vYDos0,1826
66
- langtrace_python_sdk/instrumentation/groq/patch.py,sha256=uuEAPZQXGmvuMAb6lIV-1elz9kNe7L3wDwIASUjrQAQ,25572
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=NdDeSTAxPvUdWkJS1ntwNXmS5o7vtNhWqgYOxm9IsjA,3789
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=6mNHzZwfLOAswYykRbxDBUeqVEx3ZIyf6iKxRxQe3jM,5198
72
- langtrace_python_sdk/instrumentation/langchain_community/patch.py,sha256=-uuFDk3OdrgBv2oVyYWpyCgzIhfJRpt04HgLHcsu3Vk,3745
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=pYEDl5XD2jlIb7BqNX89eZRqMn05PXy0UhpuyQPNTOM,5931
75
- langtrace_python_sdk/instrumentation/langchain_core/patch.py,sha256=8WspiRAIV_pgC8fLfdmjQqgjvoHXvudx-FL9qC6L9mw,8451
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=C26-sSFQSohFgcooeisFz3jj1rEhrwemRyLwFa4qoFw,2374
78
- langtrace_python_sdk/instrumentation/langgraph/patch.py,sha256=HDz4twVGKDWtR0vggikhKGPglAOOXOV33ktyH_Yghl8,4043
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=oytT6EujmCd1Zf5ccde5juiucnDpYiIHjz-jan284Zk,4183
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=kXu8zmppMepYvXRoVG9ERx__0xfSQ8uyPPWTihmrlAk,2712
84
- langtrace_python_sdk/instrumentation/openai/patch.py,sha256=UYEA23SO3XDJbhIXAkZ5xAiBuItwSjebGL45RsKNJdo,36645
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=WweBK2-9PbnmwNVN4EnxbriM9CDL079RonN5ZbpBRIE,2698
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=acT3Jqibsab_usHKRUc61CmXWEeH-mKyTxZiK2oUO3k,2800
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=KA5ZL397_ktSpAnIOpxYTaSjaaAoxdHYfiAzbbfFfNA,2022
93
- langtrace_python_sdk/utils/with_root_span.py,sha256=FOiCV59IAhO861ftbwSCIbU9d4a2EBBjxsqc5HPlZf8,2452
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=5zeInDcP5VplrM9ex2iuVKcpVKMDfEf_ZDK9D6Tc700,2392
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=GGGRcxz0isNmegeum37XFrlJqI6jB6_iUvv8AJ5iG24,2481
112
- tests/langchain/test_langchain_community.py,sha256=m9lBmMZIeUouKSq1JfdBupV0-0ef39GD6BKsA0Cf_08,2515
113
- tests/langchain/test_langchain_core.py,sha256=hCuKkIUvDQOUBM2oEgMG3Iq_KNTwC2sH7_Y_IR5FIno,4238
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=_wlJbSKnY7gyzVcwxIWKft1P_t8dWwcIKNfGCrRLiHs,2633
124
- langtrace_python_sdk-2.0.4.dist-info/METADATA,sha256=XjCobjWDtvEejEkuyfq_aQebtTgd04WPx-H5BajSDQA,9585
125
- langtrace_python_sdk-2.0.4.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
126
- langtrace_python_sdk-2.0.4.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
127
- langtrace_python_sdk-2.0.4.dist-info/RECORD,,
124
+ tests/pinecone/test_pinecone.py,sha256=iFuAqzbfrxHzH_J2kDCbezqYv1m-yeQiHiO3rMKTuYc,2735
125
+ langtrace_python_sdk-2.0.6.dist-info/METADATA,sha256=To2Jd-L4FM7sHtVWbVbSU19s0BQKynZm9LKboKRLrmQ,9582
126
+ langtrace_python_sdk-2.0.6.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
127
+ langtrace_python_sdk-2.0.6.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
128
+ langtrace_python_sdk-2.0.6.dist-info/RECORD,,
@@ -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
- self.chroma_mock, self.tracer, self.span = common_setup(self.data, 'chromadb.Collection.add')
19
- self.wrapped_method = MagicMock(return_value="mocked method result")
20
- self.instance = MagicMock()
21
- self.instance.name = "aa"
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(self.tracer.start_as_current_span.called_once_with("chromadb.Collection.add", kind=SpanKind.CLIENT))
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
- 'langtrace.sdk.name': 'langtrace-python-sdk',
43
- 'langtrace.service.name': 'Chroma',
44
- 'langtrace.service.type': 'vectordb',
45
- 'langtrace.service.version': '1.2.3',
46
- 'langtrace.version': '1.0.0',
47
- 'db.system': 'chromadb',
48
- 'db.operation': 'add',
49
- 'db.collection.name': 'aa',
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
- if __name__ == '__main__':
64
- unittest.main()
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 = {'key': 'value'}
30
- version = importlib.metadata.version('langchain')
30
+ kwargs = {"key": "value"}
31
+ version = importlib.metadata.version("langchain")
31
32
 
32
33
  # Act
33
- wrapped_function = generic_patch("langchain.text_splitter", task, self.tracer, version, trace_output, trace_input)
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(self.tracer.start_as_current_span.called_once_with(method_name, kind=SpanKind.CLIENT))
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
- 'langtrace.sdk.name': 'langtrace-python-sdk',
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()], any_order=True
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
- if __name__ == '__main__':
69
- unittest.main()
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 = {'key': 'value'}
31
+ kwargs = {"key": "value"}
30
32
  version = importlib.metadata.version("langchain-community")
31
33
 
32
34
  # Act
33
- wrapped_function = generic_patch("langchain_community.vectorstores.faiss", task, self.tracer, version, trace_output, trace_input)
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(self.tracer.start_as_current_span.called_once_with(method_name, kind=SpanKind.CLIENT))
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
- 'langtrace.sdk.name': 'langtrace-python-sdk',
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()], any_order=True
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__ == '__main__':
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 generic_patch, runnable_patch
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 = {'key': 'value'}
34
+ kwargs = {"key": "value"}
30
35
  version = importlib.metadata.version("langchain-core")
31
36
 
32
37
  # Act
33
- wrapped_function = generic_patch("langchain_core.retrievers", task , self.tracer, version, trace_output, trace_input)
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(self.tracer.start_as_current_span.called_once_with(method_name, kind=SpanKind.CLIENT))
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
- 'langtrace.sdk.name': 'langtrace-python-sdk',
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()], any_order=True
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 = {'key': 'value'}
88
+ kwargs = {"key": "value"}
73
89
  version = importlib.metadata.version("langchain-core")
74
90
 
75
91
  # Act
76
- wrapped_function = runnable_patch("langchain_core.runnables.passthrough",
77
- "runnablepassthrough", self.tracer, version, trace_output, trace_input)
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(self.tracer.start_as_current_span.called_once_with(method_name, kind=SpanKind.CLIENT))
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
- 'langtrace.sdk.name': 'langtrace-python-sdk',
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()], any_order=True
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__ == '__main__':
115
- unittest.main()
140
+ if __name__ == "__main__":
141
+ unittest.main()