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