deeprails 1.6.1__py3-none-any.whl → 1.8.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/defend.py +45 -45
- deeprails/resources/evaluate.py +4 -4
- deeprails/resources/monitor.py +4 -4
- deeprails/types/defend_create_workflow_params.py +19 -19
- deeprails/types/defend_response.py +8 -8
- deeprails/types/defend_submit_event_params.py +2 -2
- deeprails/types/evaluate_create_params.py +2 -2
- deeprails/types/evaluation.py +2 -2
- deeprails/types/monitor_submit_event_params.py +2 -2
- {deeprails-1.6.1.dist-info → deeprails-1.8.0.dist-info}/METADATA +25 -25
- {deeprails-1.6.1.dist-info → deeprails-1.8.0.dist-info}/RECORD +14 -14
- {deeprails-1.6.1.dist-info → deeprails-1.8.0.dist-info}/WHEEL +0 -0
- {deeprails-1.6.1.dist-info → deeprails-1.8.0.dist-info}/licenses/LICENSE +0 -0
deeprails/_version.py
CHANGED
deeprails/resources/defend.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict
|
|
5
|
+
from typing import Dict
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -48,13 +48,13 @@ class DefendResource(SyncAPIResource):
|
|
|
48
48
|
def create_workflow(
|
|
49
49
|
self,
|
|
50
50
|
*,
|
|
51
|
-
improvement_action:
|
|
52
|
-
metrics: Dict[str, float],
|
|
51
|
+
improvement_action: Literal["regen", "fixit", "do_nothing"],
|
|
53
52
|
name: str,
|
|
54
53
|
type: Literal["automatic", "custom"],
|
|
55
|
-
|
|
54
|
+
automatic_hallucination_tolerance_levels: Dict[str, Literal["low", "medium", "high"]] | Omit = omit,
|
|
55
|
+
custom_hallucination_threshold_values: Dict[str, float] | Omit = omit,
|
|
56
56
|
description: str | Omit = omit,
|
|
57
|
-
|
|
57
|
+
max_improvement_attempt: int | Omit = omit,
|
|
58
58
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
59
59
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
60
60
|
extra_headers: Headers | None = None,
|
|
@@ -68,16 +68,10 @@ class DefendResource(SyncAPIResource):
|
|
|
68
68
|
|
|
69
69
|
Args:
|
|
70
70
|
improvement_action: The action used to improve outputs that fail one or guardrail metrics for the
|
|
71
|
-
workflow events. May be `
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
metrics: Mapping of guardrail metrics to floating point threshold values. If the workflow
|
|
77
|
-
type is automatic, only the metric names are used (`automatic_tolerance`
|
|
78
|
-
determines thresholds). Possible metrics are `correctness`, `completeness`,
|
|
79
|
-
`instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
80
|
-
`comprehensive_safety`.
|
|
71
|
+
workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the user's
|
|
72
|
+
input prompt with minor induced variance. FixIt attempts to directly address the
|
|
73
|
+
shortcomings of the output using the guardrail failure rationale. Do Nothing
|
|
74
|
+
does not attempt any improvement.
|
|
81
75
|
|
|
82
76
|
name: Name of the workflow.
|
|
83
77
|
|
|
@@ -87,12 +81,18 @@ class DefendResource(SyncAPIResource):
|
|
|
87
81
|
set the threshold for each metric as a floating point number between 0.0 and
|
|
88
82
|
1.0.
|
|
89
83
|
|
|
90
|
-
|
|
91
|
-
`
|
|
84
|
+
automatic_hallucination_tolerance_levels: Mapping of guardrail metrics to hallucination tolerance levels (either `low`,
|
|
85
|
+
`medium`, or `high`). Possible metrics are `completeness`,
|
|
86
|
+
`instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
87
|
+
`comprehensive_safety`.
|
|
88
|
+
|
|
89
|
+
custom_hallucination_threshold_values: Mapping of guardrail metrics to floating point threshold values. Possible
|
|
90
|
+
metrics are `correctness`, `completeness`, `instruction_adherence`,
|
|
91
|
+
`context_adherence`, `ground_truth_adherence`, or `comprehensive_safety`.
|
|
92
92
|
|
|
93
93
|
description: Description for the workflow.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
max_improvement_attempt: Max. number of improvement action retries until a given event passes the
|
|
96
96
|
guardrails. Defaults to 10.
|
|
97
97
|
|
|
98
98
|
extra_headers: Send extra headers
|
|
@@ -108,12 +108,12 @@ class DefendResource(SyncAPIResource):
|
|
|
108
108
|
body=maybe_transform(
|
|
109
109
|
{
|
|
110
110
|
"improvement_action": improvement_action,
|
|
111
|
-
"metrics": metrics,
|
|
112
111
|
"name": name,
|
|
113
112
|
"type": type,
|
|
114
|
-
"
|
|
113
|
+
"automatic_hallucination_tolerance_levels": automatic_hallucination_tolerance_levels,
|
|
114
|
+
"custom_hallucination_threshold_values": custom_hallucination_threshold_values,
|
|
115
115
|
"description": description,
|
|
116
|
-
"
|
|
116
|
+
"max_improvement_attempt": max_improvement_attempt,
|
|
117
117
|
},
|
|
118
118
|
defend_create_workflow_params.DefendCreateWorkflowParams,
|
|
119
119
|
),
|
|
@@ -214,8 +214,8 @@ class DefendResource(SyncAPIResource):
|
|
|
214
214
|
|
|
215
215
|
Args:
|
|
216
216
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
217
|
-
contain at least
|
|
218
|
-
|
|
217
|
+
contain at least `user_prompt` or `system_prompt` field. For the
|
|
218
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
219
219
|
|
|
220
220
|
model_output: Output generated by the LLM to be evaluated.
|
|
221
221
|
|
|
@@ -326,13 +326,13 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
326
326
|
async def create_workflow(
|
|
327
327
|
self,
|
|
328
328
|
*,
|
|
329
|
-
improvement_action:
|
|
330
|
-
metrics: Dict[str, float],
|
|
329
|
+
improvement_action: Literal["regen", "fixit", "do_nothing"],
|
|
331
330
|
name: str,
|
|
332
331
|
type: Literal["automatic", "custom"],
|
|
333
|
-
|
|
332
|
+
automatic_hallucination_tolerance_levels: Dict[str, Literal["low", "medium", "high"]] | Omit = omit,
|
|
333
|
+
custom_hallucination_threshold_values: Dict[str, float] | Omit = omit,
|
|
334
334
|
description: str | Omit = omit,
|
|
335
|
-
|
|
335
|
+
max_improvement_attempt: int | Omit = omit,
|
|
336
336
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
337
337
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
338
338
|
extra_headers: Headers | None = None,
|
|
@@ -346,16 +346,10 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
346
346
|
|
|
347
347
|
Args:
|
|
348
348
|
improvement_action: The action used to improve outputs that fail one or guardrail metrics for the
|
|
349
|
-
workflow events. May be `
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
metrics: Mapping of guardrail metrics to floating point threshold values. If the workflow
|
|
355
|
-
type is automatic, only the metric names are used (`automatic_tolerance`
|
|
356
|
-
determines thresholds). Possible metrics are `correctness`, `completeness`,
|
|
357
|
-
`instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
358
|
-
`comprehensive_safety`.
|
|
349
|
+
workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the user's
|
|
350
|
+
input prompt with minor induced variance. FixIt attempts to directly address the
|
|
351
|
+
shortcomings of the output using the guardrail failure rationale. Do Nothing
|
|
352
|
+
does not attempt any improvement.
|
|
359
353
|
|
|
360
354
|
name: Name of the workflow.
|
|
361
355
|
|
|
@@ -365,12 +359,18 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
365
359
|
set the threshold for each metric as a floating point number between 0.0 and
|
|
366
360
|
1.0.
|
|
367
361
|
|
|
368
|
-
|
|
369
|
-
`
|
|
362
|
+
automatic_hallucination_tolerance_levels: Mapping of guardrail metrics to hallucination tolerance levels (either `low`,
|
|
363
|
+
`medium`, or `high`). Possible metrics are `completeness`,
|
|
364
|
+
`instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
365
|
+
`comprehensive_safety`.
|
|
366
|
+
|
|
367
|
+
custom_hallucination_threshold_values: Mapping of guardrail metrics to floating point threshold values. Possible
|
|
368
|
+
metrics are `correctness`, `completeness`, `instruction_adherence`,
|
|
369
|
+
`context_adherence`, `ground_truth_adherence`, or `comprehensive_safety`.
|
|
370
370
|
|
|
371
371
|
description: Description for the workflow.
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
max_improvement_attempt: Max. number of improvement action retries until a given event passes the
|
|
374
374
|
guardrails. Defaults to 10.
|
|
375
375
|
|
|
376
376
|
extra_headers: Send extra headers
|
|
@@ -386,12 +386,12 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
386
386
|
body=await async_maybe_transform(
|
|
387
387
|
{
|
|
388
388
|
"improvement_action": improvement_action,
|
|
389
|
-
"metrics": metrics,
|
|
390
389
|
"name": name,
|
|
391
390
|
"type": type,
|
|
392
|
-
"
|
|
391
|
+
"automatic_hallucination_tolerance_levels": automatic_hallucination_tolerance_levels,
|
|
392
|
+
"custom_hallucination_threshold_values": custom_hallucination_threshold_values,
|
|
393
393
|
"description": description,
|
|
394
|
-
"
|
|
394
|
+
"max_improvement_attempt": max_improvement_attempt,
|
|
395
395
|
},
|
|
396
396
|
defend_create_workflow_params.DefendCreateWorkflowParams,
|
|
397
397
|
),
|
|
@@ -492,8 +492,8 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
492
492
|
|
|
493
493
|
Args:
|
|
494
494
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
495
|
-
contain at least
|
|
496
|
-
|
|
495
|
+
contain at least `user_prompt` or `system_prompt` field. For the
|
|
496
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
497
497
|
|
|
498
498
|
model_output: Output generated by the LLM to be evaluated.
|
|
499
499
|
|
deeprails/resources/evaluate.py
CHANGED
|
@@ -76,8 +76,8 @@ class EvaluateResource(SyncAPIResource):
|
|
|
76
76
|
|
|
77
77
|
Args:
|
|
78
78
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
79
|
-
contain at least
|
|
80
|
-
|
|
79
|
+
contain at least `user_prompt` or `system_prompt` field. For
|
|
80
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
81
81
|
|
|
82
82
|
model_output: Output generated by the LLM to be evaluated.
|
|
83
83
|
|
|
@@ -207,8 +207,8 @@ class AsyncEvaluateResource(AsyncAPIResource):
|
|
|
207
207
|
|
|
208
208
|
Args:
|
|
209
209
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
210
|
-
contain at least
|
|
211
|
-
|
|
210
|
+
contain at least `user_prompt` or `system_prompt` field. For
|
|
211
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
212
212
|
|
|
213
213
|
model_output: Output generated by the LLM to be evaluated.
|
|
214
214
|
|
deeprails/resources/monitor.py
CHANGED
|
@@ -220,8 +220,8 @@ class MonitorResource(SyncAPIResource):
|
|
|
220
220
|
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
221
221
|
|
|
222
222
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
223
|
-
contain at least
|
|
224
|
-
|
|
223
|
+
contain at least a `user_prompt` or `system_prompt` field. For
|
|
224
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
225
225
|
|
|
226
226
|
model_output: Output generated by the LLM to be evaluated.
|
|
227
227
|
|
|
@@ -458,8 +458,8 @@ class AsyncMonitorResource(AsyncAPIResource):
|
|
|
458
458
|
`ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
459
459
|
|
|
460
460
|
model_input: A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
461
|
-
contain at least
|
|
462
|
-
|
|
461
|
+
contain at least a `user_prompt` or `system_prompt` field. For
|
|
462
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
463
463
|
|
|
464
464
|
model_output: Output generated by the LLM to be evaluated.
|
|
465
465
|
|
|
@@ -2,29 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict
|
|
5
|
+
from typing import Dict
|
|
6
6
|
from typing_extensions import Literal, Required, TypedDict
|
|
7
7
|
|
|
8
8
|
__all__ = ["DefendCreateWorkflowParams"]
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class DefendCreateWorkflowParams(TypedDict, total=False):
|
|
12
|
-
improvement_action: Required[
|
|
12
|
+
improvement_action: Required[Literal["regen", "fixit", "do_nothing"]]
|
|
13
13
|
"""
|
|
14
14
|
The action used to improve outputs that fail one or guardrail metrics for the
|
|
15
|
-
workflow events. May be `
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
metrics: Required[Dict[str, float]]
|
|
22
|
-
"""Mapping of guardrail metrics to floating point threshold values.
|
|
23
|
-
|
|
24
|
-
If the workflow type is automatic, only the metric names are used
|
|
25
|
-
(`automatic_tolerance` determines thresholds). Possible metrics are
|
|
26
|
-
`correctness`, `completeness`, `instruction_adherence`, `context_adherence`,
|
|
27
|
-
`ground_truth_adherence`, or `comprehensive_safety`.
|
|
15
|
+
workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the user's
|
|
16
|
+
input prompt with minor induced variance. FixIt attempts to directly address the
|
|
17
|
+
shortcomings of the output using the guardrail failure rationale. Do Nothing
|
|
18
|
+
does not attempt any improvement.
|
|
28
19
|
"""
|
|
29
20
|
|
|
30
21
|
name: Required[str]
|
|
@@ -39,16 +30,25 @@ class DefendCreateWorkflowParams(TypedDict, total=False):
|
|
|
39
30
|
1.0.
|
|
40
31
|
"""
|
|
41
32
|
|
|
42
|
-
|
|
33
|
+
automatic_hallucination_tolerance_levels: Dict[str, Literal["low", "medium", "high"]]
|
|
43
34
|
"""
|
|
44
|
-
|
|
45
|
-
`
|
|
35
|
+
Mapping of guardrail metrics to hallucination tolerance levels (either `low`,
|
|
36
|
+
`medium`, or `high`). Possible metrics are `completeness`,
|
|
37
|
+
`instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
38
|
+
`comprehensive_safety`.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
custom_hallucination_threshold_values: Dict[str, float]
|
|
42
|
+
"""Mapping of guardrail metrics to floating point threshold values.
|
|
43
|
+
|
|
44
|
+
Possible metrics are `correctness`, `completeness`, `instruction_adherence`,
|
|
45
|
+
`context_adherence`, `ground_truth_adherence`, or `comprehensive_safety`.
|
|
46
46
|
"""
|
|
47
47
|
|
|
48
48
|
description: str
|
|
49
49
|
"""Description for the workflow."""
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
max_improvement_attempt: int
|
|
52
52
|
"""Max.
|
|
53
53
|
|
|
54
54
|
number of improvement action retries until a given event passes the guardrails.
|
|
@@ -22,16 +22,16 @@ class DefendResponse(BaseModel):
|
|
|
22
22
|
description: Optional[str] = None
|
|
23
23
|
"""Description for the workflow."""
|
|
24
24
|
|
|
25
|
-
improvement_action: Optional[Literal["
|
|
25
|
+
improvement_action: Optional[Literal["regen", "fixit", "do_nothing"]] = None
|
|
26
26
|
"""
|
|
27
27
|
The action used to improve outputs that fail one or more guardrail metrics for
|
|
28
|
-
the workflow events. May be `
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
29
|
+
user's input prompt with minor induced variance. FixIt attempts to directly
|
|
30
|
+
address the shortcomings of the output using the guardrail failure rationale. Do
|
|
31
|
+
Nothing does not attempt any improvement.
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
max_improvement_attempt: Optional[int] = None
|
|
35
35
|
"""Max.
|
|
36
36
|
|
|
37
37
|
number of improvement action retries until a given event passes the guardrails.
|
|
@@ -40,10 +40,10 @@ class DefendResponse(BaseModel):
|
|
|
40
40
|
modified_at: Optional[datetime] = None
|
|
41
41
|
"""The most recent time the workflow was modified in UTC."""
|
|
42
42
|
|
|
43
|
-
status: Optional[Literal["
|
|
43
|
+
status: Optional[Literal["inactive", "active"]] = None
|
|
44
44
|
"""Status of the selected workflow.
|
|
45
45
|
|
|
46
|
-
May be `
|
|
46
|
+
May be `inactive` or `active`. Inactive workflows will not accept events.
|
|
47
47
|
"""
|
|
48
48
|
|
|
49
49
|
success_rate: Optional[float] = None
|
|
@@ -11,8 +11,8 @@ class DefendSubmitEventParams(TypedDict, total=False):
|
|
|
11
11
|
model_input: Required[ModelInput]
|
|
12
12
|
"""A dictionary of inputs sent to the LLM to generate output.
|
|
13
13
|
|
|
14
|
-
The dictionary must contain at least
|
|
15
|
-
|
|
14
|
+
The dictionary must contain at least `user_prompt` or `system_prompt` field. For
|
|
15
|
+
the ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
model_output: Required[str]
|
|
@@ -12,8 +12,8 @@ class EvaluateCreateParams(TypedDict, total=False):
|
|
|
12
12
|
model_input: Required[ModelInput]
|
|
13
13
|
"""A dictionary of inputs sent to the LLM to generate output.
|
|
14
14
|
|
|
15
|
-
The dictionary must contain at least
|
|
16
|
-
|
|
15
|
+
The dictionary must contain at least `user_prompt` or `system_prompt` field. For
|
|
16
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
model_output: Required[str]
|
deeprails/types/evaluation.py
CHANGED
|
@@ -32,8 +32,8 @@ class Evaluation(BaseModel):
|
|
|
32
32
|
api_model_input: ModelInput = FieldInfo(alias="model_input")
|
|
33
33
|
"""A dictionary of inputs sent to the LLM to generate output.
|
|
34
34
|
|
|
35
|
-
The dictionary must contain at least
|
|
36
|
-
|
|
35
|
+
The dictionary must contain at least `user_prompt` or `system_prompt` field. For
|
|
36
|
+
ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
39
|
api_model_output: str = FieldInfo(alias="model_output")
|
|
@@ -31,8 +31,8 @@ class MonitorSubmitEventParams(TypedDict, total=False):
|
|
|
31
31
|
model_input: Required[ModelInput]
|
|
32
32
|
"""A dictionary of inputs sent to the LLM to generate output.
|
|
33
33
|
|
|
34
|
-
The dictionary must contain at least
|
|
35
|
-
For
|
|
34
|
+
The dictionary must contain at least a `user_prompt` or `system_prompt` field.
|
|
35
|
+
For ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
38
|
model_output: Required[str]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: deeprails
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: The official Python library for the deeprails API
|
|
5
5
|
Project-URL: Homepage, https://docs.deeprails.com/
|
|
6
6
|
Project-URL: Repository, https://github.com/deeprails/deeprails-sdk-python
|
|
@@ -67,12 +67,12 @@ client = Deeprails(
|
|
|
67
67
|
|
|
68
68
|
defend_response = client.defend.create_workflow(
|
|
69
69
|
improvement_action="fixit",
|
|
70
|
-
|
|
70
|
+
name="Push Alert Workflow",
|
|
71
|
+
type="custom",
|
|
72
|
+
custom_hallucination_threshold_values={
|
|
71
73
|
"completeness": 0.7,
|
|
72
74
|
"instruction_adherence": 0.75,
|
|
73
75
|
},
|
|
74
|
-
name="Push Alert Workflow",
|
|
75
|
-
type="custom",
|
|
76
76
|
)
|
|
77
77
|
print(defend_response.workflow_id)
|
|
78
78
|
```
|
|
@@ -99,12 +99,12 @@ client = AsyncDeeprails(
|
|
|
99
99
|
async def main() -> None:
|
|
100
100
|
defend_response = await client.defend.create_workflow(
|
|
101
101
|
improvement_action="fixit",
|
|
102
|
-
|
|
102
|
+
name="Push Alert Workflow",
|
|
103
|
+
type="custom",
|
|
104
|
+
custom_hallucination_threshold_values={
|
|
103
105
|
"completeness": 0.7,
|
|
104
106
|
"instruction_adherence": 0.75,
|
|
105
107
|
},
|
|
106
|
-
name="Push Alert Workflow",
|
|
107
|
-
type="custom",
|
|
108
108
|
)
|
|
109
109
|
print(defend_response.workflow_id)
|
|
110
110
|
|
|
@@ -140,12 +140,12 @@ async def main() -> None:
|
|
|
140
140
|
) as client:
|
|
141
141
|
defend_response = await client.defend.create_workflow(
|
|
142
142
|
improvement_action="fixit",
|
|
143
|
-
|
|
143
|
+
name="Push Alert Workflow",
|
|
144
|
+
type="custom",
|
|
145
|
+
custom_hallucination_threshold_values={
|
|
144
146
|
"completeness": 0.7,
|
|
145
147
|
"instruction_adherence": 0.75,
|
|
146
148
|
},
|
|
147
|
-
name="Push Alert Workflow",
|
|
148
|
-
type="custom",
|
|
149
149
|
)
|
|
150
150
|
print(defend_response.workflow_id)
|
|
151
151
|
|
|
@@ -199,12 +199,12 @@ client = Deeprails()
|
|
|
199
199
|
try:
|
|
200
200
|
client.defend.create_workflow(
|
|
201
201
|
improvement_action="fixit",
|
|
202
|
-
|
|
202
|
+
name="Push Alert Workflow",
|
|
203
|
+
type="custom",
|
|
204
|
+
custom_hallucination_threshold_values={
|
|
203
205
|
"completeness": 0.7,
|
|
204
206
|
"instruction_adherence": 0.75,
|
|
205
207
|
},
|
|
206
|
-
name="Push Alert Workflow",
|
|
207
|
-
type="custom",
|
|
208
208
|
)
|
|
209
209
|
except deeprails.APIConnectionError as e:
|
|
210
210
|
print("The server could not be reached")
|
|
@@ -250,12 +250,12 @@ client = Deeprails(
|
|
|
250
250
|
# Or, configure per-request:
|
|
251
251
|
client.with_options(max_retries=5).defend.create_workflow(
|
|
252
252
|
improvement_action="fixit",
|
|
253
|
-
|
|
253
|
+
name="Push Alert Workflow",
|
|
254
|
+
type="custom",
|
|
255
|
+
custom_hallucination_threshold_values={
|
|
254
256
|
"completeness": 0.7,
|
|
255
257
|
"instruction_adherence": 0.75,
|
|
256
258
|
},
|
|
257
|
-
name="Push Alert Workflow",
|
|
258
|
-
type="custom",
|
|
259
259
|
)
|
|
260
260
|
```
|
|
261
261
|
|
|
@@ -281,12 +281,12 @@ client = Deeprails(
|
|
|
281
281
|
# Override per-request:
|
|
282
282
|
client.with_options(timeout=5.0).defend.create_workflow(
|
|
283
283
|
improvement_action="fixit",
|
|
284
|
-
|
|
284
|
+
name="Push Alert Workflow",
|
|
285
|
+
type="custom",
|
|
286
|
+
custom_hallucination_threshold_values={
|
|
285
287
|
"completeness": 0.7,
|
|
286
288
|
"instruction_adherence": 0.75,
|
|
287
289
|
},
|
|
288
|
-
name="Push Alert Workflow",
|
|
289
|
-
type="custom",
|
|
290
290
|
)
|
|
291
291
|
```
|
|
292
292
|
|
|
@@ -330,12 +330,12 @@ from deeprails import Deeprails
|
|
|
330
330
|
client = Deeprails()
|
|
331
331
|
response = client.defend.with_raw_response.create_workflow(
|
|
332
332
|
improvement_action="fixit",
|
|
333
|
-
|
|
333
|
+
name="Push Alert Workflow",
|
|
334
|
+
type="custom",
|
|
335
|
+
custom_hallucination_threshold_values={
|
|
334
336
|
"completeness": 0.7,
|
|
335
337
|
"instruction_adherence": 0.75,
|
|
336
338
|
},
|
|
337
|
-
name="Push Alert Workflow",
|
|
338
|
-
type="custom",
|
|
339
339
|
)
|
|
340
340
|
print(response.headers.get('X-My-Header'))
|
|
341
341
|
|
|
@@ -356,12 +356,12 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
356
356
|
```python
|
|
357
357
|
with client.defend.with_streaming_response.create_workflow(
|
|
358
358
|
improvement_action="fixit",
|
|
359
|
-
|
|
359
|
+
name="Push Alert Workflow",
|
|
360
|
+
type="custom",
|
|
361
|
+
custom_hallucination_threshold_values={
|
|
360
362
|
"completeness": 0.7,
|
|
361
363
|
"instruction_adherence": 0.75,
|
|
362
364
|
},
|
|
363
|
-
name="Push Alert Workflow",
|
|
364
|
-
type="custom",
|
|
365
365
|
) as response:
|
|
366
366
|
print(response.headers.get("X-My-Header"))
|
|
367
367
|
|
|
@@ -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=hCp5bK9dyw2TyrVL69m-6qGC-QtGYwhXmFzITCWPgAs,10112
|
|
13
13
|
deeprails/_types.py,sha256=XR3mad9NsGqZsjrd1VVJ657-4O4kwyw9Qzg4M3i6Vh0,7239
|
|
14
|
-
deeprails/_version.py,sha256=
|
|
14
|
+
deeprails/_version.py,sha256=V8Z_1JKT_bgLyhd5iqPYjkEjv9Mii5vfV23cYHHyts8,161
|
|
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
|
|
@@ -27,25 +27,25 @@ deeprails/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4
|
|
|
27
27
|
deeprails/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
|
|
28
28
|
deeprails/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
29
29
|
deeprails/resources/__init__.py,sha256=ha0jL9Et8fHzPdkTa7ecihYapOC4I6O-PHf2X9igprE,1491
|
|
30
|
-
deeprails/resources/defend.py,sha256=
|
|
31
|
-
deeprails/resources/evaluate.py,sha256=
|
|
32
|
-
deeprails/resources/monitor.py,sha256=
|
|
30
|
+
deeprails/resources/defend.py,sha256=TRuF6F3YEmgGBkJRxf8Mx6JofmZjstUeLTUpHV0S4gQ,28158
|
|
31
|
+
deeprails/resources/evaluate.py,sha256=uoElGfpFyH-bO8cbq-2xM2bgfKsQN3P6YF8nmEAPugg,13005
|
|
32
|
+
deeprails/resources/monitor.py,sha256=bFCz3t8-wweF76KZoD3n8jHY-xtL8ZA7S-3eI1FiHik,22517
|
|
33
33
|
deeprails/types/__init__.py,sha256=tLO-5DMMKt-F4qQYht3F-RFgLbthP-8a36853IhNoGI,1267
|
|
34
34
|
deeprails/types/api_response.py,sha256=eHEQeL677tvm1RK0A_S03EAoprQbJzmHspiKrtjKRt4,1232
|
|
35
|
-
deeprails/types/defend_create_workflow_params.py,sha256=
|
|
36
|
-
deeprails/types/defend_response.py,sha256=
|
|
37
|
-
deeprails/types/defend_submit_event_params.py,sha256=
|
|
35
|
+
deeprails/types/defend_create_workflow_params.py,sha256=b2wWr-DtON4XcbPyKD45oO7016F4ji5LoIqyNdM3B5k,2101
|
|
36
|
+
deeprails/types/defend_response.py,sha256=sIS9nBgW2a_yBYxVWo33pgy1IKEn-m4AzamOr5Eov5g,1602
|
|
37
|
+
deeprails/types/defend_submit_event_params.py,sha256=nbrszvTg_I8WEZJe6hPzP22pCC8Fkp60nmgH3p211uU,1521
|
|
38
38
|
deeprails/types/defend_update_workflow_params.py,sha256=QH2k7EDMLub3mW1lPV5SUoKDHW_T2arSo-RGHLterwo,373
|
|
39
|
-
deeprails/types/evaluate_create_params.py,sha256=
|
|
40
|
-
deeprails/types/evaluation.py,sha256=
|
|
39
|
+
deeprails/types/evaluate_create_params.py,sha256=B_WthHkJJzH7vjvKYd_PhJcQTilOhUsMBd6mz5hxGbQ,1987
|
|
40
|
+
deeprails/types/evaluation.py,sha256=GAzuZMOD51bCNVLUeROO4Vi26j3DE3kEIRFf9-UfZjQ,3314
|
|
41
41
|
deeprails/types/monitor_create_params.py,sha256=kTSj-PhuzpT-HPDTQJemRWfd8w32foUMH9FQZj8symk,384
|
|
42
42
|
deeprails/types/monitor_retrieve_params.py,sha256=PEsRmbd-81z4pJvhfi4JbrQWNzmeiLkoNsTUoPZ6kFY,352
|
|
43
43
|
deeprails/types/monitor_retrieve_response.py,sha256=BZp7-6PFVdqYU5ZDhbr1Eao3kU132zTm9idgoaA65Gg,2245
|
|
44
|
-
deeprails/types/monitor_submit_event_params.py,sha256=
|
|
44
|
+
deeprails/types/monitor_submit_event_params.py,sha256=d2AzwBe-d0tBfvnknfy0fGCrCCd0GC2kJb1AXbje3cg,2152
|
|
45
45
|
deeprails/types/monitor_submit_event_response.py,sha256=qlraxIJaclNSR_JOizMPj9gOiz-0x7lIChSX3DmFllM,867
|
|
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.8.0.dist-info/METADATA,sha256=taDsSz0VVSWTfKlHscWkFvDJPNLZz-ALaMMo9MfLjsc,12080
|
|
49
|
+
deeprails-1.8.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
50
|
+
deeprails-1.8.0.dist-info/licenses/LICENSE,sha256=rFTxPcYE516UQLju2SCY1r2pSDDfodL0-ZvxF_fgueg,11339
|
|
51
|
+
deeprails-1.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|