langtrace-python-sdk 2.1.29__py3-none-any.whl → 2.2.1__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 (55) hide show
  1. examples/cohere_example/chat.py +1 -0
  2. examples/cohere_example/chat_stream.py +3 -0
  3. examples/gemini_example/__init__.py +6 -0
  4. examples/gemini_example/function_tools.py +62 -0
  5. examples/gemini_example/main.py +91 -0
  6. examples/langchain_example/__init__.py +8 -0
  7. examples/langchain_example/groq_example.py +28 -15
  8. examples/ollama_example/basic.py +1 -0
  9. examples/openai_example/__init__.py +1 -0
  10. examples/openai_example/async_tool_calling_nonstreaming.py +1 -1
  11. examples/openai_example/chat_completion.py +1 -1
  12. examples/openai_example/embeddings_create.py +1 -0
  13. examples/openai_example/images_edit.py +2 -2
  14. examples/vertexai_example/__init__.py +6 -0
  15. examples/vertexai_example/main.py +214 -0
  16. langtrace_python_sdk/constants/instrumentation/common.py +2 -0
  17. langtrace_python_sdk/constants/instrumentation/gemini.py +12 -0
  18. langtrace_python_sdk/constants/instrumentation/vertexai.py +42 -0
  19. langtrace_python_sdk/instrumentation/__init__.py +4 -0
  20. langtrace_python_sdk/instrumentation/anthropic/patch.py +68 -96
  21. langtrace_python_sdk/instrumentation/chroma/patch.py +29 -29
  22. langtrace_python_sdk/instrumentation/cohere/patch.py +143 -242
  23. langtrace_python_sdk/instrumentation/gemini/__init__.py +3 -0
  24. langtrace_python_sdk/instrumentation/gemini/instrumentation.py +36 -0
  25. langtrace_python_sdk/instrumentation/gemini/patch.py +186 -0
  26. langtrace_python_sdk/instrumentation/groq/patch.py +82 -125
  27. langtrace_python_sdk/instrumentation/ollama/patch.py +62 -65
  28. langtrace_python_sdk/instrumentation/openai/patch.py +190 -494
  29. langtrace_python_sdk/instrumentation/qdrant/patch.py +6 -6
  30. langtrace_python_sdk/instrumentation/vertexai/__init__.py +3 -0
  31. langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +33 -0
  32. langtrace_python_sdk/instrumentation/vertexai/patch.py +131 -0
  33. langtrace_python_sdk/langtrace.py +5 -0
  34. langtrace_python_sdk/utils/__init__.py +14 -3
  35. langtrace_python_sdk/utils/llm.py +311 -6
  36. langtrace_python_sdk/version.py +1 -1
  37. {langtrace_python_sdk-2.1.29.dist-info → langtrace_python_sdk-2.2.1.dist-info}/METADATA +26 -19
  38. {langtrace_python_sdk-2.1.29.dist-info → langtrace_python_sdk-2.2.1.dist-info}/RECORD +55 -36
  39. tests/anthropic/test_anthropic.py +28 -27
  40. tests/cohere/test_cohere_chat.py +36 -36
  41. tests/cohere/test_cohere_embed.py +12 -9
  42. tests/cohere/test_cohere_rerank.py +18 -11
  43. tests/groq/cassettes/test_async_chat_completion.yaml +113 -0
  44. tests/groq/cassettes/test_async_chat_completion_streaming.yaml +2232 -0
  45. tests/groq/cassettes/test_chat_completion.yaml +114 -0
  46. tests/groq/cassettes/test_chat_completion_streaming.yaml +2512 -0
  47. tests/groq/conftest.py +33 -0
  48. tests/groq/test_groq.py +142 -0
  49. tests/openai/cassettes/test_async_chat_completion_streaming.yaml +28 -28
  50. tests/openai/test_chat_completion.py +53 -67
  51. tests/openai/test_image_generation.py +47 -24
  52. tests/utils.py +40 -5
  53. {langtrace_python_sdk-2.1.29.dist-info → langtrace_python_sdk-2.2.1.dist-info}/WHEEL +0 -0
  54. {langtrace_python_sdk-2.1.29.dist-info → langtrace_python_sdk-2.2.1.dist-info}/entry_points.txt +0 -0
  55. {langtrace_python_sdk-2.1.29.dist-info → langtrace_python_sdk-2.2.1.dist-info}/licenses/LICENSE +0 -0
@@ -4,8 +4,8 @@ examples/anthropic_example/completion.py,sha256=LXcuXxRx9hy4b9Woq0aCBx_PS0QYmYi2
4
4
  examples/chroma_example/__init__.py,sha256=Mrf8KptW1hhzu6WDdRRTxbaB-0kM7x5u-Goc_zR7G5c,203
5
5
  examples/chroma_example/basic.py,sha256=oO7-__8HptnFXLVKbnPgoz02yM-CAPi721xsbUb_gYg,868
6
6
  examples/cohere_example/__init__.py,sha256=oYpsnS-dKOlWLkPEUWhXxi1vfxa77bt_DOdkJHg__7g,502
7
- examples/cohere_example/chat.py,sha256=1CPrqr45UmhByxAn9on0L06ixVqS3jc9tLT88pduTzw,888
8
- examples/cohere_example/chat_stream.py,sha256=daWGrj2yucN9sWKGiPzTw18clh23Grv-MIJT_OpUkpA,611
7
+ examples/cohere_example/chat.py,sha256=A1ZSkkPPOj3h27VSSa_o_Thabz08ZUzUgTVgAG0pgcA,901
8
+ examples/cohere_example/chat_stream.py,sha256=BvhUgBEuyMhyzRZ_2i_SBvO9Ndf0b7-aRDyO399RyFE,664
9
9
  examples/cohere_example/embed.py,sha256=p9BJvOg09JVb8BfTCb63v3uh_wOsi_OyrCAJdXXrE6E,496
10
10
  examples/cohere_example/rerank.py,sha256=e7OU0A2FzfiQDuOmCy3Kg5LLNYGRmRIK5LqeLnTWlP4,1118
11
11
  examples/cohere_example/tools.py,sha256=a5uvS058tcwU6PJbF9EDO6LPVmPj2LoW4Vn8Web3Iq8,1656
@@ -16,11 +16,14 @@ examples/dspy_example/quiz_gen.py,sha256=OyGhepeX8meKOtLdmlYUjMD2ECk-ZQuQXUZif1h
16
16
  examples/dspy_example/react.py,sha256=APAnHqgy9w-qY5jnPD_WbBx6bwo9C-DhPnUuhL-t7sg,1376
17
17
  examples/fastapi_example/__init__.py,sha256=INIfvJP7zC_KkJCtulS1qbh61-MJTPAHnzAgzeKi0yU,87
18
18
  examples/fastapi_example/basic_route.py,sha256=_IRXjkOtJQ-bTIGa1WbvUF_2LF4bjghjyXt4YrHaRvw,1170
19
+ examples/gemini_example/__init__.py,sha256=omVgLyIiLc3c0zwy3vTtYKdeenYEXzEbLZsYiPEvJT4,81
20
+ examples/gemini_example/function_tools.py,sha256=ZOBrdPy_8s3NDfsF5A4RXIoUi2VXlD8og4UsWz_8AuQ,2700
21
+ examples/gemini_example/main.py,sha256=cTXqgOa6lEMwgX56uneM-1TbIY_QZtDRkByW5z0LpNk,2470
19
22
  examples/hiveagent_example/basic.py,sha256=Sd7I5w8w5Xx7ODaydTY30yiq9HwJDMKHQywrZjgehP0,441
20
23
  examples/inspect_ai_example/basic_eval.py,sha256=dUbF4yicNSG8HWxAfzS3V-813bpLyfb7Zdgo544yqGc,802
21
- examples/langchain_example/__init__.py,sha256=t28923ZDDejZabsvINnYwpLyb63WFwPde-Nmzdg-kH4,254
24
+ examples/langchain_example/__init__.py,sha256=xAys_K5AbVqaJ8d5wCcE6w2tCiTXPkSGMyY9paBXitI,410
22
25
  examples/langchain_example/basic.py,sha256=hrwMHOUv78-su5DP9i5krkQnMGHq0svEXsBa40Jkggg,2981
23
- examples/langchain_example/groq_example.py,sha256=9dBbOWZCVJ29PpB1NbJhc9MThmtwrlOpdNIxPl7d8f8,787
26
+ examples/langchain_example/groq_example.py,sha256=egrg3FHCnSJ-kV22Z2_t9ElJfKilddfcO5bwcKCfc5M,1060
24
27
  examples/langchain_example/langgraph_example.py,sha256=7C2a4Sg0PKbbab03CVkStO3MzT7C-O1UtdmObvBXurM,2005
25
28
  examples/langchain_example/tool.py,sha256=8T8_IDbgA58XbsfyH5_xhA8ZKQfyfyFxF8wor-PsRjA,2556
26
29
  examples/llamaindex_example/__init__.py,sha256=4w8Hz5pfmMzhkHAbBim6jwxHxMicaN4xi1Of9pODO8g,252
@@ -28,14 +31,14 @@ examples/llamaindex_example/agent.py,sha256=JNK6xDX17HOFRShBK7a71HPWD05LwzPES9YV
28
31
  examples/llamaindex_example/basic.py,sha256=aFZngkye95sjUr4wc2Uo_Je0iEexXpNcdlV0BTv_F4g,726
29
32
  examples/llamaindex_example/data/abramov.txt,sha256=Ou-GyWZm5AjHLgxviBoRE9ikNv5MScsF0cd--0vVVhI,32667
30
33
  examples/ollama_example/__init__.py,sha256=qOx0jGCPuSpRCPiqtDVm7F0z8hIZ8C75hDZ_C8Apz-s,399
31
- examples/ollama_example/basic.py,sha256=nfS-dfHMC99XyjP5COa-eLH1BLxFqjkPsPhMQ7sokZA,1024
32
- examples/openai_example/__init__.py,sha256=6l2FePb3vYBJVwIT4qfdtOLobKLZ6iO16Fe31TUwNz8,827
33
- examples/openai_example/async_tool_calling_nonstreaming.py,sha256=FhbDX91RLhTrNd5IGPI0CxRdCjTRcNLlWkYdLqHGbVs,3838
34
+ examples/ollama_example/basic.py,sha256=EPbsigOF4xBDBgLgAD0EzPo737ycVm7aXZr7F5Xt-A4,1062
35
+ examples/openai_example/__init__.py,sha256=MU4CELvhe2EU6d4Okg-bTfjvfGxQO7PNzqMw1yrVeCA,828
36
+ examples/openai_example/async_tool_calling_nonstreaming.py,sha256=H1-CrNfNDfqAkB5wEipITXlW2OsYL7XD5uQb6k3C6ps,3865
34
37
  examples/openai_example/async_tool_calling_streaming.py,sha256=LaSKmn_Unv55eTHXYdEmKjo39eNuB3ASOBV-m8U1HfU,7136
35
- examples/openai_example/chat_completion.py,sha256=unQK7IYH_wmAtIVZNJ5kC0qywXR00ZnXl5xtcCu7JX8,1193
36
- examples/openai_example/embeddings_create.py,sha256=sqz-zh3pEaB17gVYeY0QE76QxRwsmo6wV8yjAfg1ljg,522
38
+ examples/openai_example/chat_completion.py,sha256=HPFdM0lA01yo5VvZRRdgczyPSa-eurnALP723laOv6M,1192
39
+ examples/openai_example/embeddings_create.py,sha256=kcOZpl5nhHo_NC-3n2yKX5W8mAzNfut43mSy1BmQJUI,555
37
40
  examples/openai_example/function_calling.py,sha256=zz-JdCcpP7uCXG21EYXF1Y39IKj6gYt2fOP5N_ywpnc,2338
38
- examples/openai_example/images_edit.py,sha256=0hG5OYTSUBrcwSxbqN67brPYjf1pRJs8vqGzu-UjK6c,887
41
+ examples/openai_example/images_edit.py,sha256=6dSKA40V39swSs1mWdWXSa0reK4tyNBkK9MM7V3IEPw,939
39
42
  examples/openai_example/images_generate.py,sha256=SZNY8Visk7JUpx5QhNxTNINHmPAGdCUayF-Q7_iCr50,470
40
43
  examples/openai_example/tool_calling.py,sha256=_IV7KoSI_37u1TTZWdVa58BYjkDfhSurvM86xwaNNhY,2316
41
44
  examples/openai_example/tool_calling_nonstreaming.py,sha256=Yc848IooZRXNynHL6z0kOgJ4qbmL_NOufcb2VmWRukI,3847
@@ -47,46 +50,53 @@ examples/pinecone_example/__init__.py,sha256=_rvn7Ygt_QWMQoa5wB2GB0S9gZVrlJrPrEh
47
50
  examples/pinecone_example/basic.py,sha256=5MoHZMBxHMdC61oj-CP19gj9SxSvIcDrQL934JPZoQs,1549
48
51
  examples/qdrant_example/__init__.py,sha256=Ze9xEzW8FiHUO58YBa8JeHNOwcmo3dpYH77AkdyglKU,197
49
52
  examples/qdrant_example/basic.py,sha256=DCMjHSuBZKkhEjCkwy5d5La9WMyW0lCWqtcZWiFCEm4,1425
53
+ examples/vertexai_example/__init__.py,sha256=sEKULUwHdn-CJnbYs_jt4QPAUnM_fqwMBI3HJ1RBZco,83
54
+ examples/vertexai_example/main.py,sha256=gndId5X5ksD-ycxnAWMdEqIDbLc3kz5Vt8vm4YPIk7I,5849
50
55
  examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56snk-Bbg2Kw,618
51
56
  examples/weaviate_example/query_text.py,sha256=sG8O-bXQpflBAiYpgE_M2X7GcHUlZNgl_wJW8_h-W6Q,127024
52
57
  langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
53
- langtrace_python_sdk/langtrace.py,sha256=PTuQWOcxknss2WAaM0MVBSL_TfHcvuTEoakazj2TE7Y,7542
54
- langtrace_python_sdk/version.py,sha256=U4bLKPYS0d1L7N6hY7AxGvLuei8dvTxJ7xg7Ag0OAG0,23
58
+ langtrace_python_sdk/langtrace.py,sha256=1L0IjME-pzEYht92QfwByPZr3H1MClTrqQdoN1KyKJY,7689
59
+ langtrace_python_sdk/version.py,sha256=4dqvKTDgbqeyzbWj6hYiNdzxsI8j1YOKSLM8vF6a0j4,22
55
60
  langtrace_python_sdk/constants/__init__.py,sha256=P8QvYwt5czUNDZsKS64vxm9Dc41ptGbuF1TFtAF6nv4,44
56
61
  langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=5MNjnAOg-4am78J3gVMH6FSwq5N8TOj72ugkhsw4vi0,46
57
62
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
63
  langtrace_python_sdk/constants/instrumentation/anthropic.py,sha256=YX3llt3zwDY6XrYk3CB8WEVqgrzRXEw_ffyk56JoF3k,126
59
64
  langtrace_python_sdk/constants/instrumentation/chroma.py,sha256=hiPGYdHS0Yj4Kh3eaYBbuCAl_swqIygu80yFqkOgdak,955
60
65
  langtrace_python_sdk/constants/instrumentation/cohere.py,sha256=tf9sDfb5K3qOAHChEE5o8eYWPZ1io58VsOjZDCZPxfw,577
61
- langtrace_python_sdk/constants/instrumentation/common.py,sha256=KodH_uGGjWGGP8rqTi7Ua-osjUwtPKslx69DJRbDiT4,850
66
+ langtrace_python_sdk/constants/instrumentation/common.py,sha256=YWUx2Tx6_VKYLyeyxelz4AbKoRBHd3u55QPx5YG2y_s,902
67
+ langtrace_python_sdk/constants/instrumentation/gemini.py,sha256=UAmfgg9FM7uNeOCdPfWlir6OIH-8BoxFGPRpdBd9ZZs,358
62
68
  langtrace_python_sdk/constants/instrumentation/groq.py,sha256=VFXmIl4aqGY_fS0PAmjPj_Qm7Tibxbx7Ur_e7rQpqXc,134
63
69
  langtrace_python_sdk/constants/instrumentation/ollama.py,sha256=H_-S0xjqRsi5qSp7mAlK7Y9NlQ3BqOkG6ASogqqgdJY,212
64
70
  langtrace_python_sdk/constants/instrumentation/openai.py,sha256=uEOH5UXapU2DSf2AdgXTRhhJEHGWXUNFkUGD5QafflM,1164
65
71
  langtrace_python_sdk/constants/instrumentation/pinecone.py,sha256=0TityERbGWaHGSN8-vyYZtYCjVj8fQOKae8lng0O0Bk,478
66
72
  langtrace_python_sdk/constants/instrumentation/qdrant.py,sha256=yL7BopNQTXW7L7Z-gVM2PdusKD7r9qqcATvczFd7NtQ,1999
73
+ langtrace_python_sdk/constants/instrumentation/vertexai.py,sha256=0s2vX3Y0iwjOPkUg5lAKi-7o3LaNivDSBBbF-o695Ok,1266
67
74
  langtrace_python_sdk/constants/instrumentation/weaviate.py,sha256=gtv-JBxvNGClEMxClmRKzjJ1khgOonsli4D_k9IagSE,2601
68
75
  langtrace_python_sdk/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
76
  langtrace_python_sdk/extensions/langtrace_exporter.py,sha256=gWVRU2DlB4xjZ4ww7M63DaLiAN5zQ2k1HPrythmjEdo,4202
70
77
  langtrace_python_sdk/extensions/langtrace_filesystem.py,sha256=qpnkpkuTZ2yhGgpBK64QJLt0T1iL-1zpEMPz4quJ_ng,6925
71
- langtrace_python_sdk/instrumentation/__init__.py,sha256=BYTzQSmHDbKAbtV98UDjxzV1UoNq_wtsWV7V4PZPzbc,1243
78
+ langtrace_python_sdk/instrumentation/__init__.py,sha256=yJd3aGu4kPfm2h6oe6kiCWvzTF9awpC1UztjXF9WSO4,1391
72
79
  langtrace_python_sdk/instrumentation/anthropic/__init__.py,sha256=donrurJAGYlxrSRA3BIf76jGeUcAx9Tq8CVpah68S0Y,101
73
80
  langtrace_python_sdk/instrumentation/anthropic/instrumentation.py,sha256=-srgE8qumAn0ulQYZxMa8ch-9IBH0XgBW_rfEnGk6LI,1684
74
- langtrace_python_sdk/instrumentation/anthropic/patch.py,sha256=52GRkW7fhF2VB9JvYGMaPwOvWH3Q5rsIEaVlnFm_Zz0,8548
81
+ langtrace_python_sdk/instrumentation/anthropic/patch.py,sha256=AdsVFDoU0u_4NTjcIDe6CBbK-Bqhlkw4iLwN4sAr2K8,6884
75
82
  langtrace_python_sdk/instrumentation/chroma/__init__.py,sha256=pNZ5UO8Q-d5VkXSobBf79reB6AmEl_usnnTp5Itv818,95
76
83
  langtrace_python_sdk/instrumentation/chroma/instrumentation.py,sha256=nT6PS6bsrIOO9kLV5GuUeRjMe6THHHAZGvqWBP1dYog,1807
77
- langtrace_python_sdk/instrumentation/chroma/patch.py,sha256=HhIkXGbVfzpEB4edxzlG9yx2SG_B0dTn5Pnff4PLDCA,9043
84
+ langtrace_python_sdk/instrumentation/chroma/patch.py,sha256=JfFc8SDfwkEyIwTd1yM6jwa1vu5hZH6IXyxAEcQQQOs,9010
78
85
  langtrace_python_sdk/instrumentation/cohere/__init__.py,sha256=sGUSLdTUyYf36Tm6L5jQflhzCqvmWrhnBOMYHjvp6Hs,95
79
86
  langtrace_python_sdk/instrumentation/cohere/instrumentation.py,sha256=YQFHZIBd7SSPD4b6Va-ZR0thf_AuBCqj5yzHLHJVWnM,2121
80
- langtrace_python_sdk/instrumentation/cohere/patch.py,sha256=uGjZm_c1-xpZilHD8ljGr4AqQB3UNU04SKl9s2alGzs,26726
87
+ langtrace_python_sdk/instrumentation/cohere/patch.py,sha256=zSPhROZsCU3ayfq25073zedCf9C1niJQ6oX8vGQKi4E,21126
81
88
  langtrace_python_sdk/instrumentation/crewai/__init__.py,sha256=_UBKfvQv7l0g2_wnmA5F6CdSAFH0atNOVPd49zsN3aM,88
82
89
  langtrace_python_sdk/instrumentation/crewai/instrumentation.py,sha256=W8PLTLzgEdrEx1DCo79wNs9xcuWK0YuxEICLavOESDw,1715
83
90
  langtrace_python_sdk/instrumentation/crewai/patch.py,sha256=Vnpip9Pbk4UFbTFHoUrHtAnDgsaihwSvZBgtUeOtLr8,6109
84
91
  langtrace_python_sdk/instrumentation/dspy/__init__.py,sha256=tM1srfi_QgyCzrde4izojMrRq2Wm7Dj5QUvVQXIJzkk,84
85
92
  langtrace_python_sdk/instrumentation/dspy/instrumentation.py,sha256=Y-_qcH5jCT4TbGvci6Iw0_OWUUlCmovMxnysj6NCnXI,2923
86
93
  langtrace_python_sdk/instrumentation/dspy/patch.py,sha256=EI1iTgKzwtCyQrzBSyPIjzhiQUVl5jfFDtodXXe5BjA,9258
94
+ langtrace_python_sdk/instrumentation/gemini/__init__.py,sha256=ilWmKA4Li-g3DX6R10WQ4v-51VljxToEnJpOQoQB5uQ,88
95
+ langtrace_python_sdk/instrumentation/gemini/instrumentation.py,sha256=rhGOt1YsTmTSzdFXkuTcFJFUQSgNBnqKvYURcS3yGHU,1308
96
+ langtrace_python_sdk/instrumentation/gemini/patch.py,sha256=XyJT6Zl5NSlHOPxKvfZDtLiWV_G5aiOeZqAvlIQf0j0,6291
87
97
  langtrace_python_sdk/instrumentation/groq/__init__.py,sha256=ZXeq_nrej6Lm_uoMFEg8wbSejhjB2UJ5IoHQBPc2-C0,91
88
98
  langtrace_python_sdk/instrumentation/groq/instrumentation.py,sha256=Ttf07XVKhdYY1_fqJc7QWiSdmgEhEVyQB_3Az2_wqYo,1832
89
- langtrace_python_sdk/instrumentation/groq/patch.py,sha256=EKH9tjoDbwWavIAwUadaR5tFiy-S69h1IxxzH_1SSRg,26354
99
+ langtrace_python_sdk/instrumentation/groq/patch.py,sha256=zvQ0WPSHXLYQwzST-9-hRvDyjPG3vkY6FX0LeGV-Cgg,23863
90
100
  langtrace_python_sdk/instrumentation/langchain/__init__.py,sha256=-7ZkqQFu64F-cxSFd1ZPrciODKqmUIyUbQQ-eHuQPyM,101
91
101
  langtrace_python_sdk/instrumentation/langchain/instrumentation.py,sha256=_Z4AeNb2hBPSCvMRxE-mUfmkUO_wP_tGGtu-jppWPiI,3462
92
102
  langtrace_python_sdk/instrumentation/langchain/patch.py,sha256=2ZgLdgQpvie4PtpVC068T3KUEBqcLQCRsdyThmKh7VQ,4089
@@ -104,23 +114,26 @@ langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py,sha256=8iAg-O
104
114
  langtrace_python_sdk/instrumentation/llamaindex/patch.py,sha256=OGk7ps438gW49zvJQCDp7ZmkQnFxouAUu2PvHbmcAP8,4496
105
115
  langtrace_python_sdk/instrumentation/ollama/__init__.py,sha256=g2zJsXnDHinXPzTc-WxDeTtHmr9gmAj3K6l_00kP8c8,82
106
116
  langtrace_python_sdk/instrumentation/ollama/instrumentation.py,sha256=jdsvkqUJAAUNLVPtAkn_rG26HXetVQXWtjn4a6eWZro,2029
107
- langtrace_python_sdk/instrumentation/ollama/patch.py,sha256=uzoc2M-Vj-wEnjYBiiR8lg1s9teqMz6bG4iS6s1_QiQ,8639
117
+ langtrace_python_sdk/instrumentation/ollama/patch.py,sha256=Twi3yeGgBj0DadBmZ0X0DsMPx71iSdL4R3OjOw3-p_E,8132
108
118
  langtrace_python_sdk/instrumentation/openai/__init__.py,sha256=VPHRNCQEdkizIVP2d0Uw_a7t8XOTSTprEIB8oboJFbs,95
109
119
  langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=A0BJHRLcZ74TNVg6I0I9M5YWvSpAtXwMmME6N5CEQ_M,2945
110
- langtrace_python_sdk/instrumentation/openai/patch.py,sha256=C1Bb__IweKKjImBC8VVXG-2wpqQb7ogyIdWPx6pdTM8,38352
120
+ langtrace_python_sdk/instrumentation/openai/patch.py,sha256=9QfXSTjpj8b4KBWqDq-md8rkX8F6GM6VMTQK_Fpjoj4,23971
111
121
  langtrace_python_sdk/instrumentation/pinecone/__init__.py,sha256=DzXyGh9_MGWveJvXULkFwdkf7PbG2s3bAWtT1Dmz7Ok,99
112
122
  langtrace_python_sdk/instrumentation/pinecone/instrumentation.py,sha256=HDXkRITrVPwdQEoOYJOfMzZE_2-vDDvuqHTlD8W1lQw,1845
113
123
  langtrace_python_sdk/instrumentation/pinecone/patch.py,sha256=KiIRRz8kk47FllFT746Cb_w6F6M60AN_pcsguD979E4,5172
114
124
  langtrace_python_sdk/instrumentation/qdrant/__init__.py,sha256=TaIGSAEPysrL23KJ5FcEL1tfQogrKCtEQ75_u62eqso,95
115
125
  langtrace_python_sdk/instrumentation/qdrant/instrumentation.py,sha256=vl2eKSP55aqDo1JiRlvOUBrr6kddvG9Z5dCYew2OG08,1816
116
- langtrace_python_sdk/instrumentation/qdrant/patch.py,sha256=RhEHQxN7PJN0DjoC656Sw3GeYrJzHhp1bSky8rqOE5o,4948
126
+ langtrace_python_sdk/instrumentation/qdrant/patch.py,sha256=HIogSyk9ROwmjX9sivAunXdYtDwGDAhQemdZEAczRuE,4938
127
+ langtrace_python_sdk/instrumentation/vertexai/__init__.py,sha256=ZzKxB7bl0FaRlgJhhgAk5V8Bf20FmThWM_Z9u9Eyy1s,92
128
+ langtrace_python_sdk/instrumentation/vertexai/instrumentation.py,sha256=Keeb1D7nJDYu33w6H8Q8jLS7OOJtSIHqngvJMipWqJo,1143
129
+ langtrace_python_sdk/instrumentation/vertexai/patch.py,sha256=EmnChh2SrXn4W-qjbRW8dhX2kqMmI3e25MfL1M01Mbk,4455
117
130
  langtrace_python_sdk/instrumentation/weaviate/__init__.py,sha256=Mc-Je6evPo-kKQzerTG7bd1XO5JOh4YGTE3wBxaUBwg,99
118
131
  langtrace_python_sdk/instrumentation/weaviate/instrumentation.py,sha256=oWLCnh5_Nuw8bKpXJW6Zo-PpI_kJ7q2nA4BImnZ7YqY,2295
119
132
  langtrace_python_sdk/instrumentation/weaviate/patch.py,sha256=rRD6WfQcNGYpw9teoCkGPCZkzolG0h-mZdPGNKkgE10,5971
120
133
  langtrace_python_sdk/types/__init__.py,sha256=KDW6S74FDxpeBa9xoH5zVEYfmRjccCCHzlW7lTJg1TA,3194
121
- langtrace_python_sdk/utils/__init__.py,sha256=E0nQyBE-4O_GR2PM9y_l7shx4hJLo5xRThR_LMx97M0,278
134
+ langtrace_python_sdk/utils/__init__.py,sha256=QPF7SMuiz_003fLCHkRrgNb9NjqErDQ5cQr6pkJReKc,724
122
135
  langtrace_python_sdk/utils/langtrace_sampler.py,sha256=BupNndHbU9IL_wGleKetz8FdcveqHMBVz1bfKTTW80w,1753
123
- langtrace_python_sdk/utils/llm.py,sha256=Lwa0zdKcXozOvYSDfIJNoWdI8zUGJqiraFilXipW4x0,2484
136
+ langtrace_python_sdk/utils/llm.py,sha256=UUjzsQ2Howo43LPib0_T_LB_d-L7Rk7kddX_QWE1UrA,12781
124
137
  langtrace_python_sdk/utils/misc.py,sha256=CD9NWRLxLpFd0YwlHJqzlpFNedXVWtAKGOjQWnDCo8k,838
125
138
  langtrace_python_sdk/utils/prompt_registry.py,sha256=n5dQMVLBw8aJZY8Utvf67bncc25ELf6AH9BYw8_hSzo,2619
126
139
  langtrace_python_sdk/utils/sdk_version_checker.py,sha256=FzjIWZjn53cX0LEVPdipQd1fO9lG8iGVUEVUs9Hyk6M,1713
@@ -129,30 +142,36 @@ langtrace_python_sdk/utils/types.py,sha256=l-N6o7cnWUyrD6dBvW7W3Pf5CkPo5QaoT__k1
129
142
  langtrace_python_sdk/utils/with_root_span.py,sha256=RO-MhRUNSWdSo7KKOdAnTBfwj973KMTEKD-e54fSr0c,7539
130
143
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
144
  tests/conftest.py,sha256=0Jo6iCZTXbdvyJVhG9UpYGkLabL75378oauCzmt-Sa8,603
132
- tests/utils.py,sha256=hP8sTH-M8WO6zlLkSFHPf6483ZcKEcnxul6JIIb1pLM,1396
145
+ tests/utils.py,sha256=8ZBYvxBH6PynipT1sqenfyjTGLhEV7SORQH1NJjnpsM,2500
133
146
  tests/anthropic/conftest.py,sha256=ht1zF3q4Xb1UiZ3BL_L-CQ3YWrd52Dqb4WTZ3f-GdG4,739
134
- tests/anthropic/test_anthropic.py,sha256=4Jna7looFNGAOkW-QpSVijyaKdJeNmKjhvilUJ8mbXU,3309
147
+ tests/anthropic/test_anthropic.py,sha256=lNalVzRk52smmwflFT8tFu-Jm9y56dyEWWgWlXarJeY,2942
135
148
  tests/anthropic/cassettes/test_anthropic.yaml,sha256=z7YAqA_BBgI-hw7uyVMdLoIZdBYhKwl9cuTzUu9nAZs,2332
136
149
  tests/anthropic/cassettes/test_anthropic_streaming.yaml,sha256=D0w4-6dfsgrhbNLJEj8gZBV0yXfrAfA9u90Yu8Ac-TY,11675
137
150
  tests/anthropic/cassettes/test_async_anthropic_streaming.yaml,sha256=hQZPY2vwBaW3BWllLd0lcGQ73DjA8C3Ips1Hx9pA-ao,8373
138
151
  tests/chroma/conftest.py,sha256=kqb4VydCnlVpkvBX5Bu-pfnVS-ZZfju9cp6vq76tkJI,309
139
152
  tests/chroma/test_chroma.py,sha256=-KJHunvvVi1OoKKOcKCeHO1s399Gm9vJfd-EzgllQmk,1220
140
153
  tests/cohere/conftest.py,sha256=jBbyg-tut-ZJN5_5D64sGmaPIhT_nQQQAiW43kl5Rz4,621
141
- tests/cohere/test_cohere_chat.py,sha256=rn6qU9lFOzjA_P-ucOikIzswQ2ZcvZ89ijvh0Yzndwg,4698
142
- tests/cohere/test_cohere_embed.py,sha256=VM2Q9eBrSSFsNuw9OMNL9BmdXG8g1CGQ2A1uIERyAZw,1315
143
- tests/cohere/test_cohere_rerank.py,sha256=yNi1GNCIujxRrGMFLsYSnNmb7zyro-owm-kGbouPSDs,2247
154
+ tests/cohere/test_cohere_chat.py,sha256=KJBWGXPPeTCKdch8O63-7IadmMvdZZrsUPAx0Z0aH60,4463
155
+ tests/cohere/test_cohere_embed.py,sha256=Zx2gcc7YSp7rEOWelFVcRkL8V93wGP8ZFG7exrgJCJY,1500
156
+ tests/cohere/test_cohere_rerank.py,sha256=RC52HVdM4ZYbLDcT1hnWNKDtbNJeDvOFIllULhUN4EA,2522
144
157
  tests/cohere/cassettes/test_cohere_chat.yaml,sha256=iQIhJwmWe2AQDmdguL6L0SZOPMD6B3mhDVUKPSLodA4,3271
145
158
  tests/cohere/cassettes/test_cohere_chat_streaming.yaml,sha256=tMlz7IPZYRCJUeMCwyXrA4O4zpcqIPpQ5hU9I5f352Q,8174
146
159
  tests/cohere/cassettes/test_cohere_embed.yaml,sha256=Svcyw8WkVMVw4cocWQzGOdUVmWi5AM6Gb9t9VLlyOjM,27320
147
160
  tests/cohere/cassettes/test_cohere_rerank.yaml,sha256=RsJ8804lTktI0FKEFCw0M4ztStZbCxb_z_VRmrw8ooQ,2393
161
+ tests/groq/conftest.py,sha256=XPpcM9wedkPOQ7iW8pC1FfmMzopaR01CkRkEiVX7ZLg,611
162
+ tests/groq/test_groq.py,sha256=FWh_3igYBMxk0mlgQFEwW1unQvaCJDaHmraF179n0qE,5388
163
+ tests/groq/cassettes/test_async_chat_completion.yaml,sha256=nAbZy4VHm6qobtIdsF0q1gjcgONvxOk4UA1Q1aYk5Qw,4429
164
+ tests/groq/cassettes/test_async_chat_completion_streaming.yaml,sha256=S4mvXn5hNEJwGPCF4HRFnslVlGfztMo6lu-1PT1gJT8,167361
165
+ tests/groq/cassettes/test_chat_completion.yaml,sha256=fc1Q6zbhkXsxKv3rkyU0N45soXGWfIRfCNA1NhMMhfw,4535
166
+ tests/groq/cassettes/test_chat_completion_streaming.yaml,sha256=2a93h_XPhei_5RRzHtMmeKMu6GwSeZwos3WIWMjtX80,187470
148
167
  tests/langchain/conftest.py,sha256=f29apdevxg7AM0mPQ1LoEd-yStGruqGLTQUp29heLJo,1116
149
168
  tests/langchain/test_langchain.py,sha256=QP11RdNDX_ztF1ppPnUiui3SsxYYdzVsDgtI-1OGH48,893
150
169
  tests/langchain/cassettes/test_langchain.yaml,sha256=KPBTVIYMUPFaSNpwrTDgWzsu4p3hHj_yNDoudDa-Jis,3755
151
170
  tests/openai/conftest.py,sha256=BkehS6heg-O91Nzoc4546OSiAzy8KgSgk7VCO3A11zM,700
152
- tests/openai/test_chat_completion.py,sha256=rfMB4DRrXhozSd4ZHJ7VkMw2MZcGEPPgZyaABFrE0qI,5783
171
+ tests/openai/test_chat_completion.py,sha256=I3XqMhMYsnSE8581UN_PGL_Y3A_kwa2mhb7zhxv52NQ,5081
153
172
  tests/openai/test_embeddings.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
- tests/openai/test_image_generation.py,sha256=xewPlPf1Ucb0ECKgoasGk1uDlaL4v-mKjUMjVXVsLDQ,4382
155
- tests/openai/cassettes/test_async_chat_completion_streaming.yaml,sha256=yL0nlGCbxJj0aYWJYBvqx1EMQBMxTi4OLBOeaRx0eDs,6714
173
+ tests/openai/test_image_generation.py,sha256=u6lJCDPs2kZ_MfoaEXEszU_VTOQr7xGK7ki93E2e-wY,4902
174
+ tests/openai/cassettes/test_async_chat_completion_streaming.yaml,sha256=z4LE2pknHrfNm9D2pKH1F_cHDAG8LIVp4SnzJBUd4t4,6719
156
175
  tests/openai/cassettes/test_async_image_generation.yaml,sha256=_LYZcrqxrnSqcWVQn2Y0XMVGxF-wBrSAd-v3LTAIAeo,3597
157
176
  tests/openai/cassettes/test_chat_completion.yaml,sha256=YkNFgK9VHAzNqGWuxFcTiE194GdEie8eDf1FSsffjd8,2944
158
177
  tests/openai/cassettes/test_chat_completion_streaming.yaml,sha256=cNlgMTxY4uo3MfS832nDkOWo6Jq8L2KywgZ8yXmySAw,6703
@@ -163,8 +182,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
163
182
  tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
164
183
  tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
165
184
  tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
166
- langtrace_python_sdk-2.1.29.dist-info/METADATA,sha256=NPENT6WxOp2Gx-ROVtTWjbKlBhRQ0kC-40j02VvxomQ,13749
167
- langtrace_python_sdk-2.1.29.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
168
- langtrace_python_sdk-2.1.29.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
169
- langtrace_python_sdk-2.1.29.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
170
- langtrace_python_sdk-2.1.29.dist-info/RECORD,,
185
+ langtrace_python_sdk-2.2.1.dist-info/METADATA,sha256=7xKB3hhzIgl7c0XGqad1zKYBcV9-AUFFh5eIos8K_8c,14471
186
+ langtrace_python_sdk-2.2.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
187
+ langtrace_python_sdk-2.2.1.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
188
+ langtrace_python_sdk-2.2.1.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
189
+ langtrace_python_sdk-2.2.1.dist-info/RECORD,,
@@ -3,9 +3,17 @@ import json
3
3
  import importlib
4
4
  from langtrace_python_sdk.constants.instrumentation.anthropic import APIS
5
5
  from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME
6
- from tests.utils import assert_response_format, assert_token_count
6
+ from tests.utils import (
7
+ assert_completion_in_events,
8
+ assert_langtrace_attributes,
9
+ assert_prompt_in_events,
10
+ assert_response_format,
11
+ assert_token_count,
12
+ )
7
13
  from importlib_metadata import version as v
8
14
 
15
+ from langtrace.trace_attributes import SpanAttributes
16
+
9
17
 
10
18
  @pytest.mark.vcr()
11
19
  def test_anthropic(anthropic_client, exporter):
@@ -25,22 +33,17 @@ def test_anthropic(anthropic_client, exporter):
25
33
 
26
34
  assert completion_span.name == "anthropic.messages.create"
27
35
  attributes = completion_span.attributes
28
-
29
- assert attributes.get("langtrace.sdk.name") == "langtrace-python-sdk"
30
- assert attributes.get("langtrace.service.name") == "Anthropic"
31
- assert attributes.get("langtrace.service.type") == "llm"
32
- assert attributes.get("langtrace.service.version") == importlib.metadata.version(
33
- "anthropic"
36
+ assert_langtrace_attributes(attributes, "Anthropic")
37
+ assert_prompt_in_events(completion_span.events)
38
+ assert_completion_in_events(completion_span.events)
39
+ assert attributes.get(SpanAttributes.LLM_URL) == "https://api.anthropic.com"
40
+ assert (
41
+ attributes.get(SpanAttributes.LLM_PATH) == APIS["MESSAGES_CREATE"]["ENDPOINT"]
34
42
  )
35
- assert attributes.get("langtrace.version") == v(LANGTRACE_SDK_NAME)
36
- assert attributes.get("url.full") == "https://api.anthropic.com"
37
- assert attributes.get("llm.api") == APIS["MESSAGES_CREATE"]["ENDPOINT"]
38
- assert attributes.get("llm.model") == llm_model_value
39
- assert attributes.get("llm.prompts") == json.dumps(messages_value)
40
- assert attributes.get("llm.stream") is False
43
+ assert attributes.get(SpanAttributes.LLM_REQUEST_MODEL) == llm_model_value
44
+ assert attributes.get(SpanAttributes.LLM_IS_STREAMING) is False
41
45
 
42
46
  assert_token_count(attributes)
43
- assert_response_format(attributes)
44
47
 
45
48
 
46
49
  @pytest.mark.vcr()
@@ -68,21 +71,19 @@ def test_anthropic_streaming(anthropic_client, exporter):
68
71
  assert streaming_span.name == "anthropic.messages.create"
69
72
  attributes = streaming_span.attributes
70
73
 
71
- assert attributes.get("langtrace.sdk.name") == "langtrace-python-sdk"
72
- assert attributes.get("langtrace.service.name") == "Anthropic"
73
- assert attributes.get("langtrace.service.type") == "llm"
74
- assert attributes.get("langtrace.service.version") == importlib.metadata.version(
75
- "anthropic"
74
+ assert_langtrace_attributes(attributes, "Anthropic")
75
+ assert_prompt_in_events(streaming_span.events)
76
+ assert_completion_in_events(streaming_span.events)
77
+
78
+ assert attributes.get(SpanAttributes.LLM_URL) == "https://api.anthropic.com"
79
+ assert (
80
+ attributes.get(SpanAttributes.LLM_PATH) == APIS["MESSAGES_CREATE"]["ENDPOINT"]
76
81
  )
77
- assert attributes.get("langtrace.version") == v(LANGTRACE_SDK_NAME)
78
- assert attributes.get("url.full") == "https://api.anthropic.com"
79
- assert attributes.get("llm.api") == APIS["MESSAGES_CREATE"]["ENDPOINT"]
80
- assert attributes.get("llm.model") == llm_model_value
81
- assert attributes.get("llm.prompts") == json.dumps(messages_value)
82
- assert attributes.get("llm.stream") is True
82
+ assert attributes.get(SpanAttributes.LLM_REQUEST_MODEL) == llm_model_value
83
+ assert attributes.get(SpanAttributes.LLM_IS_STREAMING) is True
84
+
83
85
  events = streaming_span.events
84
86
 
85
- assert len(events) - 2 == chunk_count # -2 for start and end events
87
+ assert len(events) - 4 == chunk_count
86
88
 
87
89
  assert_token_count(attributes)
88
- assert_response_format(attributes)
@@ -4,8 +4,15 @@ from langtrace_python_sdk.constants.instrumentation.common import SERVICE_PROVID
4
4
  import pytest
5
5
  import importlib
6
6
  from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME
7
- from tests.utils import assert_response_format, assert_token_count
7
+ from tests.utils import (
8
+ assert_completion_in_events,
9
+ assert_langtrace_attributes,
10
+ assert_prompt_in_events,
11
+ assert_response_format,
12
+ assert_token_count,
13
+ )
8
14
  from importlib_metadata import version as v
15
+ from langtrace.trace_attributes import SpanAttributes
9
16
 
10
17
 
11
18
  @pytest.mark.vcr
@@ -33,28 +40,21 @@ def test_cohere_chat(cohere_client, exporter):
33
40
  cohere_span = spans[-1]
34
41
  assert cohere_span.name == APIS["CHAT_CREATE"]["METHOD"]
35
42
  attributes = cohere_span.attributes
43
+ assert_langtrace_attributes(attributes, SERVICE_PROVIDERS["COHERE"])
44
+ assert_prompt_in_events(cohere_span.events)
45
+ assert_completion_in_events(cohere_span.events)
36
46
 
37
- assert attributes.get("langtrace.sdk.name") == "langtrace-python-sdk"
38
- assert attributes.get("langtrace.service.name") == SERVICE_PROVIDERS["COHERE"]
39
- assert attributes.get("langtrace.service.type") == "llm"
40
- assert attributes.get("langtrace.service.version") == importlib.metadata.version(
41
- "cohere"
47
+ assert attributes.get(SpanAttributes.LLM_URL) == APIS["CHAT_CREATE"]["URL"]
48
+ assert attributes.get(SpanAttributes.LLM_PATH) == APIS["CHAT_CREATE"]["ENDPOINT"]
49
+ assert attributes.get(SpanAttributes.LLM_REQUEST_MODEL) == llm_model_value
50
+ assert attributes.get(SpanAttributes.LLM_REQUEST_TEMPERATURE) == kwargs.get(
51
+ "temperature"
42
52
  )
53
+ assert attributes.get(SpanAttributes.LLM_GENERATION_ID) == res.generation_id
43
54
 
44
- assert attributes.get("langtrace.version") == v(LANGTRACE_SDK_NAME)
45
- assert attributes.get("url.full") == APIS["CHAT_CREATE"]["URL"]
46
- assert attributes.get("llm.api") == APIS["CHAT_CREATE"]["ENDPOINT"]
47
- assert attributes.get("llm.model") == llm_model_value
48
- assert attributes.get("llm.generation_id") == res.generation_id
49
- assert attributes.get("llm.temperature") == kwargs.get("temperature")
50
- assert attributes.get("llm.stream") is False
51
-
52
- assert json.loads(attributes.get("llm.connectors")) == connectors
53
- assert json.loads(attributes.get("llm.prompts"))[-1]["content"] == messages_value
54
- assert json.loads(attributes.get("llm.responses"))[-1]["content"] == res.text
55
+ assert json.loads(attributes.get("llm_connectors")) == connectors
55
56
 
56
57
  assert_token_count(attributes)
57
- assert_response_format(attributes)
58
58
 
59
59
 
60
60
  @pytest.mark.vcr
@@ -92,27 +92,27 @@ def test_cohere_chat_streaming(cohere_client, exporter):
92
92
  assert cohere_span.name == APIS["CHAT_STREAM"]["METHOD"]
93
93
  attributes = cohere_span.attributes
94
94
 
95
- assert attributes.get("langtrace.sdk.name") == "langtrace-python-sdk"
96
- assert attributes.get("langtrace.service.name") == SERVICE_PROVIDERS["COHERE"]
97
- assert attributes.get("langtrace.service.type") == "llm"
98
- assert attributes.get("langtrace.service.version") == importlib.metadata.version(
99
- "cohere"
95
+ assert attributes.get(SpanAttributes.LANGTRACE_SDK_NAME) == LANGTRACE_SDK_NAME
96
+ assert (
97
+ attributes.get(SpanAttributes.LANGTRACE_SERVICE_NAME)
98
+ == SERVICE_PROVIDERS["COHERE"]
99
+ )
100
+ assert attributes.get(SpanAttributes.LANGTRACE_SERVICE_TYPE) == "llm"
101
+ assert attributes.get(SpanAttributes.LANGTRACE_SERVICE_VERSION) == v("cohere")
102
+ assert attributes.get(SpanAttributes.LANGTRACE_VERSION) == v(LANGTRACE_SDK_NAME)
103
+ assert attributes.get(SpanAttributes.LLM_URL) == APIS["CHAT_STREAM"]["URL"]
104
+ assert attributes.get(SpanAttributes.LLM_PATH) == APIS["CHAT_STREAM"]["ENDPOINT"]
105
+ assert attributes.get(SpanAttributes.LLM_REQUEST_MODEL) == llm_model_value
106
+ assert attributes.get(SpanAttributes.LLM_REQUEST_TEMPERATURE) == kwargs.get(
107
+ "temperature"
100
108
  )
109
+ assert attributes.get(SpanAttributes.LLM_IS_STREAMING) is True
101
110
 
102
- assert attributes.get("langtrace.version") == v(LANGTRACE_SDK_NAME)
103
- assert attributes.get("url.full") == APIS["CHAT_STREAM"]["URL"]
104
- assert attributes.get("llm.api") == APIS["CHAT_STREAM"]["ENDPOINT"]
105
- assert attributes.get("llm.model") == llm_model_value
106
- assert attributes.get("llm.temperature") == kwargs.get("temperature")
107
- assert attributes.get("llm.stream") is True
108
- assert json.loads(attributes.get("llm.connectors")) == connectors
109
- assert json.loads(attributes.get("llm.prompts"))[-1]["content"] == messages_value
111
+ assert json.loads(attributes.get("llm_connectors")) == connectors
110
112
  events = cohere_span.events
113
+ assert_prompt_in_events(events)
114
+ assert_completion_in_events(events)
111
115
  assert events[-1].name == "stream.end"
112
- assert len(events) - 2 == chunks_count
113
- assert (
114
- json.loads(attributes.get("llm.responses"))[-1]["content"] == streamed_response
115
- )
116
+ assert len(events) - 4 == chunks_count
116
117
 
117
118
  assert_token_count(attributes)
118
- assert_response_format(attributes)
@@ -4,6 +4,7 @@ import pytest
4
4
  from importlib_metadata import version as v
5
5
 
6
6
  from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME
7
+ from langtrace.trace_attributes import SpanAttributes
7
8
 
8
9
 
9
10
  @pytest.mark.vcr
@@ -24,12 +25,14 @@ def test_cohere_embed(cohere_client, exporter):
24
25
  assert cohere_span.name == APIS["EMBED"]["METHOD"]
25
26
  attributes = cohere_span.attributes
26
27
 
27
- assert attributes.get("langtrace.sdk.name") == "langtrace-python-sdk"
28
- assert attributes.get("langtrace.service.name") == SERVICE_PROVIDERS["COHERE"]
29
- assert attributes.get("langtrace.service.type") == "llm"
30
- assert attributes.get("langtrace.service.version") == v("cohere")
31
-
32
- assert attributes.get("langtrace.version") == v(LANGTRACE_SDK_NAME)
33
- assert attributes.get("url.full") == APIS["EMBED"]["URL"]
34
- assert attributes.get("llm.api") == APIS["EMBED"]["ENDPOINT"]
35
- assert attributes.get("llm.model") == llm_model_value
28
+ assert attributes.get(SpanAttributes.LANGTRACE_SDK_NAME) == LANGTRACE_SDK_NAME
29
+ assert (
30
+ attributes.get(SpanAttributes.LANGTRACE_SERVICE_NAME)
31
+ == SERVICE_PROVIDERS["COHERE"]
32
+ )
33
+ assert attributes.get(SpanAttributes.LANGTRACE_SERVICE_TYPE) == "llm"
34
+ assert attributes.get(SpanAttributes.LANGTRACE_SERVICE_VERSION) == v("cohere")
35
+ assert attributes.get(SpanAttributes.LANGTRACE_VERSION) == v(LANGTRACE_SDK_NAME)
36
+ assert attributes.get(SpanAttributes.LLM_URL) == APIS["EMBED"]["URL"]
37
+ assert attributes.get(SpanAttributes.LLM_PATH) == APIS["EMBED"]["ENDPOINT"]
38
+ assert attributes.get(SpanAttributes.LLM_REQUEST_MODEL) == llm_model_value
@@ -1,9 +1,11 @@
1
+ from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME
1
2
  from langtrace_python_sdk.constants.instrumentation.common import SERVICE_PROVIDERS
2
3
  import pytest
3
4
  import json
4
5
  from langtrace_python_sdk.constants.instrumentation.cohere import APIS
5
6
  from tests.utils import assert_token_count
6
7
  from importlib_metadata import version as v
8
+ from langtrace.trace_attributes import SpanAttributes
7
9
 
8
10
 
9
11
  @pytest.mark.vcr
@@ -30,17 +32,22 @@ def test_cohere_rerank(cohere_client, exporter):
30
32
  assert cohere_span.name == APIS["RERANK"]["METHOD"]
31
33
  attributes = cohere_span.attributes
32
34
 
33
- assert attributes.get("langtrace.sdk.name") == "langtrace-python-sdk"
34
- assert attributes.get("langtrace.service.name") == SERVICE_PROVIDERS["COHERE"]
35
- assert attributes.get("langtrace.service.type") == "llm"
36
- assert attributes.get("langtrace.service.version") == v("cohere")
37
-
38
- assert attributes.get("langtrace.version") == v("langtrace-python-sdk")
39
- assert attributes.get("url.full") == APIS["RERANK"]["URL"]
40
- assert attributes.get("llm.api") == APIS["RERANK"]["ENDPOINT"]
41
- assert attributes.get("llm.model") == llm_model_value
42
-
43
- langtrace_results = json.loads(attributes.get("llm.retrieval.results"))
35
+ assert attributes.get(SpanAttributes.LANGTRACE_SDK_NAME) == LANGTRACE_SDK_NAME
36
+
37
+ assert (
38
+ attributes.get(SpanAttributes.LANGTRACE_SERVICE_NAME)
39
+ == SERVICE_PROVIDERS["COHERE"]
40
+ )
41
+ assert attributes.get(SpanAttributes.LANGTRACE_SERVICE_TYPE) == "llm"
42
+ assert attributes.get(SpanAttributes.LANGTRACE_SERVICE_VERSION) == v("cohere")
43
+ assert attributes.get(SpanAttributes.LANGTRACE_VERSION) == v(LANGTRACE_SDK_NAME)
44
+ assert attributes.get(SpanAttributes.LLM_URL) == APIS["RERANK"]["URL"]
45
+ assert attributes.get(SpanAttributes.LLM_PATH) == APIS["RERANK"]["ENDPOINT"]
46
+ assert attributes.get(SpanAttributes.LLM_REQUEST_MODEL) == llm_model_value
47
+
48
+ langtrace_results = json.loads(
49
+ attributes.get(SpanAttributes.LLM_COHERE_RERANK_RESULTS)
50
+ )
44
51
  for idx, res in enumerate(results.results):
45
52
  lang_res = json.loads(langtrace_results[idx])
46
53
  assert lang_res["index"] == res.index
@@ -0,0 +1,113 @@
1
+ interactions:
2
+ - request:
3
+ body: '{"messages": [{"role": "user", "content": "Explain the importance of low
4
+ latency LLMs"}], "model": "llama3-8b-8192"}'
5
+ headers:
6
+ accept:
7
+ - application/json
8
+ accept-encoding:
9
+ - gzip, deflate
10
+ connection:
11
+ - keep-alive
12
+ content-length:
13
+ - '116'
14
+ content-type:
15
+ - application/json
16
+ host:
17
+ - api.groq.com
18
+ user-agent:
19
+ - AsyncGroq/Python 0.9.0
20
+ x-stainless-arch:
21
+ - arm64
22
+ x-stainless-async:
23
+ - async:asyncio
24
+ x-stainless-lang:
25
+ - python
26
+ x-stainless-os:
27
+ - MacOS
28
+ x-stainless-package-version:
29
+ - 0.9.0
30
+ x-stainless-runtime:
31
+ - CPython
32
+ x-stainless-runtime-version:
33
+ - 3.11.5
34
+ method: POST
35
+ uri: https://api.groq.com/openai/v1/chat/completions
36
+ response:
37
+ body:
38
+ string: !!binary |
39
+ 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
66
+ AAA=
67
+ headers:
68
+ CF-Cache-Status:
69
+ - DYNAMIC
70
+ CF-RAY:
71
+ - 89d12ed05998077f-MRS
72
+ Cache-Control:
73
+ - private, max-age=0, no-store, no-cache, must-revalidate
74
+ Connection:
75
+ - keep-alive
76
+ Content-Encoding:
77
+ - gzip
78
+ Content-Type:
79
+ - application/json
80
+ Date:
81
+ - Tue, 02 Jul 2024 19:53:36 GMT
82
+ Server:
83
+ - cloudflare
84
+ Set-Cookie:
85
+ - __cf_bm=kwAg3.4AprJOv6O8EoGGz949TacWaWKQOH.h4WYt6rQ-1719950016-1.0.1.1-wr1oIH71tAeoJR4E4muLNPp2pxTLEccQzQSaalMzTRri_RMUSGy7IVTmulIABre9w2vpXFnWiodeNPwZzdQ_hQ;
86
+ path=/; expires=Tue, 02-Jul-24 20:23:36 GMT; domain=.groq.com; HttpOnly; Secure;
87
+ SameSite=None
88
+ Transfer-Encoding:
89
+ - chunked
90
+ alt-svc:
91
+ - h3=":443"; ma=86400
92
+ vary:
93
+ - Origin
94
+ via:
95
+ - 1.1 google
96
+ x-ratelimit-limit-requests:
97
+ - '14400'
98
+ x-ratelimit-limit-tokens:
99
+ - '30000'
100
+ x-ratelimit-remaining-requests:
101
+ - '14398'
102
+ x-ratelimit-remaining-tokens:
103
+ - '29642'
104
+ x-ratelimit-reset-requests:
105
+ - 10.974999999s
106
+ x-ratelimit-reset-tokens:
107
+ - 716ms
108
+ x-request-id:
109
+ - req_01j1tg4zmrf8fsbdvvqy1bfxtr
110
+ status:
111
+ code: 200
112
+ message: OK
113
+ version: 1