deeprails 1.0.0__py3-none-any.whl → 1.3.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/__init__.py +0 -2
- deeprails/_client.py +13 -72
- deeprails/_version.py +1 -1
- deeprails/resources/{defend/defend.py → defend.py} +247 -62
- deeprails/resources/evaluate.py +6 -6
- deeprails/resources/monitor.py +20 -12
- deeprails/types/__init__.py +2 -0
- deeprails/types/api_response.py +0 -1
- deeprails/types/defend_create_workflow_params.py +1 -1
- deeprails/types/defend_response.py +1 -1
- deeprails/types/{defend/event_submit_event_params.py → defend_submit_event_params.py} +2 -2
- deeprails/types/defend_update_workflow_params.py +1 -4
- deeprails/types/monitor_retrieve_response.py +0 -1
- deeprails/types/monitor_submit_event_response.py +0 -1
- deeprails/types/{defend/workflow_event_response.py → workflow_event_response.py} +1 -1
- {deeprails-1.0.0.dist-info → deeprails-1.3.0.dist-info}/METADATA +50 -223
- {deeprails-1.0.0.dist-info → deeprails-1.3.0.dist-info}/RECORD +19 -22
- deeprails/resources/defend/__init__.py +0 -33
- deeprails/resources/defend/events.py +0 -311
- deeprails/types/defend/__init__.py +0 -6
- {deeprails-1.0.0.dist-info → deeprails-1.3.0.dist-info}/WHEEL +0 -0
- {deeprails-1.0.0.dist-info → deeprails-1.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,43 +7,32 @@ from typing_extensions import Literal
|
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
AsyncEventsResourceWithStreamingResponse,
|
|
17
|
-
)
|
|
18
|
-
from ...types import defend_create_workflow_params, defend_update_workflow_params
|
|
19
|
-
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
20
|
-
from ..._utils import maybe_transform, async_maybe_transform
|
|
21
|
-
from ..._compat import cached_property
|
|
22
|
-
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
23
|
-
from ..._response import (
|
|
10
|
+
from ..types import defend_submit_event_params, defend_create_workflow_params, defend_update_workflow_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
12
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
24
16
|
to_raw_response_wrapper,
|
|
25
17
|
to_streamed_response_wrapper,
|
|
26
18
|
async_to_raw_response_wrapper,
|
|
27
19
|
async_to_streamed_response_wrapper,
|
|
28
20
|
)
|
|
29
|
-
from
|
|
30
|
-
from
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.defend_response import DefendResponse
|
|
23
|
+
from ..types.workflow_event_response import WorkflowEventResponse
|
|
31
24
|
|
|
32
25
|
__all__ = ["DefendResource", "AsyncDefendResource"]
|
|
33
26
|
|
|
34
27
|
|
|
35
28
|
class DefendResource(SyncAPIResource):
|
|
36
|
-
@cached_property
|
|
37
|
-
def events(self) -> EventsResource:
|
|
38
|
-
return EventsResource(self._client)
|
|
39
|
-
|
|
40
29
|
@cached_property
|
|
41
30
|
def with_raw_response(self) -> DefendResourceWithRawResponse:
|
|
42
31
|
"""
|
|
43
32
|
This property can be used as a prefix for any HTTP method call to return
|
|
44
33
|
the raw response object instead of the parsed content.
|
|
45
34
|
|
|
46
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
35
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#accessing-raw-response-data-eg-headers
|
|
47
36
|
"""
|
|
48
37
|
return DefendResourceWithRawResponse(self)
|
|
49
38
|
|
|
@@ -52,7 +41,7 @@ class DefendResource(SyncAPIResource):
|
|
|
52
41
|
"""
|
|
53
42
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
54
43
|
|
|
55
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
44
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#with_streaming_response
|
|
56
45
|
"""
|
|
57
46
|
return DefendResourceWithStreamingResponse(self)
|
|
58
47
|
|
|
@@ -74,13 +63,13 @@ class DefendResource(SyncAPIResource):
|
|
|
74
63
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
75
64
|
) -> DefendResponse:
|
|
76
65
|
"""
|
|
77
|
-
|
|
78
|
-
improvement actions
|
|
66
|
+
Use this endpoint to create a new guardrail workflow with optional guardrail
|
|
67
|
+
thresholds and improvement actions
|
|
79
68
|
|
|
80
69
|
Args:
|
|
81
70
|
improvement_action: The action used to improve outputs that fail one or guardrail metrics for the
|
|
82
71
|
workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
|
83
|
-
nothing”.
|
|
72
|
+
nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
|
84
73
|
Fixit attempts to directly address the shortcomings of the output using the
|
|
85
74
|
guardrail failure rationale. Do nothing does not attempt any improvement.
|
|
86
75
|
|
|
@@ -134,6 +123,42 @@ class DefendResource(SyncAPIResource):
|
|
|
134
123
|
cast_to=DefendResponse,
|
|
135
124
|
)
|
|
136
125
|
|
|
126
|
+
def retrieve_event(
|
|
127
|
+
self,
|
|
128
|
+
event_id: str,
|
|
129
|
+
*,
|
|
130
|
+
workflow_id: str,
|
|
131
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
132
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
133
|
+
extra_headers: Headers | None = None,
|
|
134
|
+
extra_query: Query | None = None,
|
|
135
|
+
extra_body: Body | None = None,
|
|
136
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
137
|
+
) -> WorkflowEventResponse:
|
|
138
|
+
"""
|
|
139
|
+
Use this endpoint to retrieve a specific event of a guardrail workflow
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
extra_headers: Send extra headers
|
|
143
|
+
|
|
144
|
+
extra_query: Add additional query parameters to the request
|
|
145
|
+
|
|
146
|
+
extra_body: Add additional JSON properties to the request
|
|
147
|
+
|
|
148
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
149
|
+
"""
|
|
150
|
+
if not workflow_id:
|
|
151
|
+
raise ValueError(f"Expected a non-empty value for `workflow_id` but received {workflow_id!r}")
|
|
152
|
+
if not event_id:
|
|
153
|
+
raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
|
|
154
|
+
return self._get(
|
|
155
|
+
f"/defend/{workflow_id}/events/{event_id}",
|
|
156
|
+
options=make_request_options(
|
|
157
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
158
|
+
),
|
|
159
|
+
cast_to=WorkflowEventResponse,
|
|
160
|
+
)
|
|
161
|
+
|
|
137
162
|
def retrieve_workflow(
|
|
138
163
|
self,
|
|
139
164
|
workflow_id: str,
|
|
@@ -146,7 +171,7 @@ class DefendResource(SyncAPIResource):
|
|
|
146
171
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
147
172
|
) -> DefendResponse:
|
|
148
173
|
"""
|
|
149
|
-
|
|
174
|
+
Use this endpoint to retrieve the details for a specific defend workflow
|
|
150
175
|
|
|
151
176
|
Args:
|
|
152
177
|
extra_headers: Send extra headers
|
|
@@ -167,13 +192,76 @@ class DefendResource(SyncAPIResource):
|
|
|
167
192
|
cast_to=DefendResponse,
|
|
168
193
|
)
|
|
169
194
|
|
|
195
|
+
def submit_event(
|
|
196
|
+
self,
|
|
197
|
+
workflow_id: str,
|
|
198
|
+
*,
|
|
199
|
+
model_input: defend_submit_event_params.ModelInput,
|
|
200
|
+
model_output: str,
|
|
201
|
+
model_used: str,
|
|
202
|
+
nametag: str,
|
|
203
|
+
run_mode: Literal["precision_plus", "precision", "smart", "economy"],
|
|
204
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
205
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
206
|
+
extra_headers: Headers | None = None,
|
|
207
|
+
extra_query: Query | None = None,
|
|
208
|
+
extra_body: Body | None = None,
|
|
209
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
210
|
+
) -> WorkflowEventResponse:
|
|
211
|
+
"""
|
|
212
|
+
Use this endpoint to submit a model input and output pair to a workflow for
|
|
213
|
+
evaluation
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
|
|
217
|
+
`user_prompt` field and an optional `context` field. Additional properties are
|
|
218
|
+
allowed.
|
|
219
|
+
|
|
220
|
+
model_output: Output generated by the LLM to be evaluated.
|
|
221
|
+
|
|
222
|
+
model_used: Model ID used to generate the output, like `gpt-4o` or `o3`.
|
|
223
|
+
|
|
224
|
+
nametag: An optional, user-defined tag for the event.
|
|
225
|
+
|
|
226
|
+
run_mode: Run mode for the workflow event. The run mode allows the user to optimize for
|
|
227
|
+
speed, accuracy, and cost by determining which models are used to evaluate the
|
|
228
|
+
event. Available run modes include `precision_plus`, `precision`, `smart`, and
|
|
229
|
+
`economy`. Defaults to `smart`.
|
|
230
|
+
|
|
231
|
+
extra_headers: Send extra headers
|
|
232
|
+
|
|
233
|
+
extra_query: Add additional query parameters to the request
|
|
234
|
+
|
|
235
|
+
extra_body: Add additional JSON properties to the request
|
|
236
|
+
|
|
237
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
238
|
+
"""
|
|
239
|
+
if not workflow_id:
|
|
240
|
+
raise ValueError(f"Expected a non-empty value for `workflow_id` but received {workflow_id!r}")
|
|
241
|
+
return self._post(
|
|
242
|
+
f"/defend/{workflow_id}/events",
|
|
243
|
+
body=maybe_transform(
|
|
244
|
+
{
|
|
245
|
+
"model_input": model_input,
|
|
246
|
+
"model_output": model_output,
|
|
247
|
+
"model_used": model_used,
|
|
248
|
+
"nametag": nametag,
|
|
249
|
+
"run_mode": run_mode,
|
|
250
|
+
},
|
|
251
|
+
defend_submit_event_params.DefendSubmitEventParams,
|
|
252
|
+
),
|
|
253
|
+
options=make_request_options(
|
|
254
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
255
|
+
),
|
|
256
|
+
cast_to=WorkflowEventResponse,
|
|
257
|
+
)
|
|
258
|
+
|
|
170
259
|
def update_workflow(
|
|
171
260
|
self,
|
|
172
261
|
workflow_id: str,
|
|
173
262
|
*,
|
|
174
263
|
description: str | Omit = omit,
|
|
175
264
|
name: str | Omit = omit,
|
|
176
|
-
type: Literal["automatic", "custom"] | Omit = omit,
|
|
177
265
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
178
266
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
179
267
|
extra_headers: Headers | None = None,
|
|
@@ -182,15 +270,13 @@ class DefendResource(SyncAPIResource):
|
|
|
182
270
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
183
271
|
) -> DefendResponse:
|
|
184
272
|
"""
|
|
185
|
-
|
|
273
|
+
Use this endpoint to update an existing guardrail workflow
|
|
186
274
|
|
|
187
275
|
Args:
|
|
188
276
|
description: Description for the workflow.
|
|
189
277
|
|
|
190
278
|
name: Name of the workflow.
|
|
191
279
|
|
|
192
|
-
type: Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
193
|
-
|
|
194
280
|
extra_headers: Send extra headers
|
|
195
281
|
|
|
196
282
|
extra_query: Add additional query parameters to the request
|
|
@@ -207,7 +293,6 @@ class DefendResource(SyncAPIResource):
|
|
|
207
293
|
{
|
|
208
294
|
"description": description,
|
|
209
295
|
"name": name,
|
|
210
|
-
"type": type,
|
|
211
296
|
},
|
|
212
297
|
defend_update_workflow_params.DefendUpdateWorkflowParams,
|
|
213
298
|
),
|
|
@@ -219,17 +304,13 @@ class DefendResource(SyncAPIResource):
|
|
|
219
304
|
|
|
220
305
|
|
|
221
306
|
class AsyncDefendResource(AsyncAPIResource):
|
|
222
|
-
@cached_property
|
|
223
|
-
def events(self) -> AsyncEventsResource:
|
|
224
|
-
return AsyncEventsResource(self._client)
|
|
225
|
-
|
|
226
307
|
@cached_property
|
|
227
308
|
def with_raw_response(self) -> AsyncDefendResourceWithRawResponse:
|
|
228
309
|
"""
|
|
229
310
|
This property can be used as a prefix for any HTTP method call to return
|
|
230
311
|
the raw response object instead of the parsed content.
|
|
231
312
|
|
|
232
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
313
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#accessing-raw-response-data-eg-headers
|
|
233
314
|
"""
|
|
234
315
|
return AsyncDefendResourceWithRawResponse(self)
|
|
235
316
|
|
|
@@ -238,7 +319,7 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
238
319
|
"""
|
|
239
320
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
240
321
|
|
|
241
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
322
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#with_streaming_response
|
|
242
323
|
"""
|
|
243
324
|
return AsyncDefendResourceWithStreamingResponse(self)
|
|
244
325
|
|
|
@@ -260,13 +341,13 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
260
341
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
261
342
|
) -> DefendResponse:
|
|
262
343
|
"""
|
|
263
|
-
|
|
264
|
-
improvement actions
|
|
344
|
+
Use this endpoint to create a new guardrail workflow with optional guardrail
|
|
345
|
+
thresholds and improvement actions
|
|
265
346
|
|
|
266
347
|
Args:
|
|
267
348
|
improvement_action: The action used to improve outputs that fail one or guardrail metrics for the
|
|
268
349
|
workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
|
269
|
-
nothing”.
|
|
350
|
+
nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
|
270
351
|
Fixit attempts to directly address the shortcomings of the output using the
|
|
271
352
|
guardrail failure rationale. Do nothing does not attempt any improvement.
|
|
272
353
|
|
|
@@ -320,6 +401,42 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
320
401
|
cast_to=DefendResponse,
|
|
321
402
|
)
|
|
322
403
|
|
|
404
|
+
async def retrieve_event(
|
|
405
|
+
self,
|
|
406
|
+
event_id: str,
|
|
407
|
+
*,
|
|
408
|
+
workflow_id: str,
|
|
409
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
410
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
411
|
+
extra_headers: Headers | None = None,
|
|
412
|
+
extra_query: Query | None = None,
|
|
413
|
+
extra_body: Body | None = None,
|
|
414
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
415
|
+
) -> WorkflowEventResponse:
|
|
416
|
+
"""
|
|
417
|
+
Use this endpoint to retrieve a specific event of a guardrail workflow
|
|
418
|
+
|
|
419
|
+
Args:
|
|
420
|
+
extra_headers: Send extra headers
|
|
421
|
+
|
|
422
|
+
extra_query: Add additional query parameters to the request
|
|
423
|
+
|
|
424
|
+
extra_body: Add additional JSON properties to the request
|
|
425
|
+
|
|
426
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
427
|
+
"""
|
|
428
|
+
if not workflow_id:
|
|
429
|
+
raise ValueError(f"Expected a non-empty value for `workflow_id` but received {workflow_id!r}")
|
|
430
|
+
if not event_id:
|
|
431
|
+
raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
|
|
432
|
+
return await self._get(
|
|
433
|
+
f"/defend/{workflow_id}/events/{event_id}",
|
|
434
|
+
options=make_request_options(
|
|
435
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
436
|
+
),
|
|
437
|
+
cast_to=WorkflowEventResponse,
|
|
438
|
+
)
|
|
439
|
+
|
|
323
440
|
async def retrieve_workflow(
|
|
324
441
|
self,
|
|
325
442
|
workflow_id: str,
|
|
@@ -332,7 +449,7 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
332
449
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
333
450
|
) -> DefendResponse:
|
|
334
451
|
"""
|
|
335
|
-
|
|
452
|
+
Use this endpoint to retrieve the details for a specific defend workflow
|
|
336
453
|
|
|
337
454
|
Args:
|
|
338
455
|
extra_headers: Send extra headers
|
|
@@ -353,13 +470,76 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
353
470
|
cast_to=DefendResponse,
|
|
354
471
|
)
|
|
355
472
|
|
|
473
|
+
async def submit_event(
|
|
474
|
+
self,
|
|
475
|
+
workflow_id: str,
|
|
476
|
+
*,
|
|
477
|
+
model_input: defend_submit_event_params.ModelInput,
|
|
478
|
+
model_output: str,
|
|
479
|
+
model_used: str,
|
|
480
|
+
nametag: str,
|
|
481
|
+
run_mode: Literal["precision_plus", "precision", "smart", "economy"],
|
|
482
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
483
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
484
|
+
extra_headers: Headers | None = None,
|
|
485
|
+
extra_query: Query | None = None,
|
|
486
|
+
extra_body: Body | None = None,
|
|
487
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
488
|
+
) -> WorkflowEventResponse:
|
|
489
|
+
"""
|
|
490
|
+
Use this endpoint to submit a model input and output pair to a workflow for
|
|
491
|
+
evaluation
|
|
492
|
+
|
|
493
|
+
Args:
|
|
494
|
+
model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
|
|
495
|
+
`user_prompt` field and an optional `context` field. Additional properties are
|
|
496
|
+
allowed.
|
|
497
|
+
|
|
498
|
+
model_output: Output generated by the LLM to be evaluated.
|
|
499
|
+
|
|
500
|
+
model_used: Model ID used to generate the output, like `gpt-4o` or `o3`.
|
|
501
|
+
|
|
502
|
+
nametag: An optional, user-defined tag for the event.
|
|
503
|
+
|
|
504
|
+
run_mode: Run mode for the workflow event. The run mode allows the user to optimize for
|
|
505
|
+
speed, accuracy, and cost by determining which models are used to evaluate the
|
|
506
|
+
event. Available run modes include `precision_plus`, `precision`, `smart`, and
|
|
507
|
+
`economy`. Defaults to `smart`.
|
|
508
|
+
|
|
509
|
+
extra_headers: Send extra headers
|
|
510
|
+
|
|
511
|
+
extra_query: Add additional query parameters to the request
|
|
512
|
+
|
|
513
|
+
extra_body: Add additional JSON properties to the request
|
|
514
|
+
|
|
515
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
516
|
+
"""
|
|
517
|
+
if not workflow_id:
|
|
518
|
+
raise ValueError(f"Expected a non-empty value for `workflow_id` but received {workflow_id!r}")
|
|
519
|
+
return await self._post(
|
|
520
|
+
f"/defend/{workflow_id}/events",
|
|
521
|
+
body=await async_maybe_transform(
|
|
522
|
+
{
|
|
523
|
+
"model_input": model_input,
|
|
524
|
+
"model_output": model_output,
|
|
525
|
+
"model_used": model_used,
|
|
526
|
+
"nametag": nametag,
|
|
527
|
+
"run_mode": run_mode,
|
|
528
|
+
},
|
|
529
|
+
defend_submit_event_params.DefendSubmitEventParams,
|
|
530
|
+
),
|
|
531
|
+
options=make_request_options(
|
|
532
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
533
|
+
),
|
|
534
|
+
cast_to=WorkflowEventResponse,
|
|
535
|
+
)
|
|
536
|
+
|
|
356
537
|
async def update_workflow(
|
|
357
538
|
self,
|
|
358
539
|
workflow_id: str,
|
|
359
540
|
*,
|
|
360
541
|
description: str | Omit = omit,
|
|
361
542
|
name: str | Omit = omit,
|
|
362
|
-
type: Literal["automatic", "custom"] | Omit = omit,
|
|
363
543
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
364
544
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
365
545
|
extra_headers: Headers | None = None,
|
|
@@ -368,15 +548,13 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
368
548
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
369
549
|
) -> DefendResponse:
|
|
370
550
|
"""
|
|
371
|
-
|
|
551
|
+
Use this endpoint to update an existing guardrail workflow
|
|
372
552
|
|
|
373
553
|
Args:
|
|
374
554
|
description: Description for the workflow.
|
|
375
555
|
|
|
376
556
|
name: Name of the workflow.
|
|
377
557
|
|
|
378
|
-
type: Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
379
|
-
|
|
380
558
|
extra_headers: Send extra headers
|
|
381
559
|
|
|
382
560
|
extra_query: Add additional query parameters to the request
|
|
@@ -393,7 +571,6 @@ class AsyncDefendResource(AsyncAPIResource):
|
|
|
393
571
|
{
|
|
394
572
|
"description": description,
|
|
395
573
|
"name": name,
|
|
396
|
-
"type": type,
|
|
397
574
|
},
|
|
398
575
|
defend_update_workflow_params.DefendUpdateWorkflowParams,
|
|
399
576
|
),
|
|
@@ -411,17 +588,19 @@ class DefendResourceWithRawResponse:
|
|
|
411
588
|
self.create_workflow = to_raw_response_wrapper(
|
|
412
589
|
defend.create_workflow,
|
|
413
590
|
)
|
|
591
|
+
self.retrieve_event = to_raw_response_wrapper(
|
|
592
|
+
defend.retrieve_event,
|
|
593
|
+
)
|
|
414
594
|
self.retrieve_workflow = to_raw_response_wrapper(
|
|
415
595
|
defend.retrieve_workflow,
|
|
416
596
|
)
|
|
597
|
+
self.submit_event = to_raw_response_wrapper(
|
|
598
|
+
defend.submit_event,
|
|
599
|
+
)
|
|
417
600
|
self.update_workflow = to_raw_response_wrapper(
|
|
418
601
|
defend.update_workflow,
|
|
419
602
|
)
|
|
420
603
|
|
|
421
|
-
@cached_property
|
|
422
|
-
def events(self) -> EventsResourceWithRawResponse:
|
|
423
|
-
return EventsResourceWithRawResponse(self._defend.events)
|
|
424
|
-
|
|
425
604
|
|
|
426
605
|
class AsyncDefendResourceWithRawResponse:
|
|
427
606
|
def __init__(self, defend: AsyncDefendResource) -> None:
|
|
@@ -430,17 +609,19 @@ class AsyncDefendResourceWithRawResponse:
|
|
|
430
609
|
self.create_workflow = async_to_raw_response_wrapper(
|
|
431
610
|
defend.create_workflow,
|
|
432
611
|
)
|
|
612
|
+
self.retrieve_event = async_to_raw_response_wrapper(
|
|
613
|
+
defend.retrieve_event,
|
|
614
|
+
)
|
|
433
615
|
self.retrieve_workflow = async_to_raw_response_wrapper(
|
|
434
616
|
defend.retrieve_workflow,
|
|
435
617
|
)
|
|
618
|
+
self.submit_event = async_to_raw_response_wrapper(
|
|
619
|
+
defend.submit_event,
|
|
620
|
+
)
|
|
436
621
|
self.update_workflow = async_to_raw_response_wrapper(
|
|
437
622
|
defend.update_workflow,
|
|
438
623
|
)
|
|
439
624
|
|
|
440
|
-
@cached_property
|
|
441
|
-
def events(self) -> AsyncEventsResourceWithRawResponse:
|
|
442
|
-
return AsyncEventsResourceWithRawResponse(self._defend.events)
|
|
443
|
-
|
|
444
625
|
|
|
445
626
|
class DefendResourceWithStreamingResponse:
|
|
446
627
|
def __init__(self, defend: DefendResource) -> None:
|
|
@@ -449,17 +630,19 @@ class DefendResourceWithStreamingResponse:
|
|
|
449
630
|
self.create_workflow = to_streamed_response_wrapper(
|
|
450
631
|
defend.create_workflow,
|
|
451
632
|
)
|
|
633
|
+
self.retrieve_event = to_streamed_response_wrapper(
|
|
634
|
+
defend.retrieve_event,
|
|
635
|
+
)
|
|
452
636
|
self.retrieve_workflow = to_streamed_response_wrapper(
|
|
453
637
|
defend.retrieve_workflow,
|
|
454
638
|
)
|
|
639
|
+
self.submit_event = to_streamed_response_wrapper(
|
|
640
|
+
defend.submit_event,
|
|
641
|
+
)
|
|
455
642
|
self.update_workflow = to_streamed_response_wrapper(
|
|
456
643
|
defend.update_workflow,
|
|
457
644
|
)
|
|
458
645
|
|
|
459
|
-
@cached_property
|
|
460
|
-
def events(self) -> EventsResourceWithStreamingResponse:
|
|
461
|
-
return EventsResourceWithStreamingResponse(self._defend.events)
|
|
462
|
-
|
|
463
646
|
|
|
464
647
|
class AsyncDefendResourceWithStreamingResponse:
|
|
465
648
|
def __init__(self, defend: AsyncDefendResource) -> None:
|
|
@@ -468,13 +651,15 @@ class AsyncDefendResourceWithStreamingResponse:
|
|
|
468
651
|
self.create_workflow = async_to_streamed_response_wrapper(
|
|
469
652
|
defend.create_workflow,
|
|
470
653
|
)
|
|
654
|
+
self.retrieve_event = async_to_streamed_response_wrapper(
|
|
655
|
+
defend.retrieve_event,
|
|
656
|
+
)
|
|
471
657
|
self.retrieve_workflow = async_to_streamed_response_wrapper(
|
|
472
658
|
defend.retrieve_workflow,
|
|
473
659
|
)
|
|
660
|
+
self.submit_event = async_to_streamed_response_wrapper(
|
|
661
|
+
defend.submit_event,
|
|
662
|
+
)
|
|
474
663
|
self.update_workflow = async_to_streamed_response_wrapper(
|
|
475
664
|
defend.update_workflow,
|
|
476
665
|
)
|
|
477
|
-
|
|
478
|
-
@cached_property
|
|
479
|
-
def events(self) -> AsyncEventsResourceWithStreamingResponse:
|
|
480
|
-
return AsyncEventsResourceWithStreamingResponse(self._defend.events)
|
deeprails/resources/evaluate.py
CHANGED
|
@@ -31,7 +31,7 @@ class EvaluateResource(SyncAPIResource):
|
|
|
31
31
|
This property can be used as a prefix for any HTTP method call to return
|
|
32
32
|
the raw response object instead of the parsed content.
|
|
33
33
|
|
|
34
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
34
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#accessing-raw-response-data-eg-headers
|
|
35
35
|
"""
|
|
36
36
|
return EvaluateResourceWithRawResponse(self)
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ class EvaluateResource(SyncAPIResource):
|
|
|
40
40
|
"""
|
|
41
41
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
42
42
|
|
|
43
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
43
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#with_streaming_response
|
|
44
44
|
"""
|
|
45
45
|
return EvaluateResourceWithStreamingResponse(self)
|
|
46
46
|
|
|
@@ -133,7 +133,7 @@ class EvaluateResource(SyncAPIResource):
|
|
|
133
133
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
134
134
|
) -> Evaluation:
|
|
135
135
|
"""
|
|
136
|
-
|
|
136
|
+
Use this endpoint to retrieve the evaluation record for a given evaluation ID
|
|
137
137
|
|
|
138
138
|
Args:
|
|
139
139
|
extra_headers: Send extra headers
|
|
@@ -162,7 +162,7 @@ class AsyncEvaluateResource(AsyncAPIResource):
|
|
|
162
162
|
This property can be used as a prefix for any HTTP method call to return
|
|
163
163
|
the raw response object instead of the parsed content.
|
|
164
164
|
|
|
165
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
165
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#accessing-raw-response-data-eg-headers
|
|
166
166
|
"""
|
|
167
167
|
return AsyncEvaluateResourceWithRawResponse(self)
|
|
168
168
|
|
|
@@ -171,7 +171,7 @@ class AsyncEvaluateResource(AsyncAPIResource):
|
|
|
171
171
|
"""
|
|
172
172
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
173
173
|
|
|
174
|
-
For more information, see https://www.github.com/deeprails/deeprails-python
|
|
174
|
+
For more information, see https://www.github.com/deeprails/deeprails-sdk-python#with_streaming_response
|
|
175
175
|
"""
|
|
176
176
|
return AsyncEvaluateResourceWithStreamingResponse(self)
|
|
177
177
|
|
|
@@ -264,7 +264,7 @@ class AsyncEvaluateResource(AsyncAPIResource):
|
|
|
264
264
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
265
265
|
) -> Evaluation:
|
|
266
266
|
"""
|
|
267
|
-
|
|
267
|
+
Use this endpoint to retrieve the evaluation record for a given evaluation ID
|
|
268
268
|
|
|
269
269
|
Args:
|
|
270
270
|
extra_headers: Send extra headers
|