langtrace-python-sdk 2.2.16__py3-none-any.whl → 2.2.17__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.
@@ -167,20 +167,21 @@ def _handle_streaming_response(span, response, api):
167
167
  accumulated_tokens = None
168
168
  if api == "chat":
169
169
  accumulated_tokens = {"message": {"content": "", "role": ""}}
170
- if api == "completion":
170
+ if api == "completion" or api == "generate":
171
171
  accumulated_tokens = {"response": ""}
172
172
  span.add_event(Event.STREAM_START.value)
173
173
  try:
174
174
  for chunk in response:
175
+ content = None
175
176
  if api == "chat":
177
+ content = chunk["message"]["content"]
176
178
  accumulated_tokens["message"]["content"] += chunk["message"]["content"]
177
179
  accumulated_tokens["message"]["role"] = chunk["message"]["role"]
178
180
  if api == "generate":
181
+ content = chunk["response"]
179
182
  accumulated_tokens["response"] += chunk["response"]
180
183
 
181
- set_event_completion_chunk(
182
- span, chunk.get("response") or chunk.get("message").get("content")
183
- )
184
+ set_event_completion_chunk(span, content)
184
185
 
185
186
  _set_response_attributes(span, chunk | accumulated_tokens)
186
187
  finally:
@@ -196,19 +197,22 @@ async def _ahandle_streaming_response(span, response, api):
196
197
  accumulated_tokens = None
197
198
  if api == "chat":
198
199
  accumulated_tokens = {"message": {"content": "", "role": ""}}
199
- if api == "completion":
200
+ if api == "completion" or api == "generate":
200
201
  accumulated_tokens = {"response": ""}
201
202
 
202
203
  span.add_event(Event.STREAM_START.value)
203
204
  try:
204
205
  async for chunk in response:
206
+ content = None
205
207
  if api == "chat":
208
+ content = chunk["message"]["content"]
206
209
  accumulated_tokens["message"]["content"] += chunk["message"]["content"]
207
210
  accumulated_tokens["message"]["role"] = chunk["message"]["role"]
208
211
  if api == "generate":
212
+ content = chunk["response"]
209
213
  accumulated_tokens["response"] += chunk["response"]
210
214
 
211
- set_event_completion_chunk(span, chunk)
215
+ set_event_completion_chunk(span, content)
212
216
  _set_response_attributes(span, chunk | accumulated_tokens)
213
217
  finally:
214
218
  # Finalize span after processing all chunks
@@ -1 +1 @@
1
- __version__ = "2.2.16"
1
+ __version__ = "2.2.17"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 2.2.16
3
+ Version: 2.2.17
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>
@@ -62,7 +62,7 @@ examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56sn
62
62
  examples/weaviate_example/query_text.py,sha256=sG8O-bXQpflBAiYpgE_M2X7GcHUlZNgl_wJW8_h-W6Q,127024
63
63
  langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
64
64
  langtrace_python_sdk/langtrace.py,sha256=1L0IjME-pzEYht92QfwByPZr3H1MClTrqQdoN1KyKJY,7689
65
- langtrace_python_sdk/version.py,sha256=no6LjBPvKvxE5dOerrj3PJZfcUxDYj55SCfGYgHoK90,23
65
+ langtrace_python_sdk/version.py,sha256=hjMOqp8UAdaorn81Yw7bZbU6dNdRaB_NWQmHbo4JvyY,23
66
66
  langtrace_python_sdk/constants/__init__.py,sha256=P8QvYwt5czUNDZsKS64vxm9Dc41ptGbuF1TFtAF6nv4,44
67
67
  langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=5MNjnAOg-4am78J3gVMH6FSwq5N8TOj72ugkhsw4vi0,46
68
68
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -120,7 +120,7 @@ langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py,sha256=8iAg-O
120
120
  langtrace_python_sdk/instrumentation/llamaindex/patch.py,sha256=OGk7ps438gW49zvJQCDp7ZmkQnFxouAUu2PvHbmcAP8,4496
121
121
  langtrace_python_sdk/instrumentation/ollama/__init__.py,sha256=g2zJsXnDHinXPzTc-WxDeTtHmr9gmAj3K6l_00kP8c8,82
122
122
  langtrace_python_sdk/instrumentation/ollama/instrumentation.py,sha256=jdsvkqUJAAUNLVPtAkn_rG26HXetVQXWtjn4a6eWZro,2029
123
- langtrace_python_sdk/instrumentation/ollama/patch.py,sha256=ky58NUyAETmaOqSAsB-LzDpoCosY6W54YeAJ9XftE-Q,7878
123
+ langtrace_python_sdk/instrumentation/ollama/patch.py,sha256=isyeHGuITSHCUVrc2iFmszkXX0k7To17VB3k9OoBHlI,8089
124
124
  langtrace_python_sdk/instrumentation/openai/__init__.py,sha256=VPHRNCQEdkizIVP2d0Uw_a7t8XOTSTprEIB8oboJFbs,95
125
125
  langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=A0BJHRLcZ74TNVg6I0I9M5YWvSpAtXwMmME6N5CEQ_M,2945
126
126
  langtrace_python_sdk/instrumentation/openai/patch.py,sha256=ebxUpg0X60e7uK-IPWb_fSDxpP3d5BG-xhOEBIABo14,24082
@@ -188,8 +188,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
188
188
  tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
189
189
  tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
190
190
  tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
191
- langtrace_python_sdk-2.2.16.dist-info/METADATA,sha256=o_xhUrMhpxXCiU72rMMaz1KUWL6l4RVjD-M3zQLw6r4,14705
192
- langtrace_python_sdk-2.2.16.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
193
- langtrace_python_sdk-2.2.16.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
194
- langtrace_python_sdk-2.2.16.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
195
- langtrace_python_sdk-2.2.16.dist-info/RECORD,,
191
+ langtrace_python_sdk-2.2.17.dist-info/METADATA,sha256=BlsENLAAnXawtZ6oihmH83LDCSbn6uTjnArV2l2jQbY,14705
192
+ langtrace_python_sdk-2.2.17.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
193
+ langtrace_python_sdk-2.2.17.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
194
+ langtrace_python_sdk-2.2.17.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
195
+ langtrace_python_sdk-2.2.17.dist-info/RECORD,,