deeprails 1.12.0__tar.gz → 1.14.0__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.
- deeprails-1.14.0/.release-please-manifest.json +3 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/CHANGELOG.md +21 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/PKG-INFO +23 -32
- {deeprails-1.12.0 → deeprails-1.14.0}/README.md +22 -31
- {deeprails-1.12.0 → deeprails-1.14.0}/api.md +21 -8
- {deeprails-1.12.0 → deeprails-1.14.0}/pyproject.toml +1 -1
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_files.py +1 -1
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_utils.py +1 -1
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_version.py +1 -1
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/resources/defend.py +61 -35
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/resources/files.py +6 -14
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/resources/monitor.py +109 -21
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/__init__.py +7 -1
- deeprails-1.14.0/src/deeprails/types/defend_create_response.py +22 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/defend_create_workflow_params.py +7 -7
- deeprails-1.14.0/src/deeprails/types/defend_response.py +145 -0
- deeprails-1.14.0/src/deeprails/types/defend_retrieve_workflow_params.py +15 -0
- deeprails-1.14.0/src/deeprails/types/defend_update_response.py +22 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/file_response.py +2 -9
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/file_upload_params.py +2 -2
- deeprails-1.14.0/src/deeprails/types/monitor_create_response.py +23 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/monitor_detail_response.py +41 -40
- deeprails-1.14.0/src/deeprails/types/monitor_event_detail_response.py +68 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/monitor_event_response.py +0 -3
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/monitor_retrieve_params.py +4 -1
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/monitor_update_params.py +4 -4
- deeprails-1.14.0/src/deeprails/types/monitor_update_response.py +23 -0
- deeprails-1.14.0/src/deeprails/types/workflow_event_detail_response.py +114 -0
- deeprails-1.14.0/src/deeprails/types/workflow_event_response.py +22 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/api_resources/test_defend.py +59 -38
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/api_resources/test_files.py +6 -6
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/api_resources/test_monitor.py +125 -19
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_client.py +22 -10
- deeprails-1.12.0/.release-please-manifest.json +0 -3
- deeprails-1.12.0/src/deeprails/types/defend_response.py +0 -50
- deeprails-1.12.0/src/deeprails/types/monitor_response.py +0 -36
- deeprails-1.12.0/src/deeprails/types/workflow_event_response.py +0 -33
- {deeprails-1.12.0 → deeprails-1.14.0}/.gitignore +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/CONTRIBUTING.md +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/LICENSE +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/bin/check-release-environment +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/bin/publish-pypi +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/examples/.keep +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/noxfile.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/release-please-config.json +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/requirements-dev.lock +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/requirements.lock +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/__init__.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_base_client.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_client.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_compat.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_constants.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_exceptions.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_models.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_qs.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_resource.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_response.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_streaming.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_types.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/__init__.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_compat.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_datetime_parse.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_logs.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_proxy.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_reflection.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_resources_proxy.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_streams.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_sync.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_transform.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/_utils/_typing.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/lib/.keep +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/py.typed +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/resources/__init__.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/defend_submit_event_params.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/defend_update_workflow_params.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/monitor_create_params.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/src/deeprails/types/monitor_submit_event_params.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/__init__.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/api_resources/__init__.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/conftest.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/sample_file.txt +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_deepcopy.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_extract_files.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_files.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_models.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_qs.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_required_args.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_response.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_streaming.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_transform.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_utils/test_proxy.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/test_utils/test_typing.py +0 -0
- {deeprails-1.12.0 → deeprails-1.14.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.14.0 (2025-11-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.13.0...v1.14.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.13.0...v1.14.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add retrieve monitor event and examples ([b295221](https://github.com/deeprails/deeprails-sdk-python/commit/b2952212f394e8947c900735a5841b78bf8ec729))
|
|
10
|
+
|
|
11
|
+
## 1.13.0 (2025-11-10)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v1.12.0...v1.13.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.12.0...v1.13.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** Mass restructuring of API, including response bodies and naming schemes ([c72cf32](https://github.com/deeprails/deeprails-sdk-python/commit/c72cf32b37a41673c895a172dd09dcbe90b6ce40))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* **internal:** grammar fix (it's -> its) ([11449b2](https://github.com/deeprails/deeprails-sdk-python/commit/11449b27a513a1c5b5b35ba88778c636582feb0b))
|
|
23
|
+
|
|
3
24
|
## 1.12.0 (2025-11-02)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v1.11.0...v1.12.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.11.0...v1.12.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: deeprails
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.14.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
|
|
@@ -65,16 +65,17 @@ client = Deeprails(
|
|
|
65
65
|
api_key=os.environ.get("DEEPRAILS_API_KEY"), # This is the default and can be omitted
|
|
66
66
|
)
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
defend_create_response = client.defend.create_workflow(
|
|
69
69
|
improvement_action="fixit",
|
|
70
70
|
name="Push Alert Workflow",
|
|
71
|
-
|
|
71
|
+
threshold_type="custom",
|
|
72
72
|
custom_hallucination_threshold_values={
|
|
73
73
|
"completeness": 0.7,
|
|
74
74
|
"instruction_adherence": 0.75,
|
|
75
75
|
},
|
|
76
|
+
web_search=True,
|
|
76
77
|
)
|
|
77
|
-
print(
|
|
78
|
+
print(defend_create_response.workflow_id)
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
While you can provide an `api_key` keyword argument,
|
|
@@ -97,16 +98,17 @@ client = AsyncDeeprails(
|
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
async def main() -> None:
|
|
100
|
-
|
|
101
|
+
defend_create_response = await client.defend.create_workflow(
|
|
101
102
|
improvement_action="fixit",
|
|
102
103
|
name="Push Alert Workflow",
|
|
103
|
-
|
|
104
|
+
threshold_type="custom",
|
|
104
105
|
custom_hallucination_threshold_values={
|
|
105
106
|
"completeness": 0.7,
|
|
106
107
|
"instruction_adherence": 0.75,
|
|
107
108
|
},
|
|
109
|
+
web_search=True,
|
|
108
110
|
)
|
|
109
|
-
print(
|
|
111
|
+
print(defend_create_response.workflow_id)
|
|
110
112
|
|
|
111
113
|
|
|
112
114
|
asyncio.run(main())
|
|
@@ -138,16 +140,17 @@ async def main() -> None:
|
|
|
138
140
|
api_key="My API Key",
|
|
139
141
|
http_client=DefaultAioHttpClient(),
|
|
140
142
|
) as client:
|
|
141
|
-
|
|
143
|
+
defend_create_response = await client.defend.create_workflow(
|
|
142
144
|
improvement_action="fixit",
|
|
143
145
|
name="Push Alert Workflow",
|
|
144
|
-
|
|
146
|
+
threshold_type="custom",
|
|
145
147
|
custom_hallucination_threshold_values={
|
|
146
148
|
"completeness": 0.7,
|
|
147
149
|
"instruction_adherence": 0.75,
|
|
148
150
|
},
|
|
151
|
+
web_search=True,
|
|
149
152
|
)
|
|
150
|
-
print(
|
|
153
|
+
print(defend_create_response.workflow_id)
|
|
151
154
|
|
|
152
155
|
|
|
153
156
|
asyncio.run(main())
|
|
@@ -181,23 +184,6 @@ workflow_event_response = client.defend.submit_event(
|
|
|
181
184
|
print(workflow_event_response.model_input)
|
|
182
185
|
```
|
|
183
186
|
|
|
184
|
-
## File uploads
|
|
185
|
-
|
|
186
|
-
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
|
187
|
-
|
|
188
|
-
```python
|
|
189
|
-
from pathlib import Path
|
|
190
|
-
from deeprails import Deeprails
|
|
191
|
-
|
|
192
|
-
client = Deeprails()
|
|
193
|
-
|
|
194
|
-
client.files.upload(
|
|
195
|
-
file=Path("/path/to/file"),
|
|
196
|
-
)
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
|
200
|
-
|
|
201
187
|
## Handling errors
|
|
202
188
|
|
|
203
189
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `deeprails.APIConnectionError` is raised.
|
|
@@ -217,11 +203,12 @@ try:
|
|
|
217
203
|
client.defend.create_workflow(
|
|
218
204
|
improvement_action="fixit",
|
|
219
205
|
name="Push Alert Workflow",
|
|
220
|
-
|
|
206
|
+
threshold_type="custom",
|
|
221
207
|
custom_hallucination_threshold_values={
|
|
222
208
|
"completeness": 0.7,
|
|
223
209
|
"instruction_adherence": 0.75,
|
|
224
210
|
},
|
|
211
|
+
web_search=True,
|
|
225
212
|
)
|
|
226
213
|
except deeprails.APIConnectionError as e:
|
|
227
214
|
print("The server could not be reached")
|
|
@@ -268,11 +255,12 @@ client = Deeprails(
|
|
|
268
255
|
client.with_options(max_retries=5).defend.create_workflow(
|
|
269
256
|
improvement_action="fixit",
|
|
270
257
|
name="Push Alert Workflow",
|
|
271
|
-
|
|
258
|
+
threshold_type="custom",
|
|
272
259
|
custom_hallucination_threshold_values={
|
|
273
260
|
"completeness": 0.7,
|
|
274
261
|
"instruction_adherence": 0.75,
|
|
275
262
|
},
|
|
263
|
+
web_search=True,
|
|
276
264
|
)
|
|
277
265
|
```
|
|
278
266
|
|
|
@@ -299,11 +287,12 @@ client = Deeprails(
|
|
|
299
287
|
client.with_options(timeout=5.0).defend.create_workflow(
|
|
300
288
|
improvement_action="fixit",
|
|
301
289
|
name="Push Alert Workflow",
|
|
302
|
-
|
|
290
|
+
threshold_type="custom",
|
|
303
291
|
custom_hallucination_threshold_values={
|
|
304
292
|
"completeness": 0.7,
|
|
305
293
|
"instruction_adherence": 0.75,
|
|
306
294
|
},
|
|
295
|
+
web_search=True,
|
|
307
296
|
)
|
|
308
297
|
```
|
|
309
298
|
|
|
@@ -348,11 +337,12 @@ client = Deeprails()
|
|
|
348
337
|
response = client.defend.with_raw_response.create_workflow(
|
|
349
338
|
improvement_action="fixit",
|
|
350
339
|
name="Push Alert Workflow",
|
|
351
|
-
|
|
340
|
+
threshold_type="custom",
|
|
352
341
|
custom_hallucination_threshold_values={
|
|
353
342
|
"completeness": 0.7,
|
|
354
343
|
"instruction_adherence": 0.75,
|
|
355
344
|
},
|
|
345
|
+
web_search=True,
|
|
356
346
|
)
|
|
357
347
|
print(response.headers.get('X-My-Header'))
|
|
358
348
|
|
|
@@ -374,11 +364,12 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
374
364
|
with client.defend.with_streaming_response.create_workflow(
|
|
375
365
|
improvement_action="fixit",
|
|
376
366
|
name="Push Alert Workflow",
|
|
377
|
-
|
|
367
|
+
threshold_type="custom",
|
|
378
368
|
custom_hallucination_threshold_values={
|
|
379
369
|
"completeness": 0.7,
|
|
380
370
|
"instruction_adherence": 0.75,
|
|
381
371
|
},
|
|
372
|
+
web_search=True,
|
|
382
373
|
) as response:
|
|
383
374
|
print(response.headers.get("X-My-Header"))
|
|
384
375
|
|
|
@@ -30,16 +30,17 @@ client = Deeprails(
|
|
|
30
30
|
api_key=os.environ.get("DEEPRAILS_API_KEY"), # This is the default and can be omitted
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
defend_create_response = client.defend.create_workflow(
|
|
34
34
|
improvement_action="fixit",
|
|
35
35
|
name="Push Alert Workflow",
|
|
36
|
-
|
|
36
|
+
threshold_type="custom",
|
|
37
37
|
custom_hallucination_threshold_values={
|
|
38
38
|
"completeness": 0.7,
|
|
39
39
|
"instruction_adherence": 0.75,
|
|
40
40
|
},
|
|
41
|
+
web_search=True,
|
|
41
42
|
)
|
|
42
|
-
print(
|
|
43
|
+
print(defend_create_response.workflow_id)
|
|
43
44
|
```
|
|
44
45
|
|
|
45
46
|
While you can provide an `api_key` keyword argument,
|
|
@@ -62,16 +63,17 @@ client = AsyncDeeprails(
|
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
async def main() -> None:
|
|
65
|
-
|
|
66
|
+
defend_create_response = await client.defend.create_workflow(
|
|
66
67
|
improvement_action="fixit",
|
|
67
68
|
name="Push Alert Workflow",
|
|
68
|
-
|
|
69
|
+
threshold_type="custom",
|
|
69
70
|
custom_hallucination_threshold_values={
|
|
70
71
|
"completeness": 0.7,
|
|
71
72
|
"instruction_adherence": 0.75,
|
|
72
73
|
},
|
|
74
|
+
web_search=True,
|
|
73
75
|
)
|
|
74
|
-
print(
|
|
76
|
+
print(defend_create_response.workflow_id)
|
|
75
77
|
|
|
76
78
|
|
|
77
79
|
asyncio.run(main())
|
|
@@ -103,16 +105,17 @@ async def main() -> None:
|
|
|
103
105
|
api_key="My API Key",
|
|
104
106
|
http_client=DefaultAioHttpClient(),
|
|
105
107
|
) as client:
|
|
106
|
-
|
|
108
|
+
defend_create_response = await client.defend.create_workflow(
|
|
107
109
|
improvement_action="fixit",
|
|
108
110
|
name="Push Alert Workflow",
|
|
109
|
-
|
|
111
|
+
threshold_type="custom",
|
|
110
112
|
custom_hallucination_threshold_values={
|
|
111
113
|
"completeness": 0.7,
|
|
112
114
|
"instruction_adherence": 0.75,
|
|
113
115
|
},
|
|
116
|
+
web_search=True,
|
|
114
117
|
)
|
|
115
|
-
print(
|
|
118
|
+
print(defend_create_response.workflow_id)
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
asyncio.run(main())
|
|
@@ -146,23 +149,6 @@ workflow_event_response = client.defend.submit_event(
|
|
|
146
149
|
print(workflow_event_response.model_input)
|
|
147
150
|
```
|
|
148
151
|
|
|
149
|
-
## File uploads
|
|
150
|
-
|
|
151
|
-
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
|
152
|
-
|
|
153
|
-
```python
|
|
154
|
-
from pathlib import Path
|
|
155
|
-
from deeprails import Deeprails
|
|
156
|
-
|
|
157
|
-
client = Deeprails()
|
|
158
|
-
|
|
159
|
-
client.files.upload(
|
|
160
|
-
file=Path("/path/to/file"),
|
|
161
|
-
)
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
|
165
|
-
|
|
166
152
|
## Handling errors
|
|
167
153
|
|
|
168
154
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `deeprails.APIConnectionError` is raised.
|
|
@@ -182,11 +168,12 @@ try:
|
|
|
182
168
|
client.defend.create_workflow(
|
|
183
169
|
improvement_action="fixit",
|
|
184
170
|
name="Push Alert Workflow",
|
|
185
|
-
|
|
171
|
+
threshold_type="custom",
|
|
186
172
|
custom_hallucination_threshold_values={
|
|
187
173
|
"completeness": 0.7,
|
|
188
174
|
"instruction_adherence": 0.75,
|
|
189
175
|
},
|
|
176
|
+
web_search=True,
|
|
190
177
|
)
|
|
191
178
|
except deeprails.APIConnectionError as e:
|
|
192
179
|
print("The server could not be reached")
|
|
@@ -233,11 +220,12 @@ client = Deeprails(
|
|
|
233
220
|
client.with_options(max_retries=5).defend.create_workflow(
|
|
234
221
|
improvement_action="fixit",
|
|
235
222
|
name="Push Alert Workflow",
|
|
236
|
-
|
|
223
|
+
threshold_type="custom",
|
|
237
224
|
custom_hallucination_threshold_values={
|
|
238
225
|
"completeness": 0.7,
|
|
239
226
|
"instruction_adherence": 0.75,
|
|
240
227
|
},
|
|
228
|
+
web_search=True,
|
|
241
229
|
)
|
|
242
230
|
```
|
|
243
231
|
|
|
@@ -264,11 +252,12 @@ client = Deeprails(
|
|
|
264
252
|
client.with_options(timeout=5.0).defend.create_workflow(
|
|
265
253
|
improvement_action="fixit",
|
|
266
254
|
name="Push Alert Workflow",
|
|
267
|
-
|
|
255
|
+
threshold_type="custom",
|
|
268
256
|
custom_hallucination_threshold_values={
|
|
269
257
|
"completeness": 0.7,
|
|
270
258
|
"instruction_adherence": 0.75,
|
|
271
259
|
},
|
|
260
|
+
web_search=True,
|
|
272
261
|
)
|
|
273
262
|
```
|
|
274
263
|
|
|
@@ -313,11 +302,12 @@ client = Deeprails()
|
|
|
313
302
|
response = client.defend.with_raw_response.create_workflow(
|
|
314
303
|
improvement_action="fixit",
|
|
315
304
|
name="Push Alert Workflow",
|
|
316
|
-
|
|
305
|
+
threshold_type="custom",
|
|
317
306
|
custom_hallucination_threshold_values={
|
|
318
307
|
"completeness": 0.7,
|
|
319
308
|
"instruction_adherence": 0.75,
|
|
320
309
|
},
|
|
310
|
+
web_search=True,
|
|
321
311
|
)
|
|
322
312
|
print(response.headers.get('X-My-Header'))
|
|
323
313
|
|
|
@@ -339,11 +329,12 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
339
329
|
with client.defend.with_streaming_response.create_workflow(
|
|
340
330
|
improvement_action="fixit",
|
|
341
331
|
name="Push Alert Workflow",
|
|
342
|
-
|
|
332
|
+
threshold_type="custom",
|
|
343
333
|
custom_hallucination_threshold_values={
|
|
344
334
|
"completeness": 0.7,
|
|
345
335
|
"instruction_adherence": 0.75,
|
|
346
336
|
},
|
|
337
|
+
web_search=True,
|
|
347
338
|
) as response:
|
|
348
339
|
print(response.headers.get("X-My-Header"))
|
|
349
340
|
|
|
@@ -3,30 +3,43 @@
|
|
|
3
3
|
Types:
|
|
4
4
|
|
|
5
5
|
```python
|
|
6
|
-
from deeprails.types import
|
|
6
|
+
from deeprails.types import (
|
|
7
|
+
DefendCreateResponse,
|
|
8
|
+
DefendResponse,
|
|
9
|
+
DefendUpdateResponse,
|
|
10
|
+
WorkflowEventDetailResponse,
|
|
11
|
+
WorkflowEventResponse,
|
|
12
|
+
)
|
|
7
13
|
```
|
|
8
14
|
|
|
9
15
|
Methods:
|
|
10
16
|
|
|
11
|
-
- <code title="post /defend">client.defend.<a href="./src/deeprails/resources/defend.py">create_workflow</a>(\*\*<a href="src/deeprails/types/defend_create_workflow_params.py">params</a>) -> <a href="./src/deeprails/types/
|
|
12
|
-
- <code title="get /defend/{workflow_id}/events/{event_id}">client.defend.<a href="./src/deeprails/resources/defend.py">retrieve_event</a>(event_id, \*, workflow_id) -> <a href="./src/deeprails/types/
|
|
13
|
-
- <code title="get /defend/{workflow_id}">client.defend.<a href="./src/deeprails/resources/defend.py">retrieve_workflow</a>(workflow_id) -> <a href="./src/deeprails/types/defend_response.py">DefendResponse</a></code>
|
|
17
|
+
- <code title="post /defend">client.defend.<a href="./src/deeprails/resources/defend.py">create_workflow</a>(\*\*<a href="src/deeprails/types/defend_create_workflow_params.py">params</a>) -> <a href="./src/deeprails/types/defend_create_response.py">DefendCreateResponse</a></code>
|
|
18
|
+
- <code title="get /defend/{workflow_id}/events/{event_id}">client.defend.<a href="./src/deeprails/resources/defend.py">retrieve_event</a>(event_id, \*, workflow_id) -> <a href="./src/deeprails/types/workflow_event_detail_response.py">WorkflowEventDetailResponse</a></code>
|
|
19
|
+
- <code title="get /defend/{workflow_id}">client.defend.<a href="./src/deeprails/resources/defend.py">retrieve_workflow</a>(workflow_id, \*\*<a href="src/deeprails/types/defend_retrieve_workflow_params.py">params</a>) -> <a href="./src/deeprails/types/defend_response.py">DefendResponse</a></code>
|
|
14
20
|
- <code title="post /defend/{workflow_id}/events">client.defend.<a href="./src/deeprails/resources/defend.py">submit_event</a>(workflow_id, \*\*<a href="src/deeprails/types/defend_submit_event_params.py">params</a>) -> <a href="./src/deeprails/types/workflow_event_response.py">WorkflowEventResponse</a></code>
|
|
15
|
-
- <code title="put /defend/{workflow_id}">client.defend.<a href="./src/deeprails/resources/defend.py">update_workflow</a>(workflow_id, \*\*<a href="src/deeprails/types/defend_update_workflow_params.py">params</a>) -> <a href="./src/deeprails/types/
|
|
21
|
+
- <code title="put /defend/{workflow_id}">client.defend.<a href="./src/deeprails/resources/defend.py">update_workflow</a>(workflow_id, \*\*<a href="src/deeprails/types/defend_update_workflow_params.py">params</a>) -> <a href="./src/deeprails/types/defend_update_response.py">DefendUpdateResponse</a></code>
|
|
16
22
|
|
|
17
23
|
# Monitor
|
|
18
24
|
|
|
19
25
|
Types:
|
|
20
26
|
|
|
21
27
|
```python
|
|
22
|
-
from deeprails.types import
|
|
28
|
+
from deeprails.types import (
|
|
29
|
+
MonitorCreateResponse,
|
|
30
|
+
MonitorDetailResponse,
|
|
31
|
+
MonitorEventDetailResponse,
|
|
32
|
+
MonitorEventResponse,
|
|
33
|
+
MonitorUpdateResponse,
|
|
34
|
+
)
|
|
23
35
|
```
|
|
24
36
|
|
|
25
37
|
Methods:
|
|
26
38
|
|
|
27
|
-
- <code title="post /monitor">client.monitor.<a href="./src/deeprails/resources/monitor.py">create</a>(\*\*<a href="src/deeprails/types/monitor_create_params.py">params</a>) -> <a href="./src/deeprails/types/
|
|
39
|
+
- <code title="post /monitor">client.monitor.<a href="./src/deeprails/resources/monitor.py">create</a>(\*\*<a href="src/deeprails/types/monitor_create_params.py">params</a>) -> <a href="./src/deeprails/types/monitor_create_response.py">MonitorCreateResponse</a></code>
|
|
28
40
|
- <code title="get /monitor/{monitor_id}">client.monitor.<a href="./src/deeprails/resources/monitor.py">retrieve</a>(monitor_id, \*\*<a href="src/deeprails/types/monitor_retrieve_params.py">params</a>) -> <a href="./src/deeprails/types/monitor_detail_response.py">MonitorDetailResponse</a></code>
|
|
29
|
-
- <code title="put /monitor/{monitor_id}">client.monitor.<a href="./src/deeprails/resources/monitor.py">update</a>(monitor_id, \*\*<a href="src/deeprails/types/monitor_update_params.py">params</a>) -> <a href="./src/deeprails/types/
|
|
41
|
+
- <code title="put /monitor/{monitor_id}">client.monitor.<a href="./src/deeprails/resources/monitor.py">update</a>(monitor_id, \*\*<a href="src/deeprails/types/monitor_update_params.py">params</a>) -> <a href="./src/deeprails/types/monitor_update_response.py">MonitorUpdateResponse</a></code>
|
|
42
|
+
- <code title="get /monitor/{monitor_id}/events/{event_id}">client.monitor.<a href="./src/deeprails/resources/monitor.py">retrieve_event</a>(event_id, \*, monitor_id) -> <a href="./src/deeprails/types/monitor_event_detail_response.py">MonitorEventDetailResponse</a></code>
|
|
30
43
|
- <code title="post /monitor/{monitor_id}/events">client.monitor.<a href="./src/deeprails/resources/monitor.py">submit_event</a>(monitor_id, \*\*<a href="src/deeprails/types/monitor_submit_event_params.py">params</a>) -> <a href="./src/deeprails/types/monitor_event_response.py">MonitorEventResponse</a></code>
|
|
31
44
|
|
|
32
45
|
# Files
|
|
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
|
|
|
34
34
|
if not is_file_content(obj):
|
|
35
35
|
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
|
|
36
36
|
raise RuntimeError(
|
|
37
|
-
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead.
|
|
37
|
+
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
|
|
38
38
|
) from None
|
|
39
39
|
|
|
40
40
|
|
|
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
|
|
|
133
133
|
# Type safe methods for narrowing types with TypeVars.
|
|
134
134
|
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
|
|
135
135
|
# however this cause Pyright to rightfully report errors. As we know we don't
|
|
136
|
-
# care about the contained types we can safely use `object` in
|
|
136
|
+
# care about the contained types we can safely use `object` in its place.
|
|
137
137
|
#
|
|
138
138
|
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
|
|
139
139
|
# `is_*` is for when you're dealing with an unknown input
|