langtrace-python-sdk 2.1.28__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.
- examples/cohere_example/chat.py +1 -0
- examples/cohere_example/chat_stream.py +3 -0
- examples/gemini_example/__init__.py +6 -0
- examples/gemini_example/function_tools.py +62 -0
- examples/gemini_example/main.py +91 -0
- examples/langchain_example/__init__.py +8 -0
- examples/langchain_example/groq_example.py +28 -15
- examples/ollama_example/basic.py +1 -0
- examples/openai_example/__init__.py +1 -0
- examples/openai_example/async_tool_calling_nonstreaming.py +1 -1
- examples/openai_example/chat_completion.py +1 -1
- examples/openai_example/embeddings_create.py +1 -0
- examples/openai_example/images_edit.py +2 -2
- examples/vertexai_example/__init__.py +6 -0
- examples/vertexai_example/main.py +214 -0
- langtrace_python_sdk/constants/instrumentation/common.py +2 -0
- langtrace_python_sdk/constants/instrumentation/gemini.py +12 -0
- langtrace_python_sdk/constants/instrumentation/vertexai.py +42 -0
- langtrace_python_sdk/instrumentation/__init__.py +4 -0
- langtrace_python_sdk/instrumentation/anthropic/patch.py +68 -96
- langtrace_python_sdk/instrumentation/chroma/patch.py +29 -29
- langtrace_python_sdk/instrumentation/cohere/patch.py +143 -242
- langtrace_python_sdk/instrumentation/gemini/__init__.py +3 -0
- langtrace_python_sdk/instrumentation/gemini/instrumentation.py +36 -0
- langtrace_python_sdk/instrumentation/gemini/patch.py +186 -0
- langtrace_python_sdk/instrumentation/groq/patch.py +82 -125
- langtrace_python_sdk/instrumentation/ollama/patch.py +62 -65
- langtrace_python_sdk/instrumentation/openai/patch.py +190 -494
- langtrace_python_sdk/instrumentation/qdrant/patch.py +6 -6
- langtrace_python_sdk/instrumentation/vertexai/__init__.py +3 -0
- langtrace_python_sdk/instrumentation/vertexai/instrumentation.py +33 -0
- langtrace_python_sdk/instrumentation/vertexai/patch.py +131 -0
- langtrace_python_sdk/langtrace.py +7 -1
- langtrace_python_sdk/utils/__init__.py +14 -3
- langtrace_python_sdk/utils/llm.py +311 -6
- langtrace_python_sdk/version.py +1 -1
- {langtrace_python_sdk-2.1.28.dist-info → langtrace_python_sdk-2.2.1.dist-info}/METADATA +26 -19
- {langtrace_python_sdk-2.1.28.dist-info → langtrace_python_sdk-2.2.1.dist-info}/RECORD +55 -36
- tests/anthropic/test_anthropic.py +28 -27
- tests/cohere/test_cohere_chat.py +36 -36
- tests/cohere/test_cohere_embed.py +12 -9
- tests/cohere/test_cohere_rerank.py +18 -11
- tests/groq/cassettes/test_async_chat_completion.yaml +113 -0
- tests/groq/cassettes/test_async_chat_completion_streaming.yaml +2232 -0
- tests/groq/cassettes/test_chat_completion.yaml +114 -0
- tests/groq/cassettes/test_chat_completion_streaming.yaml +2512 -0
- tests/groq/conftest.py +33 -0
- tests/groq/test_groq.py +142 -0
- tests/openai/cassettes/test_async_chat_completion_streaming.yaml +28 -28
- tests/openai/test_chat_completion.py +53 -67
- tests/openai/test_image_generation.py +47 -24
- tests/utils.py +40 -5
- {langtrace_python_sdk-2.1.28.dist-info → langtrace_python_sdk-2.2.1.dist-info}/WHEEL +0 -0
- {langtrace_python_sdk-2.1.28.dist-info → langtrace_python_sdk-2.2.1.dist-info}/entry_points.txt +0 -0
- {langtrace_python_sdk-2.1.28.dist-info → langtrace_python_sdk-2.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: langtrace-python-sdk
|
|
3
|
-
Version: 2.1
|
|
3
|
+
Version: 2.2.1
|
|
4
4
|
Summary: Python SDK for LangTrace
|
|
5
5
|
Project-URL: Homepage, https://github.com/Scale3-Labs/langtrace-python-sdk
|
|
6
6
|
Author-email: Scale3 Labs <engineering@scale3labs.com>
|
|
@@ -20,11 +20,14 @@ Requires-Dist: opentelemetry-instrumentation>=0.46b0
|
|
|
20
20
|
Requires-Dist: opentelemetry-sdk>=1.25.0
|
|
21
21
|
Requires-Dist: sqlalchemy
|
|
22
22
|
Requires-Dist: tiktoken>=0.1.1
|
|
23
|
-
Requires-Dist: trace-attributes<
|
|
23
|
+
Requires-Dist: trace-attributes<7.0.0,>=6.0.0
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: anthropic; extra == 'dev'
|
|
26
26
|
Requires-Dist: chromadb; extra == 'dev'
|
|
27
27
|
Requires-Dist: cohere; extra == 'dev'
|
|
28
|
+
Requires-Dist: google-cloud-aiplatform; extra == 'dev'
|
|
29
|
+
Requires-Dist: google-generativeai; extra == 'dev'
|
|
30
|
+
Requires-Dist: groq; extra == 'dev'
|
|
28
31
|
Requires-Dist: langchain; extra == 'dev'
|
|
29
32
|
Requires-Dist: langchain-community; extra == 'dev'
|
|
30
33
|
Requires-Dist: langchain-openai; extra == 'dev'
|
|
@@ -274,23 +277,27 @@ prompt = get_prompt_from_registry(<Registry ID>, options={"prompt_version": 1, "
|
|
|
274
277
|
|
|
275
278
|
Langtrace automatically captures traces from the following vendors:
|
|
276
279
|
|
|
277
|
-
| Vendor | Type | Typescript SDK | Python SDK
|
|
278
|
-
| ------------ | --------------- | ------------------ |
|
|
279
|
-
| OpenAI | LLM | :white_check_mark: | :white_check_mark:
|
|
280
|
-
| Anthropic | LLM | :white_check_mark: | :white_check_mark:
|
|
281
|
-
| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark:
|
|
282
|
-
| Cohere | LLM | :white_check_mark: | :white_check_mark:
|
|
283
|
-
| Groq | LLM | :x: | :white_check_mark:
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
|
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
280
|
+
| Vendor | Type | Typescript SDK | Python SDK |
|
|
281
|
+
| ------------ | --------------- | ------------------ | ------------------------------- |
|
|
282
|
+
| OpenAI | LLM | :white_check_mark: | :white_check_mark: |
|
|
283
|
+
| Anthropic | LLM | :white_check_mark: | :white_check_mark: |
|
|
284
|
+
| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark: |
|
|
285
|
+
| Cohere | LLM | :white_check_mark: | :white_check_mark: |
|
|
286
|
+
| Groq | LLM | :x: | :white_check_mark: |
|
|
287
|
+
| Perplexity | LLM | :white_check_mark: | :white_check_mark: |
|
|
288
|
+
| Gemini | LLM | :x: | :white_check_mark: |
|
|
289
|
+
| Langchain | Framework | :x: | :white_check_mark: |
|
|
290
|
+
| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
|
|
291
|
+
| Langgraph | Framework | :x: | :white_check_mark: |
|
|
292
|
+
| DSPy | Framework | :x: | :white_check_mark: |
|
|
293
|
+
| CrewAI | Framework | :x: | :white_check_mark: |
|
|
294
|
+
| Ollama | Framework | :x: | :white_check_mark: |
|
|
295
|
+
| VertexAI | Framework | :x: | :white_check_mark: |
|
|
296
|
+
| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
297
|
+
| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
298
|
+
| QDrant | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
299
|
+
| Weaviate | Vector Database | :white_check_mark: | :white_check_mark: |
|
|
300
|
+
| PGVector | Vector Database | :white_check_mark: | :white_check_mark: (SQLAlchemy) |
|
|
294
301
|
|
|
295
302
|
---
|
|
296
303
|
|
|
@@ -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=
|
|
8
|
-
examples/cohere_example/chat_stream.py,sha256=
|
|
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=
|
|
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=
|
|
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=
|
|
32
|
-
examples/openai_example/__init__.py,sha256=
|
|
33
|
-
examples/openai_example/async_tool_calling_nonstreaming.py,sha256=
|
|
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=
|
|
36
|
-
examples/openai_example/embeddings_create.py,sha256=
|
|
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=
|
|
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=
|
|
54
|
-
langtrace_python_sdk/version.py,sha256=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
142
|
-
tests/cohere/test_cohere_embed.py,sha256=
|
|
143
|
-
tests/cohere/test_cohere_rerank.py,sha256=
|
|
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=
|
|
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=
|
|
155
|
-
tests/openai/cassettes/test_async_chat_completion_streaming.yaml,sha256=
|
|
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.
|
|
167
|
-
langtrace_python_sdk-2.1.
|
|
168
|
-
langtrace_python_sdk-2.1.
|
|
169
|
-
langtrace_python_sdk-2.1.
|
|
170
|
-
langtrace_python_sdk-2.1.
|
|
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
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
assert attributes.get(
|
|
32
|
-
assert
|
|
33
|
-
"
|
|
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(
|
|
36
|
-
assert attributes.get(
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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(
|
|
78
|
-
assert attributes.get(
|
|
79
|
-
|
|
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) -
|
|
87
|
+
assert len(events) - 4 == chunk_count
|
|
86
88
|
|
|
87
89
|
assert_token_count(attributes)
|
|
88
|
-
assert_response_format(attributes)
|
tests/cohere/test_cohere_chat.py
CHANGED
|
@@ -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
|
|
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(
|
|
38
|
-
assert attributes.get(
|
|
39
|
-
assert attributes.get(
|
|
40
|
-
assert attributes.get(
|
|
41
|
-
"
|
|
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("
|
|
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(
|
|
96
|
-
assert
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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("
|
|
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) -
|
|
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(
|
|
28
|
-
assert
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
assert attributes.get(
|
|
33
|
-
assert attributes.get(
|
|
34
|
-
assert attributes.get(
|
|
35
|
-
assert attributes.get(
|
|
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(
|
|
34
|
-
|
|
35
|
-
assert
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
assert attributes.get(
|
|
40
|
-
assert attributes.get(
|
|
41
|
-
assert attributes.get(
|
|
42
|
-
|
|
43
|
-
|
|
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
|