deeprails 1.11.0__py3-none-any.whl → 1.12.0__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.
Potentially problematic release.
This version of deeprails might be problematic. Click here for more details.
- deeprails/_version.py +1 -1
- deeprails/resources/monitor.py +51 -41
- deeprails/types/monitor_create_params.py +32 -1
- deeprails/types/monitor_submit_event_params.py +0 -23
- {deeprails-1.11.0.dist-info → deeprails-1.12.0.dist-info}/METADATA +1 -1
- {deeprails-1.11.0.dist-info → deeprails-1.12.0.dist-info}/RECORD +8 -8
- {deeprails-1.11.0.dist-info → deeprails-1.12.0.dist-info}/WHEEL +0 -0
- {deeprails-1.11.0.dist-info → deeprails-1.12.0.dist-info}/licenses/LICENSE +0 -0
deeprails/_version.py
CHANGED
deeprails/resources/monitor.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing_extensions import Literal
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..types import monitor_create_params, monitor_update_params, monitor_retrieve_params, monitor_submit_event_params
|
|
11
|
-
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
12
12
|
from .._utils import maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -49,8 +49,20 @@ class MonitorResource(SyncAPIResource):
|
|
|
49
49
|
def create(
|
|
50
50
|
self,
|
|
51
51
|
*,
|
|
52
|
+
guardrail_metrics: List[
|
|
53
|
+
Literal[
|
|
54
|
+
"correctness",
|
|
55
|
+
"completeness",
|
|
56
|
+
"instruction_adherence",
|
|
57
|
+
"context_adherence",
|
|
58
|
+
"ground_truth_adherence",
|
|
59
|
+
"comprehensive_safety",
|
|
60
|
+
]
|
|
61
|
+
],
|
|
52
62
|
name: str,
|
|
53
63
|
description: str | Omit = omit,
|
|
64
|
+
file_search: SequenceNotStr[str] | Omit = omit,
|
|
65
|
+
web_search: bool | Omit = omit,
|
|
54
66
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
55
67
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
56
68
|
extra_headers: Headers | None = None,
|
|
@@ -63,10 +75,20 @@ class MonitorResource(SyncAPIResource):
|
|
|
63
75
|
using guardrails
|
|
64
76
|
|
|
65
77
|
Args:
|
|
78
|
+
guardrail_metrics: An array of guardrail metrics that the model input and output pair will be
|
|
79
|
+
evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
80
|
+
`completeness`, `instruction_adherence`, `context_adherence`,
|
|
81
|
+
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
82
|
+
|
|
66
83
|
name: Name of the new monitor.
|
|
67
84
|
|
|
68
85
|
description: Description of the new monitor.
|
|
69
86
|
|
|
87
|
+
file_search: An array of file IDs to search in the monitor's evaluations. Files must be
|
|
88
|
+
uploaded via the DeepRails API first.
|
|
89
|
+
|
|
90
|
+
web_search: Whether to enable web search for this monitor's evaluations. Defaults to false.
|
|
91
|
+
|
|
70
92
|
extra_headers: Send extra headers
|
|
71
93
|
|
|
72
94
|
extra_query: Add additional query parameters to the request
|
|
@@ -79,8 +101,11 @@ class MonitorResource(SyncAPIResource):
|
|
|
79
101
|
"/monitor",
|
|
80
102
|
body=maybe_transform(
|
|
81
103
|
{
|
|
104
|
+
"guardrail_metrics": guardrail_metrics,
|
|
82
105
|
"name": name,
|
|
83
106
|
"description": description,
|
|
107
|
+
"file_search": file_search,
|
|
108
|
+
"web_search": web_search,
|
|
84
109
|
},
|
|
85
110
|
monitor_create_params.MonitorCreateParams,
|
|
86
111
|
),
|
|
@@ -187,19 +212,8 @@ class MonitorResource(SyncAPIResource):
|
|
|
187
212
|
self,
|
|
188
213
|
monitor_id: str,
|
|
189
214
|
*,
|
|
190
|
-
guardrail_metrics: List[
|
|
191
|
-
Literal[
|
|
192
|
-
"correctness",
|
|
193
|
-
"completeness",
|
|
194
|
-
"instruction_adherence",
|
|
195
|
-
"context_adherence",
|
|
196
|
-
"ground_truth_adherence",
|
|
197
|
-
"comprehensive_safety",
|
|
198
|
-
]
|
|
199
|
-
],
|
|
200
215
|
model_input: monitor_submit_event_params.ModelInput,
|
|
201
216
|
model_output: str,
|
|
202
|
-
model_used: str | Omit = omit,
|
|
203
217
|
nametag: str | Omit = omit,
|
|
204
218
|
run_mode: Literal["precision_plus", "precision", "smart", "economy"] | Omit = omit,
|
|
205
219
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -214,19 +228,12 @@ class MonitorResource(SyncAPIResource):
|
|
|
214
228
|
evaluation
|
|
215
229
|
|
|
216
230
|
Args:
|
|
217
|
-
guardrail_metrics: An array of guardrail metrics that the model input and output pair will be
|
|
218
|
-
evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
219
|
-
`completeness`, `instruction_adherence`, `context_adherence`,
|
|
220
|
-
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
221
|
-
|
|
222
231
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
223
232
|
contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
224
233
|
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
225
234
|
|
|
226
235
|
model_output: Output generated by the LLM to be evaluated.
|
|
227
236
|
|
|
228
|
-
model_used: Model ID used to generate the output, like `gpt-4o` or `o3`.
|
|
229
|
-
|
|
230
237
|
nametag: An optional, user-defined tag for the event.
|
|
231
238
|
|
|
232
239
|
run_mode: Run mode for the monitor event. The run mode allows the user to optimize for
|
|
@@ -248,10 +255,8 @@ class MonitorResource(SyncAPIResource):
|
|
|
248
255
|
f"/monitor/{monitor_id}/events",
|
|
249
256
|
body=maybe_transform(
|
|
250
257
|
{
|
|
251
|
-
"guardrail_metrics": guardrail_metrics,
|
|
252
258
|
"model_input": model_input,
|
|
253
259
|
"model_output": model_output,
|
|
254
|
-
"model_used": model_used,
|
|
255
260
|
"nametag": nametag,
|
|
256
261
|
"run_mode": run_mode,
|
|
257
262
|
},
|
|
@@ -287,8 +292,20 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
287
292
|
async def create(
|
|
288
293
|
self,
|
|
289
294
|
*,
|
|
295
|
+
guardrail_metrics: List[
|
|
296
|
+
Literal[
|
|
297
|
+
"correctness",
|
|
298
|
+
"completeness",
|
|
299
|
+
"instruction_adherence",
|
|
300
|
+
"context_adherence",
|
|
301
|
+
"ground_truth_adherence",
|
|
302
|
+
"comprehensive_safety",
|
|
303
|
+
]
|
|
304
|
+
],
|
|
290
305
|
name: str,
|
|
291
306
|
description: str | Omit = omit,
|
|
307
|
+
file_search: SequenceNotStr[str] | Omit = omit,
|
|
308
|
+
web_search: bool | Omit = omit,
|
|
292
309
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
293
310
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
294
311
|
extra_headers: Headers | None = None,
|
|
@@ -301,10 +318,20 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
301
318
|
using guardrails
|
|
302
319
|
|
|
303
320
|
Args:
|
|
321
|
+
guardrail_metrics: An array of guardrail metrics that the model input and output pair will be
|
|
322
|
+
evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
323
|
+
`completeness`, `instruction_adherence`, `context_adherence`,
|
|
324
|
+
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
325
|
+
|
|
304
326
|
name: Name of the new monitor.
|
|
305
327
|
|
|
306
328
|
description: Description of the new monitor.
|
|
307
329
|
|
|
330
|
+
file_search: An array of file IDs to search in the monitor's evaluations. Files must be
|
|
331
|
+
uploaded via the DeepRails API first.
|
|
332
|
+
|
|
333
|
+
web_search: Whether to enable web search for this monitor's evaluations. Defaults to false.
|
|
334
|
+
|
|
308
335
|
extra_headers: Send extra headers
|
|
309
336
|
|
|
310
337
|
extra_query: Add additional query parameters to the request
|
|
@@ -317,8 +344,11 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
317
344
|
"/monitor",
|
|
318
345
|
body=await async_maybe_transform(
|
|
319
346
|
{
|
|
347
|
+
"guardrail_metrics": guardrail_metrics,
|
|
320
348
|
"name": name,
|
|
321
349
|
"description": description,
|
|
350
|
+
"file_search": file_search,
|
|
351
|
+
"web_search": web_search,
|
|
322
352
|
},
|
|
323
353
|
monitor_create_params.MonitorCreateParams,
|
|
324
354
|
),
|
|
@@ -425,19 +455,8 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
425
455
|
self,
|
|
426
456
|
monitor_id: str,
|
|
427
457
|
*,
|
|
428
|
-
guardrail_metrics: List[
|
|
429
|
-
Literal[
|
|
430
|
-
"correctness",
|
|
431
|
-
"completeness",
|
|
432
|
-
"instruction_adherence",
|
|
433
|
-
"context_adherence",
|
|
434
|
-
"ground_truth_adherence",
|
|
435
|
-
"comprehensive_safety",
|
|
436
|
-
]
|
|
437
|
-
],
|
|
438
458
|
model_input: monitor_submit_event_params.ModelInput,
|
|
439
459
|
model_output: str,
|
|
440
|
-
model_used: str | Omit = omit,
|
|
441
460
|
nametag: str | Omit = omit,
|
|
442
461
|
run_mode: Literal["precision_plus", "precision", "smart", "economy"] | Omit = omit,
|
|
443
462
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -452,19 +471,12 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
452
471
|
evaluation
|
|
453
472
|
|
|
454
473
|
Args:
|
|
455
|
-
guardrail_metrics: An array of guardrail metrics that the model input and output pair will be
|
|
456
|
-
evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
457
|
-
`completeness`, `instruction_adherence`, `context_adherence`,
|
|
458
|
-
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
459
|
-
|
|
460
474
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
461
475
|
contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
462
476
|
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
463
477
|
|
|
464
478
|
model_output: Output generated by the LLM to be evaluated.
|
|
465
479
|
|
|
466
|
-
model_used: Model ID used to generate the output, like `gpt-4o` or `o3`.
|
|
467
|
-
|
|
468
480
|
nametag: An optional, user-defined tag for the event.
|
|
469
481
|
|
|
470
482
|
run_mode: Run mode for the monitor event. The run mode allows the user to optimize for
|
|
@@ -486,10 +498,8 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
486
498
|
f"/monitor/{monitor_id}/events",
|
|
487
499
|
body=await async_maybe_transform(
|
|
488
500
|
{
|
|
489
|
-
"guardrail_metrics": guardrail_metrics,
|
|
490
501
|
"model_input": model_input,
|
|
491
502
|
"model_output": model_output,
|
|
492
|
-
"model_used": model_used,
|
|
493
503
|
"nametag": nametag,
|
|
494
504
|
"run_mode": run_mode,
|
|
495
505
|
},
|
|
@@ -2,14 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from typing import List
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .._types import SequenceNotStr
|
|
6
9
|
|
|
7
10
|
__all__ = ["MonitorCreateParams"]
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class MonitorCreateParams(TypedDict, total=False):
|
|
14
|
+
guardrail_metrics: Required[
|
|
15
|
+
List[
|
|
16
|
+
Literal[
|
|
17
|
+
"correctness",
|
|
18
|
+
"completeness",
|
|
19
|
+
"instruction_adherence",
|
|
20
|
+
"context_adherence",
|
|
21
|
+
"ground_truth_adherence",
|
|
22
|
+
"comprehensive_safety",
|
|
23
|
+
]
|
|
24
|
+
]
|
|
25
|
+
]
|
|
26
|
+
"""
|
|
27
|
+
An array of guardrail metrics that the model input and output pair will be
|
|
28
|
+
evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
29
|
+
`completeness`, `instruction_adherence`, `context_adherence`,
|
|
30
|
+
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
31
|
+
"""
|
|
32
|
+
|
|
11
33
|
name: Required[str]
|
|
12
34
|
"""Name of the new monitor."""
|
|
13
35
|
|
|
14
36
|
description: str
|
|
15
37
|
"""Description of the new monitor."""
|
|
38
|
+
|
|
39
|
+
file_search: SequenceNotStr[str]
|
|
40
|
+
"""An array of file IDs to search in the monitor's evaluations.
|
|
41
|
+
|
|
42
|
+
Files must be uploaded via the DeepRails API first.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
web_search: bool
|
|
46
|
+
"""Whether to enable web search for this monitor's evaluations. Defaults to false."""
|
|
@@ -2,32 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List
|
|
6
5
|
from typing_extensions import Literal, Required, TypedDict
|
|
7
6
|
|
|
8
7
|
__all__ = ["MonitorSubmitEventParams", "ModelInput"]
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class MonitorSubmitEventParams(TypedDict, total=False):
|
|
12
|
-
guardrail_metrics: Required[
|
|
13
|
-
List[
|
|
14
|
-
Literal[
|
|
15
|
-
"correctness",
|
|
16
|
-
"completeness",
|
|
17
|
-
"instruction_adherence",
|
|
18
|
-
"context_adherence",
|
|
19
|
-
"ground_truth_adherence",
|
|
20
|
-
"comprehensive_safety",
|
|
21
|
-
]
|
|
22
|
-
]
|
|
23
|
-
]
|
|
24
|
-
"""
|
|
25
|
-
An array of guardrail metrics that the model input and output pair will be
|
|
26
|
-
evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
27
|
-
`completeness`, `instruction_adherence`, `context_adherence`,
|
|
28
|
-
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
11
|
model_input: Required[ModelInput]
|
|
32
12
|
"""A dictionary of inputs sent to the LLM to generate output.
|
|
33
13
|
|
|
@@ -39,9 +19,6 @@ class MonitorSubmitEventParams(TypedDict, total=False):
|
|
|
39
19
|
model_output: Required[str]
|
|
40
20
|
"""Output generated by the LLM to be evaluated."""
|
|
41
21
|
|
|
42
|
-
model_used: str
|
|
43
|
-
"""Model ID used to generate the output, like `gpt-4o` or `o3`."""
|
|
44
|
-
|
|
45
22
|
nametag: str
|
|
46
23
|
"""An optional, user-defined tag for the event."""
|
|
47
24
|
|
|
@@ -11,7 +11,7 @@ deeprails/_resource.py,sha256=7RXX5KZr4j0TIE66vnduHp7p9Yf9X0FyDDECuvRHARg,1118
|
|
|
11
11
|
deeprails/_response.py,sha256=yj0HJDU91WPpiczwi6CBOLAl_bqf4I_I96vWMAwx6Fg,28806
|
|
12
12
|
deeprails/_streaming.py,sha256=Q6e6KLMPe7Pe4AWnbiC5pDrbRRIaNUh0svOWpWXLheY,10161
|
|
13
13
|
deeprails/_types.py,sha256=XR3mad9NsGqZsjrd1VVJ657-4O4kwyw9Qzg4M3i6Vh0,7239
|
|
14
|
-
deeprails/_version.py,sha256=
|
|
14
|
+
deeprails/_version.py,sha256=Lu9BU95-FlOx4Vp5TnTzo6mRfvfmbANoTKPP3Y24uck,162
|
|
15
15
|
deeprails/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
deeprails/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
17
17
|
deeprails/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
@@ -29,7 +29,7 @@ deeprails/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
|
29
29
|
deeprails/resources/__init__.py,sha256=VyIb1MX_ovlwJo6XAW_ZN9Ib0Ea-Oapbs5Hfwx0o_IY,1452
|
|
30
30
|
deeprails/resources/defend.py,sha256=Ztcn4OEw8GIhlXx1QHIzIdnNP2obeIhmeEmvNyVza2g,29094
|
|
31
31
|
deeprails/resources/files.py,sha256=zHtuxEm-t9MMdbH7gQcDQat3qXPh1ABWDmqxrUY2a8k,6903
|
|
32
|
-
deeprails/resources/monitor.py,sha256=
|
|
32
|
+
deeprails/resources/monitor.py,sha256=4X6c4yPJ4ZZZXd2ViTdHpa5cCXrbd6Mg34Riz2SYerM,23090
|
|
33
33
|
deeprails/types/__init__.py,sha256=h4_LUTZM98zsmfk3ziFmihgjQO_DI41gbgx2xVOGy78,1249
|
|
34
34
|
deeprails/types/defend_create_workflow_params.py,sha256=gVK6ORTsvo3ur4Inyq6dU0rN7F9RyNnm4SFfQyyO5ZU,2434
|
|
35
35
|
deeprails/types/defend_response.py,sha256=VoePIT9RKN795y-3ZvoFmzSTCetqkZZh6iQLYjJEFoY,1603
|
|
@@ -37,15 +37,15 @@ deeprails/types/defend_submit_event_params.py,sha256=yL_rLUGKlZjXHGbdi8h9ZItb4sI
|
|
|
37
37
|
deeprails/types/defend_update_workflow_params.py,sha256=QH2k7EDMLub3mW1lPV5SUoKDHW_T2arSo-RGHLterwo,373
|
|
38
38
|
deeprails/types/file_response.py,sha256=8RAkrlfgt9d27ryd4qMf6gHi_gTsD3LhDen2MtxYZ-I,656
|
|
39
39
|
deeprails/types/file_upload_params.py,sha256=64xHtKiy39dFANWYBWeqK5eeOJV-zxJejwNjXY7kW8E,363
|
|
40
|
-
deeprails/types/monitor_create_params.py,sha256=
|
|
40
|
+
deeprails/types/monitor_create_params.py,sha256=uU_wqGLAo9B4r-nFZw_UG5YbUF0hxIJf0_P5HqpOIw8,1365
|
|
41
41
|
deeprails/types/monitor_detail_response.py,sha256=s8dzFFaU9uI-GHCfUxCN9yLhpmq4LTu7CSww9z0SLvk,5028
|
|
42
42
|
deeprails/types/monitor_event_response.py,sha256=-cnugHD_3QeeZRMbo6aQBirqSPgKIKpaD2qNkgxCeCA,565
|
|
43
43
|
deeprails/types/monitor_response.py,sha256=LjnJVYniee1hgvZu8RT-9jX4xd0Ob_yvq4NBOxVn59c,950
|
|
44
44
|
deeprails/types/monitor_retrieve_params.py,sha256=PEsRmbd-81z4pJvhfi4JbrQWNzmeiLkoNsTUoPZ6kFY,352
|
|
45
|
-
deeprails/types/monitor_submit_event_params.py,sha256=
|
|
45
|
+
deeprails/types/monitor_submit_event_params.py,sha256=D6ecLaN7y4Y3q7PI2qplXpItXN5dmrasjrdTumjLnHc,1420
|
|
46
46
|
deeprails/types/monitor_update_params.py,sha256=gJyFFxT_u_iWABknuKnLpPl9r-VPfCcGtOAmh6sPwUw,550
|
|
47
47
|
deeprails/types/workflow_event_response.py,sha256=mIzOCnYJg4TDSq_tG_0WfA0_Gmc9-0q-befyookfUFM,867
|
|
48
|
-
deeprails-1.
|
|
49
|
-
deeprails-1.
|
|
50
|
-
deeprails-1.
|
|
51
|
-
deeprails-1.
|
|
48
|
+
deeprails-1.12.0.dist-info/METADATA,sha256=iR51Ti99Htf03ehr-ygjOzattoN9tc2dKw78QSbiV1A,12660
|
|
49
|
+
deeprails-1.12.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
50
|
+
deeprails-1.12.0.dist-info/licenses/LICENSE,sha256=rFTxPcYE516UQLju2SCY1r2pSDDfodL0-ZvxF_fgueg,11339
|
|
51
|
+
deeprails-1.12.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|