deeprails 1.0.0__tar.gz → 1.3.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.
Potentially problematic release.
This version of deeprails might be problematic. Click here for more details.
- deeprails-1.3.0/.release-please-manifest.json +3 -0
- deeprails-1.3.0/CHANGELOG.md +44 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/CONTRIBUTING.md +2 -2
- {deeprails-1.0.0 → deeprails-1.3.0}/PKG-INFO +50 -223
- {deeprails-1.0.0 → deeprails-1.3.0}/README.md +44 -217
- {deeprails-1.0.0 → deeprails-1.3.0}/api.md +6 -17
- {deeprails-1.0.0 → deeprails-1.3.0}/pyproject.toml +5 -5
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/__init__.py +0 -2
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_client.py +13 -72
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_version.py +1 -1
- {deeprails-1.0.0/src/deeprails/resources/defend → deeprails-1.3.0/src/deeprails/resources}/defend.py +247 -62
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/resources/evaluate.py +6 -6
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/resources/monitor.py +20 -12
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/__init__.py +2 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/api_response.py +0 -1
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/defend_create_workflow_params.py +1 -1
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/defend_response.py +1 -1
- deeprails-1.0.0/src/deeprails/types/defend/event_submit_event_params.py → deeprails-1.3.0/src/deeprails/types/defend_submit_event_params.py +2 -2
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/defend_update_workflow_params.py +1 -4
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/monitor_retrieve_response.py +0 -1
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/monitor_submit_event_response.py +0 -1
- {deeprails-1.0.0/src/deeprails/types/defend → deeprails-1.3.0/src/deeprails/types}/workflow_event_response.py +1 -1
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/api_resources/test_defend.py +264 -3
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_client.py +0 -20
- deeprails-1.0.0/.release-please-manifest.json +0 -3
- deeprails-1.0.0/CHANGELOG.md +0 -10
- deeprails-1.0.0/src/deeprails/resources/defend/__init__.py +0 -33
- deeprails-1.0.0/src/deeprails/resources/defend/events.py +0 -311
- deeprails-1.0.0/src/deeprails/types/defend/__init__.py +0 -6
- deeprails-1.0.0/tests/api_resources/defend/__init__.py +0 -1
- deeprails-1.0.0/tests/api_resources/defend/test_events.py +0 -284
- {deeprails-1.0.0 → deeprails-1.3.0}/.gitignore +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/LICENSE +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/SECURITY.md +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/bin/check-release-environment +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/bin/publish-pypi +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/examples/.keep +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/noxfile.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/release-please-config.json +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/requirements-dev.lock +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/requirements.lock +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_base_client.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_compat.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_constants.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_exceptions.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_files.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_models.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_qs.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_resource.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_response.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_streaming.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_types.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/__init__.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_compat.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_datetime_parse.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_logs.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_proxy.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_reflection.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_resources_proxy.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_streams.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_sync.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_transform.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_typing.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/_utils/_utils.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/lib/.keep +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/py.typed +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/resources/__init__.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/evaluate_create_params.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/evaluation.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/monitor_create_params.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/monitor_retrieve_params.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/monitor_submit_event_params.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/src/deeprails/types/monitor_update_params.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/__init__.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/api_resources/__init__.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/api_resources/test_evaluate.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/api_resources/test_monitor.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/conftest.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/sample_file.txt +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_deepcopy.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_extract_files.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_files.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_models.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_qs.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_required_args.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_response.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_streaming.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_transform.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_utils/test_proxy.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/test_utils/test_typing.py +0 -0
- {deeprails-1.0.0 → deeprails-1.3.0}/tests/utils.py +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.3.0 (2025-10-08)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.2.0...v1.3.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.2.0...v1.3.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** adding code samples ([c7f7565](https://github.com/deeprails/deeprails-sdk-python/commit/c7f7565abd00233d22d9c11a5b2c977414e03439))
|
|
10
|
+
* **api:** manual updates ([145946a](https://github.com/deeprails/deeprails-sdk-python/commit/145946a049fb29bff01df6763248330f4d0030ad))
|
|
11
|
+
|
|
12
|
+
## 1.2.0 (2025-10-07)
|
|
13
|
+
|
|
14
|
+
Full Changelog: [v1.1.0...v1.2.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.1.0...v1.2.0)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **api:** manual updates ([db3e710](https://github.com/deeprails/deeprails-sdk-python/commit/db3e710d267ccf8d99aa214348846e20b6484db6))
|
|
19
|
+
|
|
20
|
+
## 1.1.0 (2025-10-07)
|
|
21
|
+
|
|
22
|
+
Full Changelog: [v1.0.0...v1.1.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.0.0...v1.1.0)
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **api:** manual updates ([e55683b](https://github.com/deeprails/deeprails-sdk-python/commit/e55683b590ff636e7c876a172c22c52c3208ceda))
|
|
27
|
+
* **api:** manual updates ([3309c85](https://github.com/deeprails/deeprails-sdk-python/commit/3309c859f9e67579bcd9d2f2d82ed7d67609dca8))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Chores
|
|
31
|
+
|
|
32
|
+
* update SDK settings ([9b65ba6](https://github.com/deeprails/deeprails-sdk-python/commit/9b65ba6e8675011f89f035d608a404d7c1d50453))
|
|
33
|
+
* update SDK settings ([957c361](https://github.com/deeprails/deeprails-sdk-python/commit/957c3611f3baf773270a491c66a28b8eeb66d671))
|
|
34
|
+
* update SDK settings ([3dcb5cb](https://github.com/deeprails/deeprails-sdk-python/commit/3dcb5cb41ee6c1008f66dace32125fd38626bdca))
|
|
35
|
+
* update SDK settings ([b283586](https://github.com/deeprails/deeprails-sdk-python/commit/b28358658ea8cbea0d2cb679343a9cf1c342fbd2))
|
|
36
|
+
|
|
37
|
+
## 1.0.0 (2025-10-07)
|
|
38
|
+
|
|
39
|
+
Full Changelog: [v0.0.1...v1.0.0](https://github.com/deeprails/deeprails-python-sdk/compare/v0.0.1...v1.0.0)
|
|
40
|
+
|
|
41
|
+
### Chores
|
|
42
|
+
|
|
43
|
+
* update SDK settings ([3dcb5cb](https://github.com/deeprails/deeprails-python-sdk/commit/3dcb5cb41ee6c1008f66dace32125fd38626bdca))
|
|
44
|
+
* update SDK settings ([b283586](https://github.com/deeprails/deeprails-python-sdk/commit/b28358658ea8cbea0d2cb679343a9cf1c342fbd2))
|
|
@@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
|
|
|
62
62
|
To install via git:
|
|
63
63
|
|
|
64
64
|
```sh
|
|
65
|
-
$ pip install git+ssh://git@github.com/deeprails/deeprails-python
|
|
65
|
+
$ pip install git+ssh://git@github.com/deeprails/deeprails-sdk-python.git
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
Alternatively, you can build from source and install the wheel file:
|
|
@@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
|
|
|
120
120
|
|
|
121
121
|
### Publish with a GitHub workflow
|
|
122
122
|
|
|
123
|
-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/deeprails/deeprails-python
|
|
123
|
+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/deeprails/deeprails-sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
|
|
124
124
|
|
|
125
125
|
### Publish manually
|
|
126
126
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: deeprails
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: The official Python library for the deeprails API
|
|
5
|
-
Project-URL: Homepage, https://
|
|
6
|
-
Project-URL: Repository, https://github.com/deeprails/deeprails-python
|
|
7
|
-
Author-email:
|
|
5
|
+
Project-URL: Homepage, https://docs.deeprails.com/
|
|
6
|
+
Project-URL: Repository, https://github.com/deeprails/deeprails-sdk-python
|
|
7
|
+
Author-email: DeepRails <support@deeprails.ai>
|
|
8
8
|
License: Apache-2.0
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -42,11 +42,9 @@ The Deeprails Python library provides convenient access to the Deeprails REST AP
|
|
|
42
42
|
application. The library includes type definitions for all request params and response fields,
|
|
43
43
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
44
44
|
|
|
45
|
-
It is generated with [Stainless](https://www.stainless.com/).
|
|
46
|
-
|
|
47
45
|
## Documentation
|
|
48
46
|
|
|
49
|
-
The full API of this library can be found in [api.md](https://github.com/deeprails/deeprails-python
|
|
47
|
+
The REST API documentation can be found on [docs.deeprails.com](https://docs.deeprails.com). The full API of this library can be found in [api.md](https://github.com/deeprails/deeprails-sdk-python/tree/main/api.md).
|
|
50
48
|
|
|
51
49
|
## Installation
|
|
52
50
|
|
|
@@ -57,7 +55,7 @@ pip install deeprails
|
|
|
57
55
|
|
|
58
56
|
## Usage
|
|
59
57
|
|
|
60
|
-
The full API of this library can be found in [api.md](https://github.com/deeprails/deeprails-python
|
|
58
|
+
The full API of this library can be found in [api.md](https://github.com/deeprails/deeprails-sdk-python/tree/main/api.md).
|
|
61
59
|
|
|
62
60
|
```python
|
|
63
61
|
import os
|
|
@@ -65,26 +63,16 @@ from deeprails import Deeprails
|
|
|
65
63
|
|
|
66
64
|
client = Deeprails(
|
|
67
65
|
api_key=os.environ.get("DEEPRAILS_API_KEY"), # This is the default and can be omitted
|
|
68
|
-
# defaults to "production".
|
|
69
|
-
environment="environment_1",
|
|
70
66
|
)
|
|
71
67
|
|
|
72
68
|
defend_response = client.defend.create_workflow(
|
|
73
|
-
improvement_action="
|
|
69
|
+
improvement_action="fixit",
|
|
74
70
|
metrics={
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"2": 0,
|
|
78
|
-
"3": 0,
|
|
79
|
-
"4": 0,
|
|
80
|
-
"5": 0,
|
|
81
|
-
"6": 0,
|
|
82
|
-
"7": 0,
|
|
83
|
-
"8": 0,
|
|
84
|
-
"9": 0,
|
|
71
|
+
"completeness": 0.8,
|
|
72
|
+
"instruction_adherence": 0.75,
|
|
85
73
|
},
|
|
86
|
-
name="
|
|
87
|
-
type="
|
|
74
|
+
name="Push Alert Workflow",
|
|
75
|
+
type="custom",
|
|
88
76
|
)
|
|
89
77
|
print(defend_response.workflow_id)
|
|
90
78
|
```
|
|
@@ -105,28 +93,18 @@ from deeprails import AsyncDeeprails
|
|
|
105
93
|
|
|
106
94
|
client = AsyncDeeprails(
|
|
107
95
|
api_key=os.environ.get("DEEPRAILS_API_KEY"), # This is the default and can be omitted
|
|
108
|
-
# defaults to "production".
|
|
109
|
-
environment="environment_1",
|
|
110
96
|
)
|
|
111
97
|
|
|
112
98
|
|
|
113
99
|
async def main() -> None:
|
|
114
100
|
defend_response = await client.defend.create_workflow(
|
|
115
|
-
improvement_action="
|
|
101
|
+
improvement_action="fixit",
|
|
116
102
|
metrics={
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"2": 0,
|
|
120
|
-
"3": 0,
|
|
121
|
-
"4": 0,
|
|
122
|
-
"5": 0,
|
|
123
|
-
"6": 0,
|
|
124
|
-
"7": 0,
|
|
125
|
-
"8": 0,
|
|
126
|
-
"9": 0,
|
|
103
|
+
"completeness": 0.8,
|
|
104
|
+
"instruction_adherence": 0.75,
|
|
127
105
|
},
|
|
128
|
-
name="
|
|
129
|
-
type="
|
|
106
|
+
name="Push Alert Workflow",
|
|
107
|
+
type="custom",
|
|
130
108
|
)
|
|
131
109
|
print(defend_response.workflow_id)
|
|
132
110
|
|
|
@@ -161,21 +139,13 @@ async def main() -> None:
|
|
|
161
139
|
http_client=DefaultAioHttpClient(),
|
|
162
140
|
) as client:
|
|
163
141
|
defend_response = await client.defend.create_workflow(
|
|
164
|
-
improvement_action="
|
|
142
|
+
improvement_action="fixit",
|
|
165
143
|
metrics={
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"2": 0,
|
|
169
|
-
"3": 0,
|
|
170
|
-
"4": 0,
|
|
171
|
-
"5": 0,
|
|
172
|
-
"6": 0,
|
|
173
|
-
"7": 0,
|
|
174
|
-
"8": 0,
|
|
175
|
-
"9": 0,
|
|
144
|
+
"completeness": 0.8,
|
|
145
|
+
"instruction_adherence": 0.75,
|
|
176
146
|
},
|
|
177
|
-
name="
|
|
178
|
-
type="
|
|
147
|
+
name="Push Alert Workflow",
|
|
148
|
+
type="custom",
|
|
179
149
|
)
|
|
180
150
|
print(defend_response.workflow_id)
|
|
181
151
|
|
|
@@ -201,7 +171,7 @@ from deeprails import Deeprails
|
|
|
201
171
|
|
|
202
172
|
client = Deeprails()
|
|
203
173
|
|
|
204
|
-
workflow_event_response = client.defend.
|
|
174
|
+
workflow_event_response = client.defend.submit_event(
|
|
205
175
|
workflow_id="workflow_id",
|
|
206
176
|
model_input={"user_prompt": "user_prompt"},
|
|
207
177
|
model_output="model_output",
|
|
@@ -229,21 +199,13 @@ client = Deeprails()
|
|
|
229
199
|
|
|
230
200
|
try:
|
|
231
201
|
client.defend.create_workflow(
|
|
232
|
-
improvement_action="
|
|
202
|
+
improvement_action="fixit",
|
|
233
203
|
metrics={
|
|
234
|
-
"
|
|
235
|
-
"
|
|
236
|
-
"2": 0,
|
|
237
|
-
"3": 0,
|
|
238
|
-
"4": 0,
|
|
239
|
-
"5": 0,
|
|
240
|
-
"6": 0,
|
|
241
|
-
"7": 0,
|
|
242
|
-
"8": 0,
|
|
243
|
-
"9": 0,
|
|
204
|
+
"completeness": 0.8,
|
|
205
|
+
"instruction_adherence": 0.75,
|
|
244
206
|
},
|
|
245
|
-
name="
|
|
246
|
-
type="
|
|
207
|
+
name="Push Alert Workflow",
|
|
208
|
+
type="custom",
|
|
247
209
|
)
|
|
248
210
|
except deeprails.APIConnectionError as e:
|
|
249
211
|
print("The server could not be reached")
|
|
@@ -288,21 +250,13 @@ client = Deeprails(
|
|
|
288
250
|
|
|
289
251
|
# Or, configure per-request:
|
|
290
252
|
client.with_options(max_retries=5).defend.create_workflow(
|
|
291
|
-
improvement_action="
|
|
253
|
+
improvement_action="fixit",
|
|
292
254
|
metrics={
|
|
293
|
-
"
|
|
294
|
-
"
|
|
295
|
-
"2": 0,
|
|
296
|
-
"3": 0,
|
|
297
|
-
"4": 0,
|
|
298
|
-
"5": 0,
|
|
299
|
-
"6": 0,
|
|
300
|
-
"7": 0,
|
|
301
|
-
"8": 0,
|
|
302
|
-
"9": 0,
|
|
255
|
+
"completeness": 0.8,
|
|
256
|
+
"instruction_adherence": 0.75,
|
|
303
257
|
},
|
|
304
|
-
name="
|
|
305
|
-
type="
|
|
258
|
+
name="Push Alert Workflow",
|
|
259
|
+
type="custom",
|
|
306
260
|
)
|
|
307
261
|
```
|
|
308
262
|
|
|
@@ -327,27 +281,19 @@ client = Deeprails(
|
|
|
327
281
|
|
|
328
282
|
# Override per-request:
|
|
329
283
|
client.with_options(timeout=5.0).defend.create_workflow(
|
|
330
|
-
improvement_action="
|
|
284
|
+
improvement_action="fixit",
|
|
331
285
|
metrics={
|
|
332
|
-
"
|
|
333
|
-
"
|
|
334
|
-
"2": 0,
|
|
335
|
-
"3": 0,
|
|
336
|
-
"4": 0,
|
|
337
|
-
"5": 0,
|
|
338
|
-
"6": 0,
|
|
339
|
-
"7": 0,
|
|
340
|
-
"8": 0,
|
|
341
|
-
"9": 0,
|
|
286
|
+
"completeness": 0.8,
|
|
287
|
+
"instruction_adherence": 0.75,
|
|
342
288
|
},
|
|
343
|
-
name="
|
|
344
|
-
type="
|
|
289
|
+
name="Push Alert Workflow",
|
|
290
|
+
type="custom",
|
|
345
291
|
)
|
|
346
292
|
```
|
|
347
293
|
|
|
348
294
|
On timeout, an `APITimeoutError` is thrown.
|
|
349
295
|
|
|
350
|
-
Note that requests that time out are [retried twice by default](https://github.com/deeprails/deeprails-python
|
|
296
|
+
Note that requests that time out are [retried twice by default](https://github.com/deeprails/deeprails-sdk-python/tree/main/#retries).
|
|
351
297
|
|
|
352
298
|
## Advanced
|
|
353
299
|
|
|
@@ -384,21 +330,13 @@ from deeprails import Deeprails
|
|
|
384
330
|
|
|
385
331
|
client = Deeprails()
|
|
386
332
|
response = client.defend.with_raw_response.create_workflow(
|
|
387
|
-
improvement_action="
|
|
333
|
+
improvement_action="fixit",
|
|
388
334
|
metrics={
|
|
389
|
-
"
|
|
390
|
-
"
|
|
391
|
-
"2": 0,
|
|
392
|
-
"3": 0,
|
|
393
|
-
"4": 0,
|
|
394
|
-
"5": 0,
|
|
395
|
-
"6": 0,
|
|
396
|
-
"7": 0,
|
|
397
|
-
"8": 0,
|
|
398
|
-
"9": 0,
|
|
335
|
+
"completeness": 0.8,
|
|
336
|
+
"instruction_adherence": 0.75,
|
|
399
337
|
},
|
|
400
|
-
name="
|
|
401
|
-
type="
|
|
338
|
+
name="Push Alert Workflow",
|
|
339
|
+
type="custom",
|
|
402
340
|
)
|
|
403
341
|
print(response.headers.get('X-My-Header'))
|
|
404
342
|
|
|
@@ -406,9 +344,9 @@ defend = response.parse() # get the object that `defend.create_workflow()` woul
|
|
|
406
344
|
print(defend.workflow_id)
|
|
407
345
|
```
|
|
408
346
|
|
|
409
|
-
These methods return an [`APIResponse`](https://github.com/deeprails/deeprails-python
|
|
347
|
+
These methods return an [`APIResponse`](https://github.com/deeprails/deeprails-sdk-python/tree/main/src/deeprails/_response.py) object.
|
|
410
348
|
|
|
411
|
-
The async client returns an [`AsyncAPIResponse`](https://github.com/deeprails/deeprails-python
|
|
349
|
+
The async client returns an [`AsyncAPIResponse`](https://github.com/deeprails/deeprails-sdk-python/tree/main/src/deeprails/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
|
|
412
350
|
|
|
413
351
|
#### `.with_streaming_response`
|
|
414
352
|
|
|
@@ -418,21 +356,13 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
418
356
|
|
|
419
357
|
```python
|
|
420
358
|
with client.defend.with_streaming_response.create_workflow(
|
|
421
|
-
improvement_action="
|
|
359
|
+
improvement_action="fixit",
|
|
422
360
|
metrics={
|
|
423
|
-
"
|
|
424
|
-
"
|
|
425
|
-
"2": 0,
|
|
426
|
-
"3": 0,
|
|
427
|
-
"4": 0,
|
|
428
|
-
"5": 0,
|
|
429
|
-
"6": 0,
|
|
430
|
-
"7": 0,
|
|
431
|
-
"8": 0,
|
|
432
|
-
"9": 0,
|
|
361
|
+
"completeness": 0.8,
|
|
362
|
+
"instruction_adherence": 0.75,
|
|
433
363
|
},
|
|
434
|
-
name="
|
|
435
|
-
type="
|
|
364
|
+
name="Push Alert Workflow",
|
|
365
|
+
type="custom",
|
|
436
366
|
) as response:
|
|
437
367
|
print(response.headers.get("X-My-Header"))
|
|
438
368
|
|
|
@@ -442,109 +372,6 @@ with client.defend.with_streaming_response.create_workflow(
|
|
|
442
372
|
|
|
443
373
|
The context manager is required so that the response will reliably be closed.
|
|
444
374
|
|
|
445
|
-
### Making custom/undocumented requests
|
|
446
|
-
|
|
447
|
-
This library is typed for convenient access to the documented API.
|
|
448
|
-
|
|
449
|
-
If you need to access undocumented endpoints, params, or response properties, the library can still be used.
|
|
450
|
-
|
|
451
|
-
#### Undocumented endpoints
|
|
452
|
-
|
|
453
|
-
To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
|
|
454
|
-
http verbs. Options on the client will be respected (such as retries) when making this request.
|
|
455
|
-
|
|
456
|
-
```py
|
|
457
|
-
import httpx
|
|
458
|
-
|
|
459
|
-
response = client.post(
|
|
460
|
-
"/foo",
|
|
461
|
-
cast_to=httpx.Response,
|
|
462
|
-
body={"my_param": True},
|
|
463
|
-
)
|
|
464
|
-
|
|
465
|
-
print(response.headers.get("x-foo"))
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
#### Undocumented request params
|
|
469
|
-
|
|
470
|
-
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
|
|
471
|
-
options.
|
|
472
|
-
|
|
473
|
-
#### Undocumented response properties
|
|
474
|
-
|
|
475
|
-
To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
|
|
476
|
-
can also get all the extra fields on the Pydantic model as a dict with
|
|
477
|
-
[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
|
|
478
|
-
|
|
479
|
-
### Configuring the HTTP client
|
|
480
|
-
|
|
481
|
-
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
|
|
482
|
-
|
|
483
|
-
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
|
|
484
|
-
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
|
|
485
|
-
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
|
|
486
|
-
|
|
487
|
-
```python
|
|
488
|
-
import httpx
|
|
489
|
-
from deeprails import Deeprails, DefaultHttpxClient
|
|
490
|
-
|
|
491
|
-
client = Deeprails(
|
|
492
|
-
# Or use the `DEEPRAILS_BASE_URL` env var
|
|
493
|
-
base_url="http://my.test.server.example.com:8083",
|
|
494
|
-
http_client=DefaultHttpxClient(
|
|
495
|
-
proxy="http://my.test.proxy.example.com",
|
|
496
|
-
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
497
|
-
),
|
|
498
|
-
)
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
You can also customize the client on a per-request basis by using `with_options()`:
|
|
502
|
-
|
|
503
|
-
```python
|
|
504
|
-
client.with_options(http_client=DefaultHttpxClient(...))
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
### Managing HTTP resources
|
|
508
|
-
|
|
509
|
-
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
|
510
|
-
|
|
511
|
-
```py
|
|
512
|
-
from deeprails import Deeprails
|
|
513
|
-
|
|
514
|
-
with Deeprails() as client:
|
|
515
|
-
# make requests here
|
|
516
|
-
...
|
|
517
|
-
|
|
518
|
-
# HTTP client is now closed
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
## Versioning
|
|
522
|
-
|
|
523
|
-
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
524
|
-
|
|
525
|
-
1. Changes that only affect static types, without breaking runtime behavior.
|
|
526
|
-
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
527
|
-
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
528
|
-
|
|
529
|
-
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
530
|
-
|
|
531
|
-
We are keen for your feedback; please open an [issue](https://www.github.com/deeprails/deeprails-python-sdk/issues) with questions, bugs, or suggestions.
|
|
532
|
-
|
|
533
|
-
### Determining the installed version
|
|
534
|
-
|
|
535
|
-
If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
|
|
536
|
-
|
|
537
|
-
You can determine the version that is being used at runtime with:
|
|
538
|
-
|
|
539
|
-
```py
|
|
540
|
-
import deeprails
|
|
541
|
-
print(deeprails.__version__)
|
|
542
|
-
```
|
|
543
|
-
|
|
544
375
|
## Requirements
|
|
545
376
|
|
|
546
377
|
Python 3.8 or higher.
|
|
547
|
-
|
|
548
|
-
## Contributing
|
|
549
|
-
|
|
550
|
-
See [the contributing documentation](https://github.com/deeprails/deeprails-python-sdk/tree/main/./CONTRIBUTING.md).
|