lmnr 0.4.47__tar.gz → 0.4.48__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.
- {lmnr-0.4.47 → lmnr-0.4.48}/PKG-INFO +1 -1
- {lmnr-0.4.47 → lmnr-0.4.48}/pyproject.toml +3 -2
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/laminar.py +17 -10
- {lmnr-0.4.47 → lmnr-0.4.48}/LICENSE +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/README.md +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/cli.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/.flake8 +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/.python-version +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/config/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/decorators/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/decorators/base.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/instruments.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/tracing/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/tracing/attributes.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/tracing/content_allow_list.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/tracing/context_manager.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/tracing/tracing.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/utils/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/utils/in_memory_span_exporter.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/utils/json_encoder.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/utils/package_check.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/openllmetry_sdk/version.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/__init__.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/datasets.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/decorators.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/eval_control.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/evaluations.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/log.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/types.py +0 -0
- {lmnr-0.4.47 → lmnr-0.4.48}/src/lmnr/sdk/utils.py +0 -0
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
[project]
|
8
8
|
name = "lmnr"
|
9
|
-
version = "0.4.
|
9
|
+
version = "0.4.48"
|
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.
|
20
|
+
version = "0.4.48"
|
21
21
|
description = "Python SDK for Laminar AI"
|
22
22
|
authors = ["lmnr.ai"]
|
23
23
|
readme = "README.md"
|
@@ -136,6 +136,7 @@ autopep8 = "^2.2.0"
|
|
136
136
|
flake8 = "7.0.0"
|
137
137
|
pytest = "^8.2.2"
|
138
138
|
pytest-sugar = "1.0.0"
|
139
|
+
pytest-asyncio = "^0.24.0"
|
139
140
|
|
140
141
|
[build-system]
|
141
142
|
requires = ["poetry-core"]
|
@@ -12,6 +12,7 @@ from lmnr.openllmetry_sdk.tracing.attributes import (
|
|
12
12
|
from lmnr.openllmetry_sdk.decorators.base import json_dumps
|
13
13
|
from opentelemetry import context, trace
|
14
14
|
from opentelemetry.context import attach, detach, set_value
|
15
|
+
from opentelemetry.sdk.trace import SpanProcessor
|
15
16
|
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
16
17
|
from opentelemetry.util.types import AttributeValue
|
17
18
|
|
@@ -79,6 +80,7 @@ class Laminar:
|
|
79
80
|
http_port: Optional[int] = None,
|
80
81
|
grpc_port: Optional[int] = None,
|
81
82
|
instruments: Optional[Set[Instruments]] = None,
|
83
|
+
_processor: Optional[SpanProcessor] = None,
|
82
84
|
):
|
83
85
|
"""Initialize Laminar context across the application.
|
84
86
|
This method must be called before using any other Laminar methods or
|
@@ -133,7 +135,16 @@ class Laminar:
|
|
133
135
|
cls.__env = env
|
134
136
|
cls.__initialized = True
|
135
137
|
cls._initialize_logger()
|
138
|
+
|
139
|
+
if _processor is not None:
|
140
|
+
cls.__logger.warning(
|
141
|
+
"Using a custom span processor. This feature is added for tests only. "
|
142
|
+
"Any use of this feature outside of tests is not supported and "
|
143
|
+
"advised against."
|
144
|
+
)
|
145
|
+
|
136
146
|
Traceloop.init(
|
147
|
+
processor=_processor,
|
137
148
|
exporter=OTLPSpanExporter(
|
138
149
|
endpoint=cls.__base_grpc_url,
|
139
150
|
headers={"authorization": f"Bearer {cls.__project_api_key}"},
|
@@ -268,13 +279,9 @@ class Laminar:
|
|
268
279
|
value: Optional[AttributeValue] = None,
|
269
280
|
timestamp: Optional[Union[datetime.datetime, int]] = None,
|
270
281
|
):
|
271
|
-
"""Associate an event with the current span. If
|
272
|
-
|
273
|
-
|
274
|
-
value to the event if and only if the value is of a matching type.
|
275
|
-
Otherwise, the event won't be recorded.
|
276
|
-
Supported types are string, numeric, and boolean. If the value
|
277
|
-
is `None`, event is considered a boolean tag with the value of `True`.
|
282
|
+
"""Associate an event with the current span. If using manual\
|
283
|
+
instrumentation, use raw OpenTelemetry `span.add_event()` instead.\
|
284
|
+
`value` will be saved as a `lmnr.event.value` attribute.
|
278
285
|
|
279
286
|
Args:
|
280
287
|
name (str): event name
|
@@ -672,9 +679,9 @@ class Laminar:
|
|
672
679
|
def clear_metadata(cls):
|
673
680
|
"""Clear the metadata from the context"""
|
674
681
|
props: dict = copy.copy(context.get_value("association_properties"))
|
675
|
-
for k in props.keys()
|
676
|
-
|
677
|
-
|
682
|
+
metadata_keys = [k for k in props.keys() if k.startswith("metadata.")]
|
683
|
+
for k in metadata_keys:
|
684
|
+
props.pop(k)
|
678
685
|
set_association_properties(props)
|
679
686
|
|
680
687
|
@classmethod
|
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
|
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
|
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
|