lmnr 0.4.14__py3-none-any.whl → 0.4.15b2__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.
lmnr/sdk/decorators.py CHANGED
@@ -4,7 +4,8 @@ from lmnr.traceloop_sdk.decorators.base import (
4
4
  )
5
5
  from opentelemetry.trace import INVALID_SPAN, get_current_span
6
6
 
7
- from typing import Callable, Optional, cast
7
+ from typing import Callable, Optional, TypeVar, cast
8
+ from typing_extensions import ParamSpec
8
9
 
9
10
  from lmnr.traceloop_sdk.tracing.attributes import SESSION_ID, USER_ID
10
11
  from lmnr.traceloop_sdk.tracing.tracing import update_association_properties
@@ -12,12 +13,16 @@ from lmnr.traceloop_sdk.tracing.tracing import update_association_properties
12
13
  from .utils import is_async
13
14
 
14
15
 
16
+ P = ParamSpec("P")
17
+ R = TypeVar("R")
18
+
19
+
15
20
  def observe(
16
21
  *,
17
22
  name: Optional[str] = None,
18
23
  user_id: Optional[str] = None,
19
24
  session_id: Optional[str] = None,
20
- ) -> Callable[[Callable], Callable]:
25
+ ) -> Callable[[Callable[P, R]], Callable[P, R]]:
21
26
  """The main decorator entrypoint for Laminar. This is used to wrap
22
27
  functions and methods to create spans.
23
28
 
@@ -43,13 +48,9 @@ def observe(
43
48
  current_span = get_current_span()
44
49
  if current_span != INVALID_SPAN:
45
50
  if session_id is not None:
46
- current_span.set_attribute(
47
- SESSION_ID, session_id
48
- )
51
+ current_span.set_attribute(SESSION_ID, session_id)
49
52
  if user_id is not None:
50
- current_span.set_attribute(
51
- USER_ID, user_id
52
- )
53
+ current_span.set_attribute(USER_ID, user_id)
53
54
  association_properties = {}
54
55
  if session_id is not None:
55
56
  association_properties["session_id"] = session_id
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lmnr
3
- Version: 0.4.14
3
+ Version: 0.4.15b2
4
4
  Summary: Python SDK for Laminar AI
5
5
  License: Apache-2.0
6
6
  Author: lmnr.ai
@@ -49,11 +49,10 @@ Requires-Dist: opentelemetry-instrumentation-watsonx (>=0.30.0,<0.31.0)
49
49
  Requires-Dist: opentelemetry-instrumentation-weaviate (>=0.30.0,<0.31.0)
50
50
  Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0)
51
51
  Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.1)
52
- Requires-Dist: posthog (>=3.0,<4.0)
53
52
  Requires-Dist: pydantic (>=2.7,<3.0)
54
53
  Requires-Dist: python-dotenv (>=1.0,<2.0)
55
54
  Requires-Dist: requests (>=2.0,<3.0)
56
- Requires-Dist: tenacity (>=8.0,<9.0)
55
+ Requires-Dist: tenacity (>=8.0)
57
56
  Requires-Dist: tqdm (>=4.0,<5.0)
58
57
  Description-Content-Type: text/markdown
59
58
 
@@ -1,7 +1,7 @@
1
1
  lmnr/__init__.py,sha256=5Ks8UIicCzCBgwSz0MOX3I7jVruPMUO3SmxIwUoODzQ,231
2
2
  lmnr/cli.py,sha256=Ptvm5dsNLKUY5lwnN8XkT5GtCYjzpRNi2WvefknB3OQ,1079
3
3
  lmnr/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- lmnr/sdk/decorators.py,sha256=ii7Bqp6flaanIFSK6M1_ZZV-izp4o3hkR1MmY7wnFQQ,2227
4
+ lmnr/sdk/decorators.py,sha256=ZSDaEZyjo-RUzRCltsNbe6x0t9SKl2xRQ2q4uaKvXtk,2250
5
5
  lmnr/sdk/evaluations.py,sha256=Tukl2pW_x13ittzG5XQpF1TweYo3fpD4eLInplQ4YYI,14152
6
6
  lmnr/sdk/laminar.py,sha256=d5Vn0eSVIoI_SxFcTh71T-_w7_E_odvFDFiLU2YwzZo,16509
7
7
  lmnr/sdk/log.py,sha256=EgAMY77Zn1bv1imCqrmflD3imoAJ2yveOkIcrIP3e98,1170
@@ -44,8 +44,8 @@ lmnr/traceloop_sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQv
44
44
  lmnr/traceloop_sdk/utils/json_encoder.py,sha256=dK6b_axr70IYL7Vv-bu4wntvDDuyntoqsHaddqX7P58,463
45
45
  lmnr/traceloop_sdk/utils/package_check.py,sha256=TZSngzJOpFhfUZLXIs38cpMxQiZSmp0D-sCrIyhz7BA,251
46
46
  lmnr/traceloop_sdk/version.py,sha256=OlatFEFA4ttqSSIiV8jdE-sq3KG5zu2hnC4B4mzWF3s,23
47
- lmnr-0.4.14.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
48
- lmnr-0.4.14.dist-info/METADATA,sha256=WSsRng3syFI0DugYr2-V6nRZIA1F_xo3_ikuHE6PDq8,11266
49
- lmnr-0.4.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
50
- lmnr-0.4.14.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
51
- lmnr-0.4.14.dist-info/RECORD,,
47
+ lmnr-0.4.15b2.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
48
+ lmnr-0.4.15b2.dist-info/METADATA,sha256=06B9aEa-rmHAbDu0ev3ocBU0JPYVEKm7T-VcO98_0o8,11227
49
+ lmnr-0.4.15b2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
50
+ lmnr-0.4.15b2.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
51
+ lmnr-0.4.15b2.dist-info/RECORD,,
File without changes