lmnr 0.7.14__py3-none-any.whl → 0.7.15__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.

Potentially problematic release.


This version of lmnr might be problematic. Click here for more details.

@@ -225,7 +225,7 @@ def observe_base(
225
225
  detach_context(isolated_ctx_token)
226
226
  # span will be ended in the generator
227
227
  if isinstance(res, types.GeneratorType):
228
- return _handle_generator(span, ctx_token, res)
228
+ return _handle_generator(span, wrapper, res)
229
229
  if isinstance(res, types.AsyncGeneratorType):
230
230
  # async def foo() -> AsyncGenerator[int, None]:
231
231
  # is not considered async in a classical sense in Python,
@@ -234,7 +234,7 @@ def observe_base(
234
234
  # Flags are listed from LSB here:
235
235
  # https://docs.python.org/3/library/inspect.html#inspect-module-co-flags
236
236
  # See also: https://groups.google.com/g/python-tulip/c/6rWweGXLutU?pli=1
237
- return _ahandle_generator(span, ctx_token, res)
237
+ return _ahandle_generator(span, wrapper, res)
238
238
 
239
239
  _process_output(span, res, ignore_output, output_formatter)
240
240
  _cleanup_span(span, wrapper)
@@ -306,7 +306,7 @@ def async_observe_base(
306
306
  if isinstance(res, types.AsyncGeneratorType):
307
307
  # probably unreachable, read the comment in the similar
308
308
  # part of the sync wrapper.
309
- return await _ahandle_generator(span, ctx_token, res)
309
+ return await _ahandle_generator(span, wrapper, res)
310
310
 
311
311
  _process_output(span, res, ignore_output, output_formatter)
312
312
  _cleanup_span(span, wrapper)
@@ -317,18 +317,37 @@ def async_observe_base(
317
317
  return decorate
318
318
 
319
319
 
320
- def _handle_generator(span: Span, wrapper: TracerWrapper, res: Generator):
320
+ def _handle_generator(
321
+ span: Span,
322
+ wrapper: TracerWrapper,
323
+ res: Generator,
324
+ ignore_output: bool = False,
325
+ output_formatter: Callable[..., str] | None = None,
326
+ ):
327
+ results = []
321
328
  try:
322
- yield from res
329
+ for part in res:
330
+ results.append(part)
331
+ yield part
323
332
  finally:
333
+ _process_output(span, results, ignore_output, output_formatter)
324
334
  _cleanup_span(span, wrapper)
325
335
 
326
336
 
327
- async def _ahandle_generator(span: Span, wrapper: TracerWrapper, res: AsyncGenerator):
337
+ async def _ahandle_generator(
338
+ span: Span,
339
+ wrapper: TracerWrapper,
340
+ res: AsyncGenerator,
341
+ ignore_output: bool = False,
342
+ output_formatter: Callable[..., str] | None = None,
343
+ ):
344
+ results = []
328
345
  try:
329
346
  async for part in res:
347
+ results.append(part)
330
348
  yield part
331
349
  finally:
350
+ _process_output(span, results, ignore_output, output_formatter)
332
351
  _cleanup_span(span, wrapper)
333
352
 
334
353
 
lmnr/version.py CHANGED
@@ -3,7 +3,7 @@ import httpx
3
3
  from packaging import version
4
4
 
5
5
 
6
- __version__ = "0.7.14"
6
+ __version__ = "0.7.15"
7
7
  PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
8
8
 
9
9
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lmnr
3
- Version: 0.7.14
3
+ Version: 0.7.15
4
4
  Summary: Python SDK for Laminar
5
5
  Author: lmnr.ai
6
6
  Author-email: lmnr.ai <founders@lmnr.ai>
@@ -2,7 +2,7 @@ lmnr/__init__.py,sha256=8be7b56ab62735fd54ca90a0642784c6153ed1d6e0f12734619ca061
2
2
  lmnr/cli.py,sha256=b8780b51f37fe9e20db5495c41d3ad3837f6b48f408b09a58688d017850c0796,6047
3
3
  lmnr/opentelemetry_lib/.flake8,sha256=6c2c6e0e51b1dd8439e501ca3e21899277076a787da868d0254ba37056b79405,150
4
4
  lmnr/opentelemetry_lib/__init__.py,sha256=abdd649b6c906a7dd2985b5a0903067904a457341d0da28a559c89a9faf939c7,2572
5
- lmnr/opentelemetry_lib/decorators/__init__.py,sha256=d18206ae4e65147b3101b82b3bb7413f765149c5523616a6a06be1939b0878b8,11793
5
+ lmnr/opentelemetry_lib/decorators/__init__.py,sha256=f7a19b40bf8f8145b6ff0a04e49e412ac52c3f850c330dec4a5087ead3aaf9e0,12264
6
6
  lmnr/opentelemetry_lib/litellm/__init__.py,sha256=af1d6c1067c1d30b35f5bdfdbc7ad3565f1178a571fd770974c411fef7b5ff0f,27478
7
7
  lmnr/opentelemetry_lib/litellm/utils.py,sha256=642c3857e09d8c8dfc327c23e711687c15cbed6c0ba3f0a7be7751356beb8b43,3427
8
8
  lmnr/opentelemetry_lib/opentelemetry/instrumentation/anthropic/__init__.py,sha256=897b1a255ce2370d196018abcaf5942295a374cf367b668a3b418c3bddd29251,26461
@@ -97,8 +97,8 @@ lmnr/sdk/laminar.py,sha256=24adfd64da01d7fd69ba9437cf9860a5c64aa6baab1bb92d8ba14
97
97
  lmnr/sdk/log.py,sha256=9edfd83263f0d4845b1b2d1beeae2b4ed3f8628de941f371a893d72b79c348d4,2213
98
98
  lmnr/sdk/types.py,sha256=d8061ca90dd582b408a893ebbbeb1586e8750ed30433ef4f6d63423a078511b0,14574
99
99
  lmnr/sdk/utils.py,sha256=4114559ba6ae57fcba2de2bfaa09339688ce5752c36f028a7b55e51eae624947,6307
100
- lmnr/version.py,sha256=fdf6db3bfdec750eb7f9e086f1383d81089cece53220f95a2462f750866164cc,1322
101
- lmnr-0.7.14.dist-info/WHEEL,sha256=ab6157bc637547491fb4567cd7ddf26b04d63382916ca16c29a5c8e94c9c9ef7,79
102
- lmnr-0.7.14.dist-info/entry_points.txt,sha256=abdf3411b7dd2d7329a241f2da6669bab4e314a747a586ecdb9f888f3035003c,39
103
- lmnr-0.7.14.dist-info/METADATA,sha256=6d8d77fa8ee86053d6d0796676ebcbd09160e3c639a5ff040983169a030d8ad2,14195
104
- lmnr-0.7.14.dist-info/RECORD,,
100
+ lmnr/version.py,sha256=4be8b1840f08a33d10273044726916066f06fba0624ab5614daed347ff630a74,1322
101
+ lmnr-0.7.15.dist-info/WHEEL,sha256=ab6157bc637547491fb4567cd7ddf26b04d63382916ca16c29a5c8e94c9c9ef7,79
102
+ lmnr-0.7.15.dist-info/entry_points.txt,sha256=abdf3411b7dd2d7329a241f2da6669bab4e314a747a586ecdb9f888f3035003c,39
103
+ lmnr-0.7.15.dist-info/METADATA,sha256=33a2c347cb8204fd6bdf162383c46fd31238f4cbcfade59753c3f9790bf80880,14195
104
+ lmnr-0.7.15.dist-info/RECORD,,
File without changes