langtrace-python-sdk 3.3.13__py3-none-any.whl → 3.3.14__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -137,7 +137,7 @@ def set_response_attributes(
137
137
  if hasattr(result, "text"):
138
138
  set_event_completion(span, [{"role": "assistant", "content": result.text}])
139
139
 
140
- if hasattr(result, "usage_metadata"):
140
+ if hasattr(result, "usage_metadata") and result.usage_metadata is not None:
141
141
  usage = result.usage_metadata
142
142
  input_tokens = usage.prompt_token_count
143
143
  output_tokens = usage.candidates_token_count
@@ -152,7 +152,7 @@ def build_streaming_response(span, response):
152
152
  item_to_yield = item
153
153
  complete_response += str(item.text)
154
154
  yield item_to_yield
155
- if hasattr(item, "usage_metadata"):
155
+ if hasattr(item, "usage_metadata") and item.usage_metadata is not None:
156
156
  usage = item.usage_metadata
157
157
  input_tokens = usage.prompt_token_count
158
158
  output_tokens = usage.candidates_token_count
@@ -171,7 +171,7 @@ async def abuild_streaming_response(span, response):
171
171
  item_to_yield = item
172
172
  complete_response += str(item.text)
173
173
  yield item_to_yield
174
- if hasattr(item, "usage_metadata"):
174
+ if hasattr(item, "usage_metadata") and item.usage_metadata is not None:
175
175
  usage = item.usage_metadata
176
176
  input_tokens = usage.prompt_token_count
177
177
  output_tokens = usage.candidates_token_count
@@ -98,7 +98,7 @@ def generic_patch(
98
98
  result = wrapped(*args, **kwargs)
99
99
  if trace_output:
100
100
  span.set_attribute("langchain.outputs", to_json_string(result))
101
- if hasattr(result, "usage_metadata"):
101
+ if hasattr(result, "usage_metadata") and result.usage_metadata is not None:
102
102
  span.set_attribute(
103
103
  SpanAttributes.LLM_USAGE_PROMPT_TOKENS,
104
104
  result.usage_metadata["input_tokens"],
@@ -77,7 +77,7 @@ def set_response_attributes(span: Span, result):
77
77
  if hasattr(result, "text"):
78
78
  set_event_completion(span, [{"role": "assistant", "content": result.text}])
79
79
 
80
- if hasattr(result, "usage_metadata"):
80
+ if hasattr(result, "usage_metadata") and result.usage_metadata is not None:
81
81
  usage = result.usage_metadata
82
82
  input_tokens = usage.prompt_token_count
83
83
  output_tokens = usage.candidates_token_count
@@ -421,7 +421,7 @@ class StreamWrapper:
421
421
  self.completion_tokens = chunk.usage.completion_tokens
422
422
 
423
423
  # VertexAI
424
- if hasattr(chunk, "usage_metadata"):
424
+ if hasattr(chunk, "usage_metadata") and chunk.usage_metadata is not None:
425
425
  self.completion_tokens = chunk.usage_metadata.candidates_token_count
426
426
  self.prompt_tokens = chunk.usage_metadata.prompt_token_count
427
427
 
@@ -1 +1 @@
1
- __version__ = "3.3.13"
1
+ __version__ = "3.3.14"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 3.3.13
3
+ Version: 3.3.14
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>
@@ -106,7 +106,7 @@ examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56sn
106
106
  examples/weaviate_example/query_text.py,sha256=wPHQTc_58kPoKTZMygVjTj-2ZcdrIuaausJfMxNQnQc,127162
107
107
  langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
108
108
  langtrace_python_sdk/langtrace.py,sha256=AN6ecuL47c5eIkgYLW-0nDyEZPaqKfOYRbw7ceZzJss,12598
109
- langtrace_python_sdk/version.py,sha256=NrcIAr0BNQR9mCN28fqqP9XcjFrymE0bA3_rqg6Oem8,23
109
+ langtrace_python_sdk/version.py,sha256=CqO2fihQQDwHrmeVCLh8taqNG1MqN22CIlPvPJZ-nVc,23
110
110
  langtrace_python_sdk/constants/__init__.py,sha256=3CNYkWMdd1DrkGqzLUgNZXjdAlM6UFMlf_F-odAToyc,146
111
111
  langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=d-3Qn5C_NTy1NkmdavZvy-6vePwTC5curN6QMy2haHc,50
112
112
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -162,7 +162,7 @@ langtrace_python_sdk/instrumentation/embedchain/instrumentation.py,sha256=dShwm0
162
162
  langtrace_python_sdk/instrumentation/embedchain/patch.py,sha256=ovvBrtqUDwGSmSgK_S3pOOrDa4gkPSFG-HvmsxqmJE8,3627
163
163
  langtrace_python_sdk/instrumentation/gemini/__init__.py,sha256=ilWmKA4Li-g3DX6R10WQ4v-51VljxToEnJpOQoQB5uQ,88
164
164
  langtrace_python_sdk/instrumentation/gemini/instrumentation.py,sha256=eGWr2dy1f_9TVZiXSH_MlNQINyS4I28EsOTKREdMVio,1304
165
- langtrace_python_sdk/instrumentation/gemini/patch.py,sha256=thhqxrzk-nLiV0lzEwVWzbzOJndDarYIck6N9Gq3aTM,6151
165
+ langtrace_python_sdk/instrumentation/gemini/patch.py,sha256=PG5E5v253x2ufQ81-aUUFzDRYq-DDhiqwmNoplHPjsM,6261
166
166
  langtrace_python_sdk/instrumentation/groq/__init__.py,sha256=ZXeq_nrej6Lm_uoMFEg8wbSejhjB2UJ5IoHQBPc2-C0,91
167
167
  langtrace_python_sdk/instrumentation/groq/instrumentation.py,sha256=Ttf07XVKhdYY1_fqJc7QWiSdmgEhEVyQB_3Az2_wqYo,1832
168
168
  langtrace_python_sdk/instrumentation/groq/patch.py,sha256=J0h8SXEw2LyMIJhKZTVydEysyKfSLWkCuhEharzDS4w,23161
@@ -174,7 +174,7 @@ langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py,sha2
174
174
  langtrace_python_sdk/instrumentation/langchain_community/patch.py,sha256=Vh9XxkXo_0eD3etrTTb-6ME6LroNJy5e75VYcfhc44U,6289
175
175
  langtrace_python_sdk/instrumentation/langchain_core/__init__.py,sha256=kumE_reeqgM-ZvEZ6-XxyT-F-HAdKq_v_PKvsLb4EZQ,110
176
176
  langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py,sha256=szTCveG4IP64rlaY4iZATWv2f38k1_DtfbBU60YlfYk,6730
177
- langtrace_python_sdk/instrumentation/langchain_core/patch.py,sha256=CXEfbq6E88X_y3JF7CaEEbNCYzSfig5ztNHW-aiiTic,10918
177
+ langtrace_python_sdk/instrumentation/langchain_core/patch.py,sha256=GODPXS1RvYVuRDyxcP9dX5TBI_JniPtRe0WWdeIIzcY,10956
178
178
  langtrace_python_sdk/instrumentation/langgraph/__init__.py,sha256=eitlHloY-aZ4ZuIEJx61AadEA3G7siyecP-V-lziAr8,101
179
179
  langtrace_python_sdk/instrumentation/langgraph/instrumentation.py,sha256=lEm_rcOU4JqXGmhG1C2yrIiPbt9vntvxmU7pZg8NYtE,2313
180
180
  langtrace_python_sdk/instrumentation/langgraph/patch.py,sha256=e1cFCDUB8Dwl2ekxgnZ36S2XkWROagRGtxF3Rz5F8RM,4931
@@ -209,14 +209,14 @@ langtrace_python_sdk/instrumentation/qdrant/instrumentation.py,sha256=vl2eKSP55a
209
209
  langtrace_python_sdk/instrumentation/qdrant/patch.py,sha256=IgdozFyKqB8n72BjKvBDiMhYM4o75DReD0I8_uIQ7KY,5015
210
210
  langtrace_python_sdk/instrumentation/vertexai/__init__.py,sha256=ZzKxB7bl0FaRlgJhhgAk5V8Bf20FmThWM_Z9u9Eyy1s,92
211
211
  langtrace_python_sdk/instrumentation/vertexai/instrumentation.py,sha256=yz4trw0BqGbNUvlagsejk_j8pDvRHxxQFtYJVarNKqY,1393
212
- langtrace_python_sdk/instrumentation/vertexai/patch.py,sha256=mLMmmmovYBaDXgnSSJEt3iwv5xBLJv1XZHxW_xRVeXo,4433
212
+ langtrace_python_sdk/instrumentation/vertexai/patch.py,sha256=55xwmkFfeevEc4yOHPRxwdeRrsS6UptcZoMq-yeFrt4,4471
213
213
  langtrace_python_sdk/instrumentation/weaviate/__init__.py,sha256=Mc-Je6evPo-kKQzerTG7bd1XO5JOh4YGTE3wBxaUBwg,99
214
214
  langtrace_python_sdk/instrumentation/weaviate/instrumentation.py,sha256=Kwq5QQTUQNRHrWrMnNe9X0TcqtXGiNpBidsuToRTqG0,2417
215
215
  langtrace_python_sdk/instrumentation/weaviate/patch.py,sha256=aWLDbNGz35V6XQUv4lkMD0O689suqh6KdTa33VDtUkE,6905
216
216
  langtrace_python_sdk/types/__init__.py,sha256=2VykM6fNHRlkOaIEUCdK3VyaaVgk2rTIr9jMmCVj2Ag,4676
217
217
  langtrace_python_sdk/utils/__init__.py,sha256=VVDOG-QLd59ZvSHp0avjof0sbxlZ1QQOf0KoOF7ofhQ,3310
218
218
  langtrace_python_sdk/utils/langtrace_sampler.py,sha256=BupNndHbU9IL_wGleKetz8FdcveqHMBVz1bfKTTW80w,1753
219
- langtrace_python_sdk/utils/llm.py,sha256=mA7nEpndjKwPY3LfYV8hv-83xrDlD8MSTW8mItp5tXI,14953
219
+ langtrace_python_sdk/utils/llm.py,sha256=jFOypinssPg14KtiDUnut545DO_nqccOAPgeskFiJR4,14990
220
220
  langtrace_python_sdk/utils/misc.py,sha256=LaQr5LOmZMiuwVdjYh7aIu6o2C_Xb1wgpQGNOVmRzfE,1918
221
221
  langtrace_python_sdk/utils/prompt_registry.py,sha256=n5dQMVLBw8aJZY8Utvf67bncc25ELf6AH9BYw8_hSzo,2619
222
222
  langtrace_python_sdk/utils/sdk_version_checker.py,sha256=F-VVVH7Fmhr5LcY0IIe-34zIi5RQcx26uuxFpPzZesM,1782
@@ -265,8 +265,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
265
265
  tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
266
266
  tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
267
267
  tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
268
- langtrace_python_sdk-3.3.13.dist-info/METADATA,sha256=PTvFNsHskew8hssq1CAxynLul99E0Z3jZpJRPw9qXWk,15643
269
- langtrace_python_sdk-3.3.13.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
270
- langtrace_python_sdk-3.3.13.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
271
- langtrace_python_sdk-3.3.13.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
272
- langtrace_python_sdk-3.3.13.dist-info/RECORD,,
268
+ langtrace_python_sdk-3.3.14.dist-info/METADATA,sha256=keb-ijUSoM7Pcas5rJH4UMhaw4pwWTP8dW3ujw6G8GE,15643
269
+ langtrace_python_sdk-3.3.14.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
270
+ langtrace_python_sdk-3.3.14.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
271
+ langtrace_python_sdk-3.3.14.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
272
+ langtrace_python_sdk-3.3.14.dist-info/RECORD,,