lmnr 0.4.42__tar.gz → 0.4.44__tar.gz

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.
Files changed (32) hide show
  1. {lmnr-0.4.42 → lmnr-0.4.44}/PKG-INFO +1 -1
  2. {lmnr-0.4.42 → lmnr-0.4.44}/pyproject.toml +2 -2
  3. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/decorators/base.py +28 -2
  4. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/laminar.py +1 -0
  5. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/types.py +2 -2
  6. {lmnr-0.4.42 → lmnr-0.4.44}/LICENSE +0 -0
  7. {lmnr-0.4.42 → lmnr-0.4.44}/README.md +0 -0
  8. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/__init__.py +0 -0
  9. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/cli.py +0 -0
  10. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/.flake8 +0 -0
  11. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/.python-version +0 -0
  12. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/__init__.py +0 -0
  13. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/config/__init__.py +0 -0
  14. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/decorators/__init__.py +0 -0
  15. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/instruments.py +0 -0
  16. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/tracing/__init__.py +0 -0
  17. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/tracing/attributes.py +0 -0
  18. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/tracing/content_allow_list.py +0 -0
  19. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/tracing/context_manager.py +0 -0
  20. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/tracing/tracing.py +0 -0
  21. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/utils/__init__.py +0 -0
  22. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/utils/in_memory_span_exporter.py +0 -0
  23. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/utils/json_encoder.py +0 -0
  24. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/utils/package_check.py +0 -0
  25. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/openllmetry_sdk/version.py +0 -0
  26. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/__init__.py +0 -0
  27. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/datasets.py +0 -0
  28. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/decorators.py +0 -0
  29. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/eval_control.py +0 -0
  30. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/evaluations.py +0 -0
  31. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/log.py +0 -0
  32. {lmnr-0.4.42 → lmnr-0.4.44}/src/lmnr/sdk/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lmnr
3
- Version: 0.4.42
3
+ Version: 0.4.44
4
4
  Summary: Python SDK for Laminar AI
5
5
  License: Apache-2.0
6
6
  Author: lmnr.ai
@@ -6,7 +6,7 @@
6
6
 
7
7
  [project]
8
8
  name = "lmnr"
9
- version = "0.4.42"
9
+ version = "0.4.44"
10
10
  description = "Python SDK for Laminar AI"
11
11
  authors = [
12
12
  { name = "lmnr.ai", email = "founders@lmnr.ai" }
@@ -17,7 +17,7 @@ license = "Apache-2.0"
17
17
 
18
18
  [tool.poetry]
19
19
  name = "lmnr"
20
- version = "0.4.42"
20
+ version = "0.4.44"
21
21
  description = "Python SDK for Laminar AI"
22
22
  authors = ["lmnr.ai"]
23
23
  readme = "README.md"
@@ -3,11 +3,13 @@ from functools import wraps
3
3
  import logging
4
4
  import os
5
5
  import pydantic
6
+ import traceback
6
7
  import types
7
8
  from typing import Any, Optional
8
9
 
9
10
  from opentelemetry import trace
10
11
  from opentelemetry import context as context_api
12
+ from opentelemetry.trace import Span
11
13
 
12
14
  from lmnr.sdk.utils import get_input_from_func_args, is_method
13
15
  from lmnr.openllmetry_sdk.tracing import get_tracer
@@ -69,7 +71,12 @@ def entity_method(
69
71
  except TypeError:
70
72
  pass
71
73
 
72
- res = fn(*args, **kwargs)
74
+ try:
75
+ res = fn(*args, **kwargs)
76
+ except Exception as e:
77
+ _process_exception(span, e)
78
+ span.end()
79
+ raise e
73
80
 
74
81
  # span will be ended in the generator
75
82
  if isinstance(res, types.GeneratorType):
@@ -131,7 +138,12 @@ def aentity_method(
131
138
  except TypeError:
132
139
  pass
133
140
 
134
- res = await fn(*args, **kwargs)
141
+ try:
142
+ res = await fn(*args, **kwargs)
143
+ except Exception as e:
144
+ _process_exception(span, e)
145
+ span.end()
146
+ raise e
135
147
 
136
148
  # span will be ended in the generator
137
149
  if isinstance(res, types.AsyncGeneratorType):
@@ -177,3 +189,17 @@ def _should_send_prompts():
177
189
  return (
178
190
  os.getenv("TRACELOOP_TRACE_CONTENT") or "true"
179
191
  ).lower() == "true" or context_api.get_value("override_enable_content_tracing")
192
+
193
+
194
+ def _process_exception(span: Span, e: Exception):
195
+ exception_path = [type(e).__module__] if type(e).__module__ != "builtins" else []
196
+ exception_path.append(type(e).__qualname__)
197
+ span.add_event(
198
+ "exception",
199
+ {
200
+ "exception.message": str(e),
201
+ "exception.type": ".".join(exception_path),
202
+ "exception.stacktrace": traceback.format_exc(),
203
+ "exception.escaped": True,
204
+ },
205
+ )
@@ -347,6 +347,7 @@ class Laminar:
347
347
 
348
348
  if not cls.is_initialized():
349
349
  yield
350
+ return
350
351
 
351
352
  with get_tracer() as tracer:
352
353
  span_path = get_span_path(name)
@@ -124,7 +124,7 @@ ExecutorFunctionReturnType = Any
124
124
  EvaluatorFunctionReturnType = Union[Numeric, dict[str, Numeric]]
125
125
 
126
126
  ExecutorFunction = Callable[
127
- [EvaluationDatapointData, Any, dict[str, Any]],
127
+ [EvaluationDatapointData, Any],
128
128
  Union[ExecutorFunctionReturnType, Awaitable[ExecutorFunctionReturnType]],
129
129
  ]
130
130
 
@@ -133,7 +133,7 @@ ExecutorFunction = Callable[
133
133
  # record of string keys and number values. The latter is useful for evaluating
134
134
  # multiple criteria in one go instead of running multiple evaluators.
135
135
  EvaluatorFunction = Callable[
136
- [ExecutorFunctionReturnType, Any, dict[str, Any]],
136
+ [ExecutorFunctionReturnType, Any],
137
137
  Union[EvaluatorFunctionReturnType, Awaitable[EvaluatorFunctionReturnType]],
138
138
  ]
139
139
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes