circuit-breaker-labs 1.0.4__py3-none-any.whl → 1.0.6__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.
- circuit_breaker_labs/api/api_keys/monthly_quota_get.py +12 -12
- circuit_breaker_labs/api/evaluations/{evaluate_system_prompt_post.py → multi_turn_evaluate_system_prompt_post.py} +96 -39
- circuit_breaker_labs/api/evaluations/{evaluate_openai_fine_tune_post.py → multiturn_evaluate_openai_fine_tune_post.py} +96 -39
- circuit_breaker_labs/api/evaluations/single_turn_evaluate_openai_fine_tune_post.py +300 -0
- circuit_breaker_labs/api/evaluations/singleturn_evaluate_system_prompt_post.py +257 -0
- circuit_breaker_labs/models/__init__.py +36 -8
- circuit_breaker_labs/models/internal_server_error.py +73 -0
- circuit_breaker_labs/models/internal_server_error_response.py +69 -0
- circuit_breaker_labs/models/message.py +71 -0
- circuit_breaker_labs/models/multi_turn_evaluate_open_ai_finetune_request.py +119 -0
- circuit_breaker_labs/models/multi_turn_evaluate_system_prompt_request.py +128 -0
- circuit_breaker_labs/models/multi_turn_failed_test_result.py +85 -0
- circuit_breaker_labs/models/multi_turn_run_tests_response.py +92 -0
- circuit_breaker_labs/models/multi_turn_test_type.py +9 -0
- circuit_breaker_labs/models/not_found_error.py +73 -0
- circuit_breaker_labs/models/not_found_response.py +69 -0
- circuit_breaker_labs/models/quota_exceeded_response.py +69 -0
- circuit_breaker_labs/models/role.py +10 -0
- circuit_breaker_labs/models/{evaluate_open_ai_finetune_request.py → single_turn_evaluate_open_ai_finetune_request.py} +30 -5
- circuit_breaker_labs/models/{evaluate_system_prompt_request.py → single_turn_evaluate_system_prompt_request.py} +30 -5
- circuit_breaker_labs/models/{failed_test_result.py → single_turn_failed_test_result.py} +5 -5
- circuit_breaker_labs/models/{run_tests_response.py → single_turn_run_tests_response.py} +10 -10
- circuit_breaker_labs/models/test_case_pack.py +8 -0
- circuit_breaker_labs/models/unauthorized_response.py +69 -0
- {circuit_breaker_labs-1.0.4.dist-info → circuit_breaker_labs-1.0.6.dist-info}/METADATA +33 -21
- circuit_breaker_labs-1.0.6.dist-info/RECORD +47 -0
- {circuit_breaker_labs-1.0.4.dist-info → circuit_breaker_labs-1.0.6.dist-info}/WHEEL +1 -1
- circuit_breaker_labs-1.0.4.dist-info/RECORD +0 -31
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
+
from ...models.internal_server_error_response import InternalServerErrorResponse
|
|
10
|
+
from ...models.not_found_response import NotFoundResponse
|
|
11
|
+
from ...models.quota_exceeded_response import QuotaExceededResponse
|
|
12
|
+
from ...models.single_turn_evaluate_open_ai_finetune_request import SingleTurnEvaluateOpenAiFinetuneRequest
|
|
13
|
+
from ...models.single_turn_run_tests_response import SingleTurnRunTestsResponse
|
|
14
|
+
from ...models.unauthorized_response import UnauthorizedResponse
|
|
15
|
+
from ...types import Response
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
body: SingleTurnEvaluateOpenAiFinetuneRequest,
|
|
21
|
+
cbl_api_key: str,
|
|
22
|
+
openai_api_key: str,
|
|
23
|
+
) -> dict[str, Any]:
|
|
24
|
+
headers: dict[str, Any] = {}
|
|
25
|
+
headers["cbl-api-key"] = cbl_api_key
|
|
26
|
+
|
|
27
|
+
headers["openai-api-key"] = openai_api_key
|
|
28
|
+
|
|
29
|
+
_kwargs: dict[str, Any] = {
|
|
30
|
+
"method": "post",
|
|
31
|
+
"url": "/singleturn_evaluate_openai_finetune",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_kwargs["json"] = body.to_dict()
|
|
35
|
+
|
|
36
|
+
headers["Content-Type"] = "application/json"
|
|
37
|
+
|
|
38
|
+
_kwargs["headers"] = headers
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> (
|
|
45
|
+
HTTPValidationError
|
|
46
|
+
| InternalServerErrorResponse
|
|
47
|
+
| NotFoundResponse
|
|
48
|
+
| QuotaExceededResponse
|
|
49
|
+
| SingleTurnRunTestsResponse
|
|
50
|
+
| UnauthorizedResponse
|
|
51
|
+
| None
|
|
52
|
+
):
|
|
53
|
+
if response.status_code == 200:
|
|
54
|
+
response_200 = SingleTurnRunTestsResponse.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_200
|
|
57
|
+
|
|
58
|
+
if response.status_code == 401:
|
|
59
|
+
response_401 = UnauthorizedResponse.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
return response_401
|
|
62
|
+
|
|
63
|
+
if response.status_code == 403:
|
|
64
|
+
response_403 = QuotaExceededResponse.from_dict(response.json())
|
|
65
|
+
|
|
66
|
+
return response_403
|
|
67
|
+
|
|
68
|
+
if response.status_code == 404:
|
|
69
|
+
response_404 = NotFoundResponse.from_dict(response.json())
|
|
70
|
+
|
|
71
|
+
return response_404
|
|
72
|
+
|
|
73
|
+
if response.status_code == 422:
|
|
74
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
75
|
+
|
|
76
|
+
return response_422
|
|
77
|
+
|
|
78
|
+
if response.status_code == 500:
|
|
79
|
+
response_500 = InternalServerErrorResponse.from_dict(response.json())
|
|
80
|
+
|
|
81
|
+
return response_500
|
|
82
|
+
|
|
83
|
+
if client.raise_on_unexpected_status:
|
|
84
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
85
|
+
else:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _build_response(
|
|
90
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
91
|
+
) -> Response[
|
|
92
|
+
HTTPValidationError
|
|
93
|
+
| InternalServerErrorResponse
|
|
94
|
+
| NotFoundResponse
|
|
95
|
+
| QuotaExceededResponse
|
|
96
|
+
| SingleTurnRunTestsResponse
|
|
97
|
+
| UnauthorizedResponse
|
|
98
|
+
]:
|
|
99
|
+
return Response(
|
|
100
|
+
status_code=HTTPStatus(response.status_code),
|
|
101
|
+
content=response.content,
|
|
102
|
+
headers=response.headers,
|
|
103
|
+
parsed=_parse_response(client=client, response=response),
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def sync_detailed(
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient | Client,
|
|
110
|
+
body: SingleTurnEvaluateOpenAiFinetuneRequest,
|
|
111
|
+
cbl_api_key: str,
|
|
112
|
+
openai_api_key: str,
|
|
113
|
+
) -> Response[
|
|
114
|
+
HTTPValidationError
|
|
115
|
+
| InternalServerErrorResponse
|
|
116
|
+
| NotFoundResponse
|
|
117
|
+
| QuotaExceededResponse
|
|
118
|
+
| SingleTurnRunTestsResponse
|
|
119
|
+
| UnauthorizedResponse
|
|
120
|
+
]:
|
|
121
|
+
"""Single-turn Evaluate OpenAI Fine Tune
|
|
122
|
+
|
|
123
|
+
Run single-turn safety tests against an OpenAI fine-tuned model.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
127
|
+
openai_api_key (str):
|
|
128
|
+
The OpenAI API Key owned by a [service account](https://platform.openai.com/docs/api-
|
|
129
|
+
reference/project-service-accounts) within the same project as the finetuned model. The
|
|
130
|
+
API key should minimally have 'Request' permissions for 'Model Capabilities'.
|
|
131
|
+
|
|
132
|
+
You can create a new API key associated with a service account and project
|
|
133
|
+
[here](https://platform.openai.com/api-keys).
|
|
134
|
+
|
|
135
|
+
body (SingleTurnEvaluateOpenAiFinetuneRequest):
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Response[HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse]
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
kwargs = _get_kwargs(
|
|
146
|
+
body=body,
|
|
147
|
+
cbl_api_key=cbl_api_key,
|
|
148
|
+
openai_api_key=openai_api_key,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
response = client.get_httpx_client().request(
|
|
152
|
+
**kwargs,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
return _build_response(client=client, response=response)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def sync(
|
|
159
|
+
*,
|
|
160
|
+
client: AuthenticatedClient | Client,
|
|
161
|
+
body: SingleTurnEvaluateOpenAiFinetuneRequest,
|
|
162
|
+
cbl_api_key: str,
|
|
163
|
+
openai_api_key: str,
|
|
164
|
+
) -> (
|
|
165
|
+
HTTPValidationError
|
|
166
|
+
| InternalServerErrorResponse
|
|
167
|
+
| NotFoundResponse
|
|
168
|
+
| QuotaExceededResponse
|
|
169
|
+
| SingleTurnRunTestsResponse
|
|
170
|
+
| UnauthorizedResponse
|
|
171
|
+
| None
|
|
172
|
+
):
|
|
173
|
+
"""Single-turn Evaluate OpenAI Fine Tune
|
|
174
|
+
|
|
175
|
+
Run single-turn safety tests against an OpenAI fine-tuned model.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
179
|
+
openai_api_key (str):
|
|
180
|
+
The OpenAI API Key owned by a [service account](https://platform.openai.com/docs/api-
|
|
181
|
+
reference/project-service-accounts) within the same project as the finetuned model. The
|
|
182
|
+
API key should minimally have 'Request' permissions for 'Model Capabilities'.
|
|
183
|
+
|
|
184
|
+
You can create a new API key associated with a service account and project
|
|
185
|
+
[here](https://platform.openai.com/api-keys).
|
|
186
|
+
|
|
187
|
+
body (SingleTurnEvaluateOpenAiFinetuneRequest):
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
191
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
return sync_detailed(
|
|
198
|
+
client=client,
|
|
199
|
+
body=body,
|
|
200
|
+
cbl_api_key=cbl_api_key,
|
|
201
|
+
openai_api_key=openai_api_key,
|
|
202
|
+
).parsed
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
async def asyncio_detailed(
|
|
206
|
+
*,
|
|
207
|
+
client: AuthenticatedClient | Client,
|
|
208
|
+
body: SingleTurnEvaluateOpenAiFinetuneRequest,
|
|
209
|
+
cbl_api_key: str,
|
|
210
|
+
openai_api_key: str,
|
|
211
|
+
) -> Response[
|
|
212
|
+
HTTPValidationError
|
|
213
|
+
| InternalServerErrorResponse
|
|
214
|
+
| NotFoundResponse
|
|
215
|
+
| QuotaExceededResponse
|
|
216
|
+
| SingleTurnRunTestsResponse
|
|
217
|
+
| UnauthorizedResponse
|
|
218
|
+
]:
|
|
219
|
+
"""Single-turn Evaluate OpenAI Fine Tune
|
|
220
|
+
|
|
221
|
+
Run single-turn safety tests against an OpenAI fine-tuned model.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
225
|
+
openai_api_key (str):
|
|
226
|
+
The OpenAI API Key owned by a [service account](https://platform.openai.com/docs/api-
|
|
227
|
+
reference/project-service-accounts) within the same project as the finetuned model. The
|
|
228
|
+
API key should minimally have 'Request' permissions for 'Model Capabilities'.
|
|
229
|
+
|
|
230
|
+
You can create a new API key associated with a service account and project
|
|
231
|
+
[here](https://platform.openai.com/api-keys).
|
|
232
|
+
|
|
233
|
+
body (SingleTurnEvaluateOpenAiFinetuneRequest):
|
|
234
|
+
|
|
235
|
+
Raises:
|
|
236
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
237
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
Response[HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse]
|
|
241
|
+
"""
|
|
242
|
+
|
|
243
|
+
kwargs = _get_kwargs(
|
|
244
|
+
body=body,
|
|
245
|
+
cbl_api_key=cbl_api_key,
|
|
246
|
+
openai_api_key=openai_api_key,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
250
|
+
|
|
251
|
+
return _build_response(client=client, response=response)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
async def asyncio(
|
|
255
|
+
*,
|
|
256
|
+
client: AuthenticatedClient | Client,
|
|
257
|
+
body: SingleTurnEvaluateOpenAiFinetuneRequest,
|
|
258
|
+
cbl_api_key: str,
|
|
259
|
+
openai_api_key: str,
|
|
260
|
+
) -> (
|
|
261
|
+
HTTPValidationError
|
|
262
|
+
| InternalServerErrorResponse
|
|
263
|
+
| NotFoundResponse
|
|
264
|
+
| QuotaExceededResponse
|
|
265
|
+
| SingleTurnRunTestsResponse
|
|
266
|
+
| UnauthorizedResponse
|
|
267
|
+
| None
|
|
268
|
+
):
|
|
269
|
+
"""Single-turn Evaluate OpenAI Fine Tune
|
|
270
|
+
|
|
271
|
+
Run single-turn safety tests against an OpenAI fine-tuned model.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
275
|
+
openai_api_key (str):
|
|
276
|
+
The OpenAI API Key owned by a [service account](https://platform.openai.com/docs/api-
|
|
277
|
+
reference/project-service-accounts) within the same project as the finetuned model. The
|
|
278
|
+
API key should minimally have 'Request' permissions for 'Model Capabilities'.
|
|
279
|
+
|
|
280
|
+
You can create a new API key associated with a service account and project
|
|
281
|
+
[here](https://platform.openai.com/api-keys).
|
|
282
|
+
|
|
283
|
+
body (SingleTurnEvaluateOpenAiFinetuneRequest):
|
|
284
|
+
|
|
285
|
+
Raises:
|
|
286
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
287
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse
|
|
291
|
+
"""
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
await asyncio_detailed(
|
|
295
|
+
client=client,
|
|
296
|
+
body=body,
|
|
297
|
+
cbl_api_key=cbl_api_key,
|
|
298
|
+
openai_api_key=openai_api_key,
|
|
299
|
+
)
|
|
300
|
+
).parsed
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
+
from ...models.internal_server_error_response import InternalServerErrorResponse
|
|
10
|
+
from ...models.not_found_response import NotFoundResponse
|
|
11
|
+
from ...models.quota_exceeded_response import QuotaExceededResponse
|
|
12
|
+
from ...models.single_turn_evaluate_system_prompt_request import SingleTurnEvaluateSystemPromptRequest
|
|
13
|
+
from ...models.single_turn_run_tests_response import SingleTurnRunTestsResponse
|
|
14
|
+
from ...models.unauthorized_response import UnauthorizedResponse
|
|
15
|
+
from ...types import Response
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
body: SingleTurnEvaluateSystemPromptRequest,
|
|
21
|
+
cbl_api_key: str,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
headers["cbl-api-key"] = cbl_api_key
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "post",
|
|
28
|
+
"url": "/singleturn_evaluate_system_prompt",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_kwargs["json"] = body.to_dict()
|
|
32
|
+
|
|
33
|
+
headers["Content-Type"] = "application/json"
|
|
34
|
+
|
|
35
|
+
_kwargs["headers"] = headers
|
|
36
|
+
return _kwargs
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _parse_response(
|
|
40
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
41
|
+
) -> (
|
|
42
|
+
HTTPValidationError
|
|
43
|
+
| InternalServerErrorResponse
|
|
44
|
+
| NotFoundResponse
|
|
45
|
+
| QuotaExceededResponse
|
|
46
|
+
| SingleTurnRunTestsResponse
|
|
47
|
+
| UnauthorizedResponse
|
|
48
|
+
| None
|
|
49
|
+
):
|
|
50
|
+
if response.status_code == 200:
|
|
51
|
+
response_200 = SingleTurnRunTestsResponse.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_200
|
|
54
|
+
|
|
55
|
+
if response.status_code == 401:
|
|
56
|
+
response_401 = UnauthorizedResponse.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_401
|
|
59
|
+
|
|
60
|
+
if response.status_code == 403:
|
|
61
|
+
response_403 = QuotaExceededResponse.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
return response_403
|
|
64
|
+
|
|
65
|
+
if response.status_code == 404:
|
|
66
|
+
response_404 = NotFoundResponse.from_dict(response.json())
|
|
67
|
+
|
|
68
|
+
return response_404
|
|
69
|
+
|
|
70
|
+
if response.status_code == 422:
|
|
71
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
72
|
+
|
|
73
|
+
return response_422
|
|
74
|
+
|
|
75
|
+
if response.status_code == 500:
|
|
76
|
+
response_500 = InternalServerErrorResponse.from_dict(response.json())
|
|
77
|
+
|
|
78
|
+
return response_500
|
|
79
|
+
|
|
80
|
+
if client.raise_on_unexpected_status:
|
|
81
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
82
|
+
else:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _build_response(
|
|
87
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
88
|
+
) -> Response[
|
|
89
|
+
HTTPValidationError
|
|
90
|
+
| InternalServerErrorResponse
|
|
91
|
+
| NotFoundResponse
|
|
92
|
+
| QuotaExceededResponse
|
|
93
|
+
| SingleTurnRunTestsResponse
|
|
94
|
+
| UnauthorizedResponse
|
|
95
|
+
]:
|
|
96
|
+
return Response(
|
|
97
|
+
status_code=HTTPStatus(response.status_code),
|
|
98
|
+
content=response.content,
|
|
99
|
+
headers=response.headers,
|
|
100
|
+
parsed=_parse_response(client=client, response=response),
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def sync_detailed(
|
|
105
|
+
*,
|
|
106
|
+
client: AuthenticatedClient | Client,
|
|
107
|
+
body: SingleTurnEvaluateSystemPromptRequest,
|
|
108
|
+
cbl_api_key: str,
|
|
109
|
+
) -> Response[
|
|
110
|
+
HTTPValidationError
|
|
111
|
+
| InternalServerErrorResponse
|
|
112
|
+
| NotFoundResponse
|
|
113
|
+
| QuotaExceededResponse
|
|
114
|
+
| SingleTurnRunTestsResponse
|
|
115
|
+
| UnauthorizedResponse
|
|
116
|
+
]:
|
|
117
|
+
"""Single-turn Evaluate System Prompt
|
|
118
|
+
|
|
119
|
+
Run single-turn safety tests against a system prompt.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
123
|
+
body (SingleTurnEvaluateSystemPromptRequest):
|
|
124
|
+
|
|
125
|
+
Raises:
|
|
126
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
127
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Response[HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse]
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
kwargs = _get_kwargs(
|
|
134
|
+
body=body,
|
|
135
|
+
cbl_api_key=cbl_api_key,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
response = client.get_httpx_client().request(
|
|
139
|
+
**kwargs,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
return _build_response(client=client, response=response)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def sync(
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient | Client,
|
|
148
|
+
body: SingleTurnEvaluateSystemPromptRequest,
|
|
149
|
+
cbl_api_key: str,
|
|
150
|
+
) -> (
|
|
151
|
+
HTTPValidationError
|
|
152
|
+
| InternalServerErrorResponse
|
|
153
|
+
| NotFoundResponse
|
|
154
|
+
| QuotaExceededResponse
|
|
155
|
+
| SingleTurnRunTestsResponse
|
|
156
|
+
| UnauthorizedResponse
|
|
157
|
+
| None
|
|
158
|
+
):
|
|
159
|
+
"""Single-turn Evaluate System Prompt
|
|
160
|
+
|
|
161
|
+
Run single-turn safety tests against a system prompt.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
165
|
+
body (SingleTurnEvaluateSystemPromptRequest):
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
return sync_detailed(
|
|
176
|
+
client=client,
|
|
177
|
+
body=body,
|
|
178
|
+
cbl_api_key=cbl_api_key,
|
|
179
|
+
).parsed
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
async def asyncio_detailed(
|
|
183
|
+
*,
|
|
184
|
+
client: AuthenticatedClient | Client,
|
|
185
|
+
body: SingleTurnEvaluateSystemPromptRequest,
|
|
186
|
+
cbl_api_key: str,
|
|
187
|
+
) -> Response[
|
|
188
|
+
HTTPValidationError
|
|
189
|
+
| InternalServerErrorResponse
|
|
190
|
+
| NotFoundResponse
|
|
191
|
+
| QuotaExceededResponse
|
|
192
|
+
| SingleTurnRunTestsResponse
|
|
193
|
+
| UnauthorizedResponse
|
|
194
|
+
]:
|
|
195
|
+
"""Single-turn Evaluate System Prompt
|
|
196
|
+
|
|
197
|
+
Run single-turn safety tests against a system prompt.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
201
|
+
body (SingleTurnEvaluateSystemPromptRequest):
|
|
202
|
+
|
|
203
|
+
Raises:
|
|
204
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
205
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
Response[HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse]
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
kwargs = _get_kwargs(
|
|
212
|
+
body=body,
|
|
213
|
+
cbl_api_key=cbl_api_key,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
217
|
+
|
|
218
|
+
return _build_response(client=client, response=response)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
async def asyncio(
|
|
222
|
+
*,
|
|
223
|
+
client: AuthenticatedClient | Client,
|
|
224
|
+
body: SingleTurnEvaluateSystemPromptRequest,
|
|
225
|
+
cbl_api_key: str,
|
|
226
|
+
) -> (
|
|
227
|
+
HTTPValidationError
|
|
228
|
+
| InternalServerErrorResponse
|
|
229
|
+
| NotFoundResponse
|
|
230
|
+
| QuotaExceededResponse
|
|
231
|
+
| SingleTurnRunTestsResponse
|
|
232
|
+
| UnauthorizedResponse
|
|
233
|
+
| None
|
|
234
|
+
):
|
|
235
|
+
"""Single-turn Evaluate System Prompt
|
|
236
|
+
|
|
237
|
+
Run single-turn safety tests against a system prompt.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
cbl_api_key (str): Circuit Breaker Labs API Key
|
|
241
|
+
body (SingleTurnEvaluateSystemPromptRequest):
|
|
242
|
+
|
|
243
|
+
Raises:
|
|
244
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
245
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
246
|
+
|
|
247
|
+
Returns:
|
|
248
|
+
HTTPValidationError | InternalServerErrorResponse | NotFoundResponse | QuotaExceededResponse | SingleTurnRunTestsResponse | UnauthorizedResponse
|
|
249
|
+
"""
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
await asyncio_detailed(
|
|
253
|
+
client=client,
|
|
254
|
+
body=body,
|
|
255
|
+
cbl_api_key=cbl_api_key,
|
|
256
|
+
)
|
|
257
|
+
).parsed
|
|
@@ -1,28 +1,56 @@
|
|
|
1
1
|
"""Contains all the data models used in inputs/outputs"""
|
|
2
2
|
|
|
3
|
-
from .evaluate_open_ai_finetune_request import EvaluateOpenAiFinetuneRequest
|
|
4
|
-
from .evaluate_system_prompt_request import EvaluateSystemPromptRequest
|
|
5
|
-
from .failed_test_result import FailedTestResult
|
|
6
3
|
from .http_validation_error import HTTPValidationError
|
|
4
|
+
from .internal_server_error import InternalServerError
|
|
5
|
+
from .internal_server_error_response import InternalServerErrorResponse
|
|
6
|
+
from .message import Message
|
|
7
7
|
from .monthly_quota_response import MonthlyQuotaResponse
|
|
8
|
+
from .multi_turn_evaluate_open_ai_finetune_request import MultiTurnEvaluateOpenAiFinetuneRequest
|
|
9
|
+
from .multi_turn_evaluate_system_prompt_request import MultiTurnEvaluateSystemPromptRequest
|
|
10
|
+
from .multi_turn_failed_test_result import MultiTurnFailedTestResult
|
|
11
|
+
from .multi_turn_run_tests_response import MultiTurnRunTestsResponse
|
|
12
|
+
from .multi_turn_test_type import MultiTurnTestType
|
|
13
|
+
from .not_found_error import NotFoundError
|
|
14
|
+
from .not_found_response import NotFoundResponse
|
|
8
15
|
from .ping_response import PingResponse
|
|
9
16
|
from .quota_exceeded_error import QuotaExceededError
|
|
10
|
-
from .
|
|
17
|
+
from .quota_exceeded_response import QuotaExceededResponse
|
|
18
|
+
from .role import Role
|
|
19
|
+
from .single_turn_evaluate_open_ai_finetune_request import SingleTurnEvaluateOpenAiFinetuneRequest
|
|
20
|
+
from .single_turn_evaluate_system_prompt_request import SingleTurnEvaluateSystemPromptRequest
|
|
21
|
+
from .single_turn_failed_test_result import SingleTurnFailedTestResult
|
|
22
|
+
from .single_turn_run_tests_response import SingleTurnRunTestsResponse
|
|
23
|
+
from .test_case_pack import TestCasePack
|
|
11
24
|
from .unauthorized_error import UnauthorizedError
|
|
25
|
+
from .unauthorized_response import UnauthorizedResponse
|
|
12
26
|
from .validate_api_key_response import ValidateApiKeyResponse
|
|
13
27
|
from .validation_error import ValidationError
|
|
14
28
|
from .version_response import VersionResponse
|
|
15
29
|
|
|
16
30
|
__all__ = (
|
|
17
|
-
"EvaluateOpenAiFinetuneRequest",
|
|
18
|
-
"EvaluateSystemPromptRequest",
|
|
19
|
-
"FailedTestResult",
|
|
20
31
|
"HTTPValidationError",
|
|
32
|
+
"InternalServerError",
|
|
33
|
+
"InternalServerErrorResponse",
|
|
34
|
+
"Message",
|
|
21
35
|
"MonthlyQuotaResponse",
|
|
36
|
+
"MultiTurnEvaluateOpenAiFinetuneRequest",
|
|
37
|
+
"MultiTurnEvaluateSystemPromptRequest",
|
|
38
|
+
"MultiTurnFailedTestResult",
|
|
39
|
+
"MultiTurnRunTestsResponse",
|
|
40
|
+
"MultiTurnTestType",
|
|
41
|
+
"NotFoundError",
|
|
42
|
+
"NotFoundResponse",
|
|
22
43
|
"PingResponse",
|
|
23
44
|
"QuotaExceededError",
|
|
24
|
-
"
|
|
45
|
+
"QuotaExceededResponse",
|
|
46
|
+
"Role",
|
|
47
|
+
"SingleTurnEvaluateOpenAiFinetuneRequest",
|
|
48
|
+
"SingleTurnEvaluateSystemPromptRequest",
|
|
49
|
+
"SingleTurnFailedTestResult",
|
|
50
|
+
"SingleTurnRunTestsResponse",
|
|
51
|
+
"TestCasePack",
|
|
25
52
|
"UnauthorizedError",
|
|
53
|
+
"UnauthorizedResponse",
|
|
26
54
|
"ValidateApiKeyResponse",
|
|
27
55
|
"ValidationError",
|
|
28
56
|
"VersionResponse",
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="InternalServerError")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class InternalServerError:
|
|
16
|
+
"""500 Internal Server Error response.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
message (str):
|
|
20
|
+
error (str | Unset): Default: 'internal_server_error'.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
message: str
|
|
24
|
+
error: str | Unset = "internal_server_error"
|
|
25
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
26
|
+
|
|
27
|
+
def to_dict(self) -> dict[str, Any]:
|
|
28
|
+
message = self.message
|
|
29
|
+
|
|
30
|
+
error = self.error
|
|
31
|
+
|
|
32
|
+
field_dict: dict[str, Any] = {}
|
|
33
|
+
field_dict.update(self.additional_properties)
|
|
34
|
+
field_dict.update(
|
|
35
|
+
{
|
|
36
|
+
"message": message,
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
if error is not UNSET:
|
|
40
|
+
field_dict["error"] = error
|
|
41
|
+
|
|
42
|
+
return field_dict
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
46
|
+
d = dict(src_dict)
|
|
47
|
+
message = d.pop("message")
|
|
48
|
+
|
|
49
|
+
error = d.pop("error", UNSET)
|
|
50
|
+
|
|
51
|
+
internal_server_error = cls(
|
|
52
|
+
message=message,
|
|
53
|
+
error=error,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
internal_server_error.additional_properties = d
|
|
57
|
+
return internal_server_error
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def additional_keys(self) -> list[str]:
|
|
61
|
+
return list(self.additional_properties.keys())
|
|
62
|
+
|
|
63
|
+
def __getitem__(self, key: str) -> Any:
|
|
64
|
+
return self.additional_properties[key]
|
|
65
|
+
|
|
66
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
67
|
+
self.additional_properties[key] = value
|
|
68
|
+
|
|
69
|
+
def __delitem__(self, key: str) -> None:
|
|
70
|
+
del self.additional_properties[key]
|
|
71
|
+
|
|
72
|
+
def __contains__(self, key: str) -> bool:
|
|
73
|
+
return key in self.additional_properties
|