lmnr 0.6.10__tar.gz → 0.6.11__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.6.10 → lmnr-0.6.11}/PKG-INFO +1 -1
- {lmnr-0.6.10 → lmnr-0.6.11}/pyproject.toml +1 -1
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/asynchronous/async_client.py +4 -2
- lmnr-0.6.11/src/lmnr/sdk/client/asynchronous/resources/evals.py +158 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/resources/evals.py +87 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/sync_client.py +3 -1
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/datasets.py +1 -1
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/evaluations.py +3 -3
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/version.py +1 -1
- lmnr-0.6.10/src/lmnr/sdk/client/asynchronous/resources/evals.py +0 -68
- {lmnr-0.6.10 → lmnr-0.6.11}/LICENSE +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/README.md +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/cli.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/.flake8 +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/decorators/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/config.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/utils.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/langgraph/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/opentelemetry/instrumentation/langgraph/utils.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/_instrument_initializers.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/attributes.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/context_properties.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/exporter.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/instruments.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/processor.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/tracing/tracer.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/utils/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/utils/json_encoder.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/opentelemetry_lib/utils/package_check.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/py.typed +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/browser_use_otel.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/patchright_otel.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/playwright_otel.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/pw_utils.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/rrweb/rrweb.umd.min.cjs +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/browser/utils.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/asynchronous/resources/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/asynchronous/resources/agent.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/asynchronous/resources/base.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/asynchronous/resources/browser_events.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/asynchronous/resources/tags.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/resources/__init__.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/resources/agent.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/resources/base.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/resources/browser_events.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/client/synchronous/resources/tags.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/decorators.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/eval_control.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/laminar.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/log.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/types.py +0 -0
- {lmnr-0.6.10 → lmnr-0.6.11}/src/lmnr/sdk/utils.py +0 -0
@@ -89,11 +89,11 @@ class AsyncLaminarClient:
|
|
89
89
|
return self.__agent
|
90
90
|
|
91
91
|
@property
|
92
|
-
def
|
92
|
+
def evals(self) -> AsyncEvals:
|
93
93
|
"""Get the Evals resource.
|
94
94
|
|
95
95
|
Returns:
|
96
|
-
|
96
|
+
AsyncEvals: The Evals resource instance.
|
97
97
|
"""
|
98
98
|
return self.__evals
|
99
99
|
|
@@ -144,3 +144,5 @@ class AsyncLaminarClient:
|
|
144
144
|
"Content-Type": "application/json",
|
145
145
|
"Accept": "application/json",
|
146
146
|
}
|
147
|
+
|
148
|
+
|
@@ -0,0 +1,158 @@
|
|
1
|
+
"""Evals resource for interacting with Laminar evaluations API."""
|
2
|
+
|
3
|
+
from typing import Any
|
4
|
+
import uuid
|
5
|
+
|
6
|
+
from lmnr.sdk.client.asynchronous.resources.base import BaseAsyncResource
|
7
|
+
from lmnr.sdk.types import (
|
8
|
+
InitEvaluationResponse,
|
9
|
+
EvaluationResultDatapoint,
|
10
|
+
PartialEvaluationDatapoint,
|
11
|
+
)
|
12
|
+
|
13
|
+
|
14
|
+
class AsyncEvals(BaseAsyncResource):
|
15
|
+
"""Resource for interacting with Laminar evaluations API."""
|
16
|
+
|
17
|
+
async def init(
|
18
|
+
self, name: str | None = None, group_name: str | None = None
|
19
|
+
) -> InitEvaluationResponse:
|
20
|
+
"""Initialize a new evaluation.
|
21
|
+
|
22
|
+
Args:
|
23
|
+
name (str | None, optional): Name of the evaluation. Defaults to None.
|
24
|
+
group_name (str | None, optional): Group name for the evaluation. Defaults to None.
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
InitEvaluationResponse: The response from the initialization request.
|
28
|
+
"""
|
29
|
+
response = await self._client.post(
|
30
|
+
self._base_url + "/v1/evals",
|
31
|
+
json={
|
32
|
+
"name": name,
|
33
|
+
"groupName": group_name,
|
34
|
+
},
|
35
|
+
headers=self._headers(),
|
36
|
+
)
|
37
|
+
if response.status_code != 200:
|
38
|
+
if response.status_code == 401:
|
39
|
+
raise ValueError("Unauthorized. Please check your project API key.")
|
40
|
+
raise ValueError(f"Error initializing evaluation: {response.text}")
|
41
|
+
resp_json = response.json()
|
42
|
+
return InitEvaluationResponse.model_validate(resp_json)
|
43
|
+
|
44
|
+
async def create_evaluation(
|
45
|
+
self,
|
46
|
+
name: str | None = None,
|
47
|
+
group_name: str | None = None,
|
48
|
+
) -> uuid.UUID:
|
49
|
+
"""
|
50
|
+
Create a new evaluation and return its ID.
|
51
|
+
|
52
|
+
Parameters:
|
53
|
+
name (str | None, optional): Optional name of the evaluation.
|
54
|
+
group_name (str | None, optional): An identifier to group evaluations.
|
55
|
+
|
56
|
+
Returns:
|
57
|
+
uuid.UUID: The evaluation ID.
|
58
|
+
"""
|
59
|
+
evaluation = await self.init(name=name, group_name=group_name)
|
60
|
+
return evaluation.id
|
61
|
+
|
62
|
+
async def create_datapoint(
|
63
|
+
self,
|
64
|
+
eval_id: uuid.UUID,
|
65
|
+
data: Any,
|
66
|
+
target: Any = None,
|
67
|
+
metadata: dict[str, Any] | None = None,
|
68
|
+
index: int | None = None,
|
69
|
+
trace_id: uuid.UUID | None = None,
|
70
|
+
) -> uuid.UUID:
|
71
|
+
"""
|
72
|
+
Create a datapoint for an evaluation.
|
73
|
+
|
74
|
+
Parameters:
|
75
|
+
eval_id (uuid.UUID): The evaluation ID.
|
76
|
+
data: The input data for the executor.
|
77
|
+
target: The target/expected output for evaluators.
|
78
|
+
metadata (dict[str, Any] | None, optional): Optional metadata.
|
79
|
+
index (int | None, optional): Optional index of the datapoint.
|
80
|
+
trace_id (uuid.UUID | None, optional): Optional trace ID.
|
81
|
+
|
82
|
+
Returns:
|
83
|
+
uuid.UUID: The datapoint ID.
|
84
|
+
"""
|
85
|
+
|
86
|
+
datapoint_id = uuid.uuid4()
|
87
|
+
|
88
|
+
# Create a minimal datapoint first
|
89
|
+
partial_datapoint = PartialEvaluationDatapoint(
|
90
|
+
id=datapoint_id,
|
91
|
+
data=data,
|
92
|
+
target=target,
|
93
|
+
index=index or 0,
|
94
|
+
trace_id=trace_id or uuid.uuid4(),
|
95
|
+
executor_span_id=uuid.uuid4(), # Will be updated when executor runs
|
96
|
+
metadata=metadata,
|
97
|
+
)
|
98
|
+
|
99
|
+
await self.save_datapoints(eval_id, [partial_datapoint])
|
100
|
+
return datapoint_id
|
101
|
+
|
102
|
+
async def save_datapoints(
|
103
|
+
self,
|
104
|
+
eval_id: uuid.UUID,
|
105
|
+
datapoints: list[EvaluationResultDatapoint | PartialEvaluationDatapoint],
|
106
|
+
group_name: str | None = None,
|
107
|
+
):
|
108
|
+
"""Save evaluation datapoints.
|
109
|
+
|
110
|
+
Args:
|
111
|
+
eval_id (uuid.UUID): The evaluation ID.
|
112
|
+
datapoints (list[EvaluationResultDatapoint | PartialEvaluationDatapoint]): The datapoints to save.
|
113
|
+
group_name (str | None, optional): Group name for the datapoints. Defaults to None.
|
114
|
+
|
115
|
+
Raises:
|
116
|
+
ValueError: If there's an error saving the datapoints.
|
117
|
+
"""
|
118
|
+
response = await self._client.post(
|
119
|
+
self._base_url + f"/v1/evals/{eval_id}/datapoints",
|
120
|
+
json={
|
121
|
+
"points": [datapoint.to_dict() for datapoint in datapoints],
|
122
|
+
"groupName": group_name,
|
123
|
+
},
|
124
|
+
headers=self._headers(),
|
125
|
+
)
|
126
|
+
if response.status_code != 200:
|
127
|
+
raise ValueError(f"Error saving evaluation datapoints: {response.text}")
|
128
|
+
|
129
|
+
|
130
|
+
async def update_datapoint(
|
131
|
+
self,
|
132
|
+
eval_id: uuid.UUID,
|
133
|
+
datapoint_id: uuid.UUID,
|
134
|
+
scores: dict[str, float | int],
|
135
|
+
executor_output: Any | None = None,
|
136
|
+
) -> None:
|
137
|
+
"""Update a datapoint with evaluation results.
|
138
|
+
|
139
|
+
Args:
|
140
|
+
eval_id (uuid.UUID): The evaluation ID.
|
141
|
+
datapoint_id (uuid.UUID): The datapoint ID.
|
142
|
+
executor_output (Any): The executor output.
|
143
|
+
scores (dict[str, float | int] | None, optional): The scores. Defaults to None.
|
144
|
+
"""
|
145
|
+
|
146
|
+
response = await self._client.post(
|
147
|
+
self._base_url + f"/v1/evals/{eval_id}/datapoints/{datapoint_id}",
|
148
|
+
json={
|
149
|
+
"executorOutput": executor_output,
|
150
|
+
"scores": scores,
|
151
|
+
},
|
152
|
+
headers=self._headers(),
|
153
|
+
)
|
154
|
+
|
155
|
+
if response.status_code != 200:
|
156
|
+
raise ValueError(f"Error updating evaluation datapoint: {response.text}")
|
157
|
+
|
158
|
+
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
import uuid
|
4
4
|
import urllib.parse
|
5
|
+
from typing import Any
|
5
6
|
|
6
7
|
from lmnr.sdk.client.synchronous.resources.base import BaseResource
|
7
8
|
from lmnr.sdk.types import (
|
@@ -42,6 +43,64 @@ class Evals(BaseResource):
|
|
42
43
|
resp_json = response.json()
|
43
44
|
return InitEvaluationResponse.model_validate(resp_json)
|
44
45
|
|
46
|
+
def create_evaluation(
|
47
|
+
self,
|
48
|
+
name: str | None = None,
|
49
|
+
group_name: str | None = None,
|
50
|
+
) -> uuid.UUID:
|
51
|
+
"""
|
52
|
+
Create a new evaluation and return its ID.
|
53
|
+
|
54
|
+
Parameters:
|
55
|
+
name (str | None, optional): Optional name of the evaluation.
|
56
|
+
group_name (str | None, optional): An identifier to group evaluations.
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
uuid.UUID: The evaluation ID.
|
60
|
+
"""
|
61
|
+
evaluation = self.init(name=name, group_name=group_name)
|
62
|
+
return evaluation.id
|
63
|
+
|
64
|
+
def create_datapoint(
|
65
|
+
self,
|
66
|
+
eval_id: uuid.UUID,
|
67
|
+
data: Any,
|
68
|
+
target: Any = None,
|
69
|
+
metadata: dict[str, Any] | None = None,
|
70
|
+
index: int | None = None,
|
71
|
+
trace_id: uuid.UUID | None = None,
|
72
|
+
) -> uuid.UUID:
|
73
|
+
"""
|
74
|
+
Create a datapoint for an evaluation.
|
75
|
+
|
76
|
+
Parameters:
|
77
|
+
eval_id (uuid.UUID): The evaluation ID.
|
78
|
+
data: The input data for the executor.
|
79
|
+
target: The target/expected output for evaluators.
|
80
|
+
metadata (dict[str, Any] | None, optional): Optional metadata.
|
81
|
+
index (int | None, optional): Optional index of the datapoint.
|
82
|
+
trace_id (uuid.UUID | None, optional): Optional trace ID.
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
uuid.UUID: The datapoint ID.
|
86
|
+
"""
|
87
|
+
|
88
|
+
datapoint_id = uuid.uuid4()
|
89
|
+
|
90
|
+
# Create a minimal datapoint first
|
91
|
+
partial_datapoint = PartialEvaluationDatapoint(
|
92
|
+
id=datapoint_id,
|
93
|
+
data=data,
|
94
|
+
target=target,
|
95
|
+
index=index or 0,
|
96
|
+
trace_id=trace_id or uuid.uuid4(),
|
97
|
+
executor_span_id=uuid.uuid4(), # Will be updated when executor runs
|
98
|
+
metadata=metadata,
|
99
|
+
)
|
100
|
+
|
101
|
+
self.save_datapoints(eval_id, [partial_datapoint])
|
102
|
+
return datapoint_id
|
103
|
+
|
45
104
|
def save_datapoints(
|
46
105
|
self,
|
47
106
|
eval_id: uuid.UUID,
|
@@ -69,6 +128,34 @@ class Evals(BaseResource):
|
|
69
128
|
if response.status_code != 200:
|
70
129
|
raise ValueError(f"Error saving evaluation datapoints: {response.text}")
|
71
130
|
|
131
|
+
def update_datapoint(
|
132
|
+
self,
|
133
|
+
eval_id: uuid.UUID,
|
134
|
+
datapoint_id: uuid.UUID,
|
135
|
+
scores: dict[str, float | int],
|
136
|
+
executor_output: Any | None = None,
|
137
|
+
) -> None:
|
138
|
+
"""Update a datapoint with evaluation results.
|
139
|
+
|
140
|
+
Args:
|
141
|
+
eval_id (uuid.UUID): The evaluation ID.
|
142
|
+
datapoint_id (uuid.UUID): The datapoint ID.
|
143
|
+
executor_output (Any): The executor output.
|
144
|
+
scores (dict[str, float | int] | None, optional): The scores. Defaults to None.
|
145
|
+
"""
|
146
|
+
|
147
|
+
response = self._client.post(
|
148
|
+
self._base_url + f"/v1/evals/{eval_id}/datapoints/{datapoint_id}",
|
149
|
+
json={
|
150
|
+
"executorOutput": executor_output,
|
151
|
+
"scores": scores,
|
152
|
+
},
|
153
|
+
headers=self._headers(),
|
154
|
+
)
|
155
|
+
|
156
|
+
if response.status_code != 200:
|
157
|
+
raise ValueError(f"Error updating evaluation datapoint: {response.text}")
|
158
|
+
|
72
159
|
def get_datapoints(
|
73
160
|
self,
|
74
161
|
dataset_name: str,
|
@@ -89,7 +89,7 @@ class LaminarClient:
|
|
89
89
|
return self.__agent
|
90
90
|
|
91
91
|
@property
|
92
|
-
def
|
92
|
+
def evals(self) -> Evals:
|
93
93
|
"""Get the Evals resource.
|
94
94
|
|
95
95
|
Returns:
|
@@ -155,3 +155,5 @@ class LaminarClient:
|
|
155
155
|
"Content-Type": "application/json",
|
156
156
|
"Accept": "application/json",
|
157
157
|
}
|
158
|
+
|
159
|
+
|
@@ -38,7 +38,7 @@ class LaminarDataset(EvaluationDataset):
|
|
38
38
|
f"dataset {self.name}. Fetching batch from {self._offset} to "
|
39
39
|
+ f"{self._offset + self._fetch_size}"
|
40
40
|
)
|
41
|
-
resp = self.client.
|
41
|
+
resp = self.client.evals.get_datapoints(
|
42
42
|
self.name, self._offset, self._fetch_size
|
43
43
|
)
|
44
44
|
self._fetched_items += resp.items
|
@@ -241,7 +241,7 @@ class Evaluation:
|
|
241
241
|
)
|
242
242
|
self.reporter.start(len(self.data))
|
243
243
|
try:
|
244
|
-
evaluation = await self.client.
|
244
|
+
evaluation = await self.client.evals.init(
|
245
245
|
name=self.name, group_name=self.group_name
|
246
246
|
)
|
247
247
|
result_datapoints = await self._evaluate_in_batches(evaluation.id)
|
@@ -326,7 +326,7 @@ class Evaluation:
|
|
326
326
|
metadata=datapoint.metadata,
|
327
327
|
)
|
328
328
|
# First, create datapoint with trace_id so that we can show the dp in the UI
|
329
|
-
await self.client.
|
329
|
+
await self.client.evals.save_datapoints(
|
330
330
|
eval_id, [partial_datapoint], self.group_name
|
331
331
|
)
|
332
332
|
executor_span.set_attribute(SPAN_TYPE, SpanType.EXECUTOR.value)
|
@@ -384,7 +384,7 @@ class Evaluation:
|
|
384
384
|
|
385
385
|
# Create background upload task without awaiting it
|
386
386
|
upload_task = asyncio.create_task(
|
387
|
-
self.client.
|
387
|
+
self.client.evals.save_datapoints(eval_id, [datapoint], self.group_name)
|
388
388
|
)
|
389
389
|
self.upload_tasks.append(upload_task)
|
390
390
|
|
@@ -1,68 +0,0 @@
|
|
1
|
-
"""Evals resource for interacting with Laminar evaluations API."""
|
2
|
-
|
3
|
-
import uuid
|
4
|
-
|
5
|
-
from lmnr.sdk.client.asynchronous.resources.base import BaseAsyncResource
|
6
|
-
from lmnr.sdk.types import (
|
7
|
-
InitEvaluationResponse,
|
8
|
-
EvaluationResultDatapoint,
|
9
|
-
PartialEvaluationDatapoint,
|
10
|
-
)
|
11
|
-
|
12
|
-
|
13
|
-
class AsyncEvals(BaseAsyncResource):
|
14
|
-
"""Resource for interacting with Laminar evaluations API."""
|
15
|
-
|
16
|
-
async def init(
|
17
|
-
self, name: str | None = None, group_name: str | None = None
|
18
|
-
) -> InitEvaluationResponse:
|
19
|
-
"""Initialize a new evaluation.
|
20
|
-
|
21
|
-
Args:
|
22
|
-
name (str | None, optional): Name of the evaluation. Defaults to None.
|
23
|
-
group_name (str | None, optional): Group name for the evaluation. Defaults to None.
|
24
|
-
|
25
|
-
Returns:
|
26
|
-
InitEvaluationResponse: The response from the initialization request.
|
27
|
-
"""
|
28
|
-
response = await self._client.post(
|
29
|
-
self._base_url + "/v1/evals",
|
30
|
-
json={
|
31
|
-
"name": name,
|
32
|
-
"groupName": group_name,
|
33
|
-
},
|
34
|
-
headers=self._headers(),
|
35
|
-
)
|
36
|
-
if response.status_code != 200:
|
37
|
-
if response.status_code == 401:
|
38
|
-
raise ValueError("Unauthorized. Please check your project API key.")
|
39
|
-
raise ValueError(f"Error initializing evaluation: {response.text}")
|
40
|
-
resp_json = response.json()
|
41
|
-
return InitEvaluationResponse.model_validate(resp_json)
|
42
|
-
|
43
|
-
async def save_datapoints(
|
44
|
-
self,
|
45
|
-
eval_id: uuid.UUID,
|
46
|
-
datapoints: list[EvaluationResultDatapoint | PartialEvaluationDatapoint],
|
47
|
-
group_name: str | None = None,
|
48
|
-
):
|
49
|
-
"""Save evaluation datapoints.
|
50
|
-
|
51
|
-
Args:
|
52
|
-
eval_id (uuid.UUID): The evaluation ID.
|
53
|
-
datapoints (list[EvaluationResultDatapoint | PartialEvaluationDatapoint]): The datapoints to save.
|
54
|
-
group_name (str | None, optional): Group name for the datapoints. Defaults to None.
|
55
|
-
|
56
|
-
Raises:
|
57
|
-
ValueError: If there's an error saving the datapoints.
|
58
|
-
"""
|
59
|
-
response = await self._client.post(
|
60
|
-
self._base_url + f"/v1/evals/{eval_id}/datapoints",
|
61
|
-
json={
|
62
|
-
"points": [datapoint.to_dict() for datapoint in datapoints],
|
63
|
-
"groupName": group_name,
|
64
|
-
},
|
65
|
-
headers=self._headers(),
|
66
|
-
)
|
67
|
-
if response.status_code != 200:
|
68
|
-
raise ValueError(f"Error saving evaluation datapoints: {response.text}")
|
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
|
File without changes
|
File without changes
|