lmnr 0.4.16b0__tar.gz → 0.4.17b1__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.16b0 → lmnr-0.4.17b1}/PKG-INFO +4 -12
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/README.md +2 -10
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/pyproject.toml +3 -3
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/laminar.py +14 -50
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/LICENSE +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/cli.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/decorators.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/evaluations.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/log.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/types.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/sdk/utils.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/.flake8 +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/.python-version +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/config/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/decorators/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/decorators/base.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/instruments.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_association_properties/test_langchain_and_external_association_properties.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_association_properties/test_langchain_association_properties.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_manual/test_manual_report.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_manual/test_resource_attributes.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_privacy_no_prompts/test_simple_workflow.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_prompt_management/test_prompt_management.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_sdk_initialization/test_resource_attributes.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_tasks/test_task_io_serialization_with_langchain.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_workflows/test_simple_aworkflow.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_workflows/test_simple_workflow.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/cassettes/test_workflows/test_streaming_workflow.yaml +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/conftest.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_association_properties.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_manual.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_nested_tasks.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_privacy_no_prompts.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_sdk_initialization.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_tasks.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tests/test_workflows.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tracing/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tracing/attributes.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tracing/content_allow_list.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tracing/context_manager.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/tracing/tracing.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/utils/__init__.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/utils/in_memory_span_exporter.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/utils/json_encoder.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/utils/package_check.py +0 -0
- {lmnr-0.4.16b0 → lmnr-0.4.17b1}/src/lmnr/traceloop_sdk/version.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lmnr
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.17b1
|
4
4
|
Summary: Python SDK for Laminar AI
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: lmnr.ai
|
@@ -41,7 +41,7 @@ Requires-Dist: opentelemetry-instrumentation-replicate (>=0.32.0)
|
|
41
41
|
Requires-Dist: opentelemetry-instrumentation-requests (>=0.48b0,<0.49)
|
42
42
|
Requires-Dist: opentelemetry-instrumentation-sqlalchemy (>=0.48b0,<0.49)
|
43
43
|
Requires-Dist: opentelemetry-instrumentation-threading (>=0.48b0,<0.49)
|
44
|
-
Requires-Dist: opentelemetry-instrumentation-together (>=0.
|
44
|
+
Requires-Dist: opentelemetry-instrumentation-together (>=0.32.0)
|
45
45
|
Requires-Dist: opentelemetry-instrumentation-transformers (>=0.32.0)
|
46
46
|
Requires-Dist: opentelemetry-instrumentation-urllib3 (>=0.48b0,<0.49)
|
47
47
|
Requires-Dist: opentelemetry-instrumentation-vertexai (>=0.32.0)
|
@@ -173,13 +173,9 @@ Autoinstrumentations are provided by Traceloop's [OpenLLMetry](https://github.co
|
|
173
173
|
|
174
174
|
## Sending events
|
175
175
|
|
176
|
-
You can send events
|
177
|
-
- `.event(name, value)` – for a pre-defined event with one of possible values.
|
178
|
-
- `.evaluate_event(name, evaluator, data)` – for an event that is evaluated by evaluator pipeline based on the data.
|
176
|
+
You can send laminar events using `L.event(name, value)`.
|
179
177
|
|
180
|
-
|
181
|
-
|
182
|
-
Read our [docs](https://docs.lmnr.ai) to learn more about event types and how they are created and evaluated.
|
178
|
+
Read our [docs](https://docs.lmnr.ai) to learn more about events and examples.
|
183
179
|
|
184
180
|
### Example
|
185
181
|
|
@@ -191,10 +187,6 @@ poem = response.choices[0].message.content
|
|
191
187
|
# this will register True or False value with Laminar
|
192
188
|
L.event("topic alignment", topic in poem)
|
193
189
|
|
194
|
-
# this will run the pipeline `check_wordy` with `poem` set as the value
|
195
|
-
# of `text_input` node, and write the result as an event with name
|
196
|
-
# "excessive_wordiness"
|
197
|
-
L.evaluate_event("excessive_wordiness", "check_wordy", {"text_input": poem})
|
198
190
|
```
|
199
191
|
|
200
192
|
## Evaluations
|
@@ -115,13 +115,9 @@ Autoinstrumentations are provided by Traceloop's [OpenLLMetry](https://github.co
|
|
115
115
|
|
116
116
|
## Sending events
|
117
117
|
|
118
|
-
You can send events
|
119
|
-
- `.event(name, value)` – for a pre-defined event with one of possible values.
|
120
|
-
- `.evaluate_event(name, evaluator, data)` – for an event that is evaluated by evaluator pipeline based on the data.
|
118
|
+
You can send laminar events using `L.event(name, value)`.
|
121
119
|
|
122
|
-
|
123
|
-
|
124
|
-
Read our [docs](https://docs.lmnr.ai) to learn more about event types and how they are created and evaluated.
|
120
|
+
Read our [docs](https://docs.lmnr.ai) to learn more about events and examples.
|
125
121
|
|
126
122
|
### Example
|
127
123
|
|
@@ -133,10 +129,6 @@ poem = response.choices[0].message.content
|
|
133
129
|
# this will register True or False value with Laminar
|
134
130
|
L.event("topic alignment", topic in poem)
|
135
131
|
|
136
|
-
# this will run the pipeline `check_wordy` with `poem` set as the value
|
137
|
-
# of `text_input` node, and write the result as an event with name
|
138
|
-
# "excessive_wordiness"
|
139
|
-
L.evaluate_event("excessive_wordiness", "check_wordy", {"text_input": poem})
|
140
132
|
```
|
141
133
|
|
142
134
|
## Evaluations
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "lmnr"
|
3
|
-
version = "0.4.
|
3
|
+
version = "0.4.17b1"
|
4
4
|
description = "Python SDK for Laminar AI"
|
5
5
|
authors = [
|
6
6
|
{ name = "lmnr.ai", email = "founders@lmnr.ai" }
|
@@ -11,7 +11,7 @@ license = "Apache-2.0"
|
|
11
11
|
|
12
12
|
[tool.poetry]
|
13
13
|
name = "lmnr"
|
14
|
-
version = "0.4.
|
14
|
+
version = "0.4.17b1"
|
15
15
|
description = "Python SDK for Laminar AI"
|
16
16
|
authors = ["lmnr.ai"]
|
17
17
|
readme = "README.md"
|
@@ -48,7 +48,7 @@ opentelemetry-instrumentation-langchain = ">=0.32.0"
|
|
48
48
|
opentelemetry-instrumentation-lancedb = ">=0.32.0"
|
49
49
|
opentelemetry-instrumentation-chromadb = ">=0.32.0"
|
50
50
|
opentelemetry-instrumentation-transformers = ">=0.32.0"
|
51
|
-
opentelemetry-instrumentation-together = ">=0.
|
51
|
+
opentelemetry-instrumentation-together = ">=0.32.0"
|
52
52
|
opentelemetry-instrumentation-llamaindex = ">=0.32.0"
|
53
53
|
opentelemetry-instrumentation-milvus = ">=0.32.0"
|
54
54
|
opentelemetry-instrumentation-haystack = ">=0.32.0"
|
@@ -80,7 +80,7 @@ class Laminar:
|
|
80
80
|
in os.environ or in .env file.
|
81
81
|
Defaults to None.
|
82
82
|
env (dict[str, str], optional): Default environment passed to
|
83
|
-
`run`
|
83
|
+
`run` requests, unless
|
84
84
|
overriden at request time. Usually, model
|
85
85
|
provider keys are stored here.
|
86
86
|
Defaults to {}.
|
@@ -265,49 +265,6 @@ class Laminar:
|
|
265
265
|
|
266
266
|
current_span.add_event(name, event, timestamp)
|
267
267
|
|
268
|
-
@classmethod
|
269
|
-
def evaluate_event(
|
270
|
-
cls,
|
271
|
-
name: str,
|
272
|
-
evaluator: str,
|
273
|
-
data: dict[str, AttributeValue],
|
274
|
-
env: Optional[dict[str, str]] = None,
|
275
|
-
timestamp: Optional[Union[datetime.datetime, int]] = None,
|
276
|
-
):
|
277
|
-
"""Send an event for evaluation to the Laminar backend
|
278
|
-
|
279
|
-
Args:
|
280
|
-
name (str): name of the event
|
281
|
-
evaluator (str): name of the pipeline that evaluates the event.
|
282
|
-
The pipeline must have a target version set.
|
283
|
-
data (dict[str, AttributeValue]): map from input node name to
|
284
|
-
its value in the evaluator pipeline
|
285
|
-
env (dict[str, str], optional): environment variables required
|
286
|
-
to run the pipeline. Defaults to {}.
|
287
|
-
timestamp (Optional[Union[datetime.datetime, int]], optional):
|
288
|
-
If int, must be epoch nanoseconds.
|
289
|
-
If not specified, relies on the underlying
|
290
|
-
OpenTelemetry implementation. Defaults to None.
|
291
|
-
"""
|
292
|
-
if timestamp and isinstance(timestamp, datetime.datetime):
|
293
|
-
timestamp = int(timestamp.timestamp() * 1e9)
|
294
|
-
event = {
|
295
|
-
"lmnr.event.type": "evaluate",
|
296
|
-
"lmnr.event.evaluator": evaluator,
|
297
|
-
"lmnr.event.data": json.dumps(data),
|
298
|
-
"lmnr.event.env": json.dumps(env if env is not None else cls.__env),
|
299
|
-
}
|
300
|
-
current_span = get_current_span()
|
301
|
-
if current_span == INVALID_SPAN:
|
302
|
-
cls.__logger.warning(
|
303
|
-
"`Laminar().evaluate_event()` called outside of span context."
|
304
|
-
f"Event '{name}' will not be recorded in the trace. "
|
305
|
-
"Make sure to annotate the function with a decorator"
|
306
|
-
)
|
307
|
-
return
|
308
|
-
|
309
|
-
current_span.add_event(name, event, timestamp)
|
310
|
-
|
311
268
|
@classmethod
|
312
269
|
@contextmanager
|
313
270
|
def start_as_current_span(
|
@@ -412,14 +369,21 @@ class Laminar:
|
|
412
369
|
set_association_properties(props)
|
413
370
|
|
414
371
|
@classmethod
|
415
|
-
def create_evaluation(
|
372
|
+
def create_evaluation(
|
373
|
+
cls,
|
374
|
+
data: list[EvaluationResultDatapoint],
|
375
|
+
group_id: Optional[str] = None,
|
376
|
+
name: Optional[str] = None,
|
377
|
+
) -> CreateEvaluationResponse:
|
416
378
|
response = requests.post(
|
417
379
|
cls.__base_http_url + "/v1/evaluations",
|
418
|
-
data=json.dumps(
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
380
|
+
data=json.dumps(
|
381
|
+
{
|
382
|
+
"groupId": group_id,
|
383
|
+
"name": name,
|
384
|
+
"points": [datapoint.to_dict() for datapoint in data],
|
385
|
+
}
|
386
|
+
),
|
423
387
|
headers=cls._headers(),
|
424
388
|
)
|
425
389
|
if response.status_code != 200:
|
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
|
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
|