agenta 0.24.1a0__py3-none-any.whl → 0.24.2a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/cli/variant_commands.py +15 -10
- agenta/client/Readme.md +72 -64
- agenta/client/api.py +1 -1
- agenta/client/backend/__init__.py +14 -9
- agenta/client/backend/apps/client.py +1669 -0
- agenta/client/backend/bases/client.py +190 -0
- agenta/client/backend/client.py +2102 -868
- agenta/client/backend/configs/client.py +598 -0
- agenta/client/backend/containers/client.py +638 -0
- agenta/client/backend/{resources/containers → containers}/types/container_templates_response.py +1 -2
- agenta/client/backend/core/__init__.py +29 -0
- agenta/client/backend/core/client_wrapper.py +42 -9
- agenta/client/backend/core/datetime_utils.py +1 -1
- agenta/client/backend/core/file.py +43 -0
- agenta/client/backend/core/http_client.py +553 -0
- agenta/client/backend/core/jsonable_encoder.py +33 -39
- agenta/client/backend/core/pydantic_utilities.py +212 -0
- agenta/client/backend/core/query_encoder.py +60 -0
- agenta/client/backend/core/remove_none_from_dict.py +2 -2
- agenta/client/backend/core/request_options.py +32 -0
- agenta/client/backend/core/serialization.py +179 -0
- agenta/client/backend/environments/client.py +190 -0
- agenta/client/backend/evaluations/client.py +1462 -0
- agenta/client/backend/evaluators/client.py +911 -0
- agenta/client/backend/observability/client.py +1271 -0
- agenta/client/backend/testsets/client.py +1132 -0
- agenta/client/backend/types/__init__.py +8 -6
- agenta/client/backend/types/aggregated_result.py +14 -29
- agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -2
- agenta/client/backend/types/app.py +13 -28
- agenta/client/backend/types/app_variant_response.py +21 -37
- agenta/client/backend/types/app_variant_revision.py +17 -32
- agenta/client/backend/types/base_output.py +13 -28
- agenta/client/backend/types/body_import_testset.py +16 -31
- agenta/client/backend/types/config_db.py +16 -31
- agenta/client/backend/types/correct_answer.py +22 -0
- agenta/client/backend/types/create_app_output.py +13 -28
- agenta/client/backend/types/create_span.py +33 -50
- agenta/client/backend/types/create_trace_response.py +16 -31
- agenta/client/backend/types/docker_env_vars.py +13 -28
- agenta/client/backend/types/environment_output.py +21 -36
- agenta/client/backend/types/environment_output_extended.py +21 -36
- agenta/client/backend/types/environment_revision.py +18 -33
- agenta/client/backend/types/error.py +16 -31
- agenta/client/backend/types/evaluation.py +20 -34
- agenta/client/backend/types/evaluation_scenario.py +18 -33
- agenta/client/backend/types/evaluation_scenario_input.py +16 -31
- agenta/client/backend/types/evaluation_scenario_output.py +18 -33
- agenta/client/backend/types/evaluation_scenario_result.py +14 -29
- agenta/client/backend/types/evaluation_scenario_score_update.py +13 -28
- agenta/client/backend/types/evaluation_status_enum.py +11 -33
- agenta/client/backend/types/evaluation_type.py +3 -21
- agenta/client/backend/types/evaluator.py +18 -32
- agenta/client/backend/types/evaluator_config.py +20 -33
- agenta/client/backend/types/get_config_response.py +16 -31
- agenta/client/backend/types/http_validation_error.py +14 -29
- agenta/client/backend/types/human_evaluation.py +17 -32
- agenta/client/backend/types/human_evaluation_scenario.py +21 -37
- agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
- agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
- agenta/client/backend/types/human_evaluation_scenario_update.py +26 -41
- agenta/client/backend/types/human_evaluation_update.py +14 -29
- agenta/client/backend/types/image.py +18 -33
- agenta/client/backend/types/invite_request.py +13 -28
- agenta/client/backend/types/list_api_keys_response.py +18 -33
- agenta/client/backend/types/llm_run_rate_limit.py +13 -28
- agenta/client/backend/types/llm_tokens.py +16 -31
- agenta/client/backend/types/lm_providers_enum.py +21 -0
- agenta/client/backend/types/new_human_evaluation.py +13 -28
- agenta/client/backend/types/new_testset.py +16 -31
- agenta/client/backend/types/organization.py +22 -36
- agenta/client/backend/types/organization_output.py +13 -28
- agenta/client/backend/types/outputs.py +5 -0
- agenta/client/backend/types/permission.py +36 -137
- agenta/client/backend/types/result.py +17 -32
- agenta/client/backend/types/simple_evaluation_output.py +13 -28
- agenta/client/backend/types/span.py +23 -38
- agenta/client/backend/types/span_detail.py +26 -40
- agenta/client/backend/types/span_status_code.py +1 -25
- agenta/client/backend/types/span_variant.py +16 -31
- agenta/client/backend/types/template.py +14 -29
- agenta/client/backend/types/template_image_info.py +21 -35
- agenta/client/backend/types/test_set_output_response.py +16 -32
- agenta/client/backend/types/test_set_simple_response.py +13 -28
- agenta/client/backend/types/trace_detail.py +26 -40
- agenta/client/backend/types/update_app_output.py +22 -0
- agenta/client/backend/types/uri.py +13 -28
- agenta/client/backend/types/validation_error.py +13 -28
- agenta/client/backend/types/variant_action.py +14 -29
- agenta/client/backend/types/variant_action_enum.py +1 -19
- agenta/client/backend/types/with_pagination.py +14 -30
- agenta/client/backend/types/workspace_member_response.py +14 -29
- agenta/client/backend/types/workspace_permission.py +18 -33
- agenta/client/backend/types/workspace_response.py +20 -35
- agenta/client/backend/types/workspace_role.py +11 -37
- agenta/client/backend/types/workspace_role_response.py +17 -32
- agenta/client/backend/variants/client.py +1447 -0
- agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
- agenta/sdk/decorators/llm_entrypoint.py +8 -13
- agenta/sdk/tracing/llm_tracing.py +1 -1
- {agenta-0.24.1a0.dist-info → agenta-0.24.2a1.dist-info}/METADATA +1 -1
- agenta-0.24.2a1.dist-info/RECORD +175 -0
- agenta/client/backend/resources/__init__.py +0 -31
- agenta/client/backend/resources/apps/client.py +0 -977
- agenta/client/backend/resources/bases/client.py +0 -127
- agenta/client/backend/resources/configs/client.py +0 -377
- agenta/client/backend/resources/containers/client.py +0 -383
- agenta/client/backend/resources/environments/client.py +0 -131
- agenta/client/backend/resources/evaluations/client.py +0 -1008
- agenta/client/backend/resources/evaluators/client.py +0 -594
- agenta/client/backend/resources/observability/client.py +0 -1187
- agenta/client/backend/resources/testsets/client.py +0 -689
- agenta/client/backend/resources/variants/client.py +0 -796
- agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -7
- agenta/client/backend/types/evaluation_webhook.py +0 -36
- agenta/client/backend/types/feedback.py +0 -40
- agenta/client/backend/types/span_kind.py +0 -49
- agenta-0.24.1a0.dist-info/RECORD +0 -169
- /agenta/client/backend/{resources/apps → apps}/__init__.py +0 -0
- /agenta/client/backend/{resources/bases → bases}/__init__.py +0 -0
- /agenta/client/backend/{resources/configs → configs}/__init__.py +0 -0
- /agenta/client/backend/{resources/containers → containers}/__init__.py +0 -0
- /agenta/client/backend/{resources/containers → containers}/types/__init__.py +0 -0
- /agenta/client/backend/{resources/environments → environments}/__init__.py +0 -0
- /agenta/client/backend/{resources/evaluations → evaluations}/__init__.py +0 -0
- /agenta/client/backend/{resources/evaluators → evaluators}/__init__.py +0 -0
- /agenta/client/backend/{resources/observability → observability}/__init__.py +0 -0
- /agenta/client/backend/{resources/testsets → testsets}/__init__.py +0 -0
- /agenta/client/backend/{resources/variants → variants}/__init__.py +0 -0
- /agenta/client/backend/{resources/variants → variants}/types/__init__.py +0 -0
- {agenta-0.24.1a0.dist-info → agenta-0.24.2a1.dist-info}/WHEEL +0 -0
- {agenta-0.24.1a0.dist-info → agenta-0.24.2a1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.evaluator import Evaluator
|
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
10
|
+
from ..types.evaluator_config import EvaluatorConfig
|
|
11
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
12
|
+
from ..types.http_validation_error import HttpValidationError
|
|
13
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
14
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
15
|
+
|
|
16
|
+
# this is used as the default value for optional parameters
|
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class EvaluatorsClient:
|
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
|
+
self._client_wrapper = client_wrapper
|
|
23
|
+
|
|
24
|
+
def get_evaluators_endpoint(
|
|
25
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
26
|
+
) -> typing.List[Evaluator]:
|
|
27
|
+
"""
|
|
28
|
+
Endpoint to fetch a list of evaluators.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
List[Evaluator]: A list of evaluator objects.
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
request_options : typing.Optional[RequestOptions]
|
|
36
|
+
Request-specific configuration.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
typing.List[Evaluator]
|
|
41
|
+
Successful Response
|
|
42
|
+
|
|
43
|
+
Examples
|
|
44
|
+
--------
|
|
45
|
+
from agenta import AgentaApi
|
|
46
|
+
|
|
47
|
+
client = AgentaApi(
|
|
48
|
+
api_key="YOUR_API_KEY",
|
|
49
|
+
base_url="https://yourhost.com/path/to/api",
|
|
50
|
+
)
|
|
51
|
+
client.evaluators.get_evaluators_endpoint()
|
|
52
|
+
"""
|
|
53
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
+
"evaluators",
|
|
55
|
+
method="GET",
|
|
56
|
+
request_options=request_options,
|
|
57
|
+
)
|
|
58
|
+
try:
|
|
59
|
+
if 200 <= _response.status_code < 300:
|
|
60
|
+
return typing.cast(
|
|
61
|
+
typing.List[Evaluator],
|
|
62
|
+
parse_obj_as(
|
|
63
|
+
type_=typing.List[Evaluator], # type: ignore
|
|
64
|
+
object_=_response.json(),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
_response_json = _response.json()
|
|
68
|
+
except JSONDecodeError:
|
|
69
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
70
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
71
|
+
|
|
72
|
+
def get_evaluator_configs(
|
|
73
|
+
self, *, app_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
74
|
+
) -> typing.List[EvaluatorConfig]:
|
|
75
|
+
"""
|
|
76
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
app_id (str): The ID of the app.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
83
|
+
|
|
84
|
+
Parameters
|
|
85
|
+
----------
|
|
86
|
+
app_id : str
|
|
87
|
+
|
|
88
|
+
request_options : typing.Optional[RequestOptions]
|
|
89
|
+
Request-specific configuration.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
typing.List[EvaluatorConfig]
|
|
94
|
+
Successful Response
|
|
95
|
+
|
|
96
|
+
Examples
|
|
97
|
+
--------
|
|
98
|
+
from agenta import AgentaApi
|
|
99
|
+
|
|
100
|
+
client = AgentaApi(
|
|
101
|
+
api_key="YOUR_API_KEY",
|
|
102
|
+
base_url="https://yourhost.com/path/to/api",
|
|
103
|
+
)
|
|
104
|
+
client.evaluators.get_evaluator_configs(
|
|
105
|
+
app_id="app_id",
|
|
106
|
+
)
|
|
107
|
+
"""
|
|
108
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
109
|
+
"evaluators/configs",
|
|
110
|
+
method="GET",
|
|
111
|
+
params={
|
|
112
|
+
"app_id": app_id,
|
|
113
|
+
},
|
|
114
|
+
request_options=request_options,
|
|
115
|
+
)
|
|
116
|
+
try:
|
|
117
|
+
if 200 <= _response.status_code < 300:
|
|
118
|
+
return typing.cast(
|
|
119
|
+
typing.List[EvaluatorConfig],
|
|
120
|
+
parse_obj_as(
|
|
121
|
+
type_=typing.List[EvaluatorConfig], # type: ignore
|
|
122
|
+
object_=_response.json(),
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
if _response.status_code == 422:
|
|
126
|
+
raise UnprocessableEntityError(
|
|
127
|
+
typing.cast(
|
|
128
|
+
HttpValidationError,
|
|
129
|
+
parse_obj_as(
|
|
130
|
+
type_=HttpValidationError, # type: ignore
|
|
131
|
+
object_=_response.json(),
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
_response_json = _response.json()
|
|
136
|
+
except JSONDecodeError:
|
|
137
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
138
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
139
|
+
|
|
140
|
+
def create_new_evaluator_config(
|
|
141
|
+
self,
|
|
142
|
+
*,
|
|
143
|
+
app_id: str,
|
|
144
|
+
name: str,
|
|
145
|
+
evaluator_key: str,
|
|
146
|
+
settings_values: typing.Dict[str, typing.Optional[typing.Any]],
|
|
147
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
148
|
+
) -> EvaluatorConfig:
|
|
149
|
+
"""
|
|
150
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
app_id (str): The ID of the app.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
EvaluatorConfigDB: Evaluator configuration api model.
|
|
157
|
+
|
|
158
|
+
Parameters
|
|
159
|
+
----------
|
|
160
|
+
app_id : str
|
|
161
|
+
|
|
162
|
+
name : str
|
|
163
|
+
|
|
164
|
+
evaluator_key : str
|
|
165
|
+
|
|
166
|
+
settings_values : typing.Dict[str, typing.Optional[typing.Any]]
|
|
167
|
+
|
|
168
|
+
request_options : typing.Optional[RequestOptions]
|
|
169
|
+
Request-specific configuration.
|
|
170
|
+
|
|
171
|
+
Returns
|
|
172
|
+
-------
|
|
173
|
+
EvaluatorConfig
|
|
174
|
+
Successful Response
|
|
175
|
+
|
|
176
|
+
Examples
|
|
177
|
+
--------
|
|
178
|
+
from agenta import AgentaApi
|
|
179
|
+
|
|
180
|
+
client = AgentaApi(
|
|
181
|
+
api_key="YOUR_API_KEY",
|
|
182
|
+
base_url="https://yourhost.com/path/to/api",
|
|
183
|
+
)
|
|
184
|
+
client.evaluators.create_new_evaluator_config(
|
|
185
|
+
app_id="app_id",
|
|
186
|
+
name="name",
|
|
187
|
+
evaluator_key="evaluator_key",
|
|
188
|
+
settings_values={"key": "value"},
|
|
189
|
+
)
|
|
190
|
+
"""
|
|
191
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
192
|
+
"evaluators/configs",
|
|
193
|
+
method="POST",
|
|
194
|
+
json={
|
|
195
|
+
"app_id": app_id,
|
|
196
|
+
"name": name,
|
|
197
|
+
"evaluator_key": evaluator_key,
|
|
198
|
+
"settings_values": settings_values,
|
|
199
|
+
},
|
|
200
|
+
request_options=request_options,
|
|
201
|
+
omit=OMIT,
|
|
202
|
+
)
|
|
203
|
+
try:
|
|
204
|
+
if 200 <= _response.status_code < 300:
|
|
205
|
+
return typing.cast(
|
|
206
|
+
EvaluatorConfig,
|
|
207
|
+
parse_obj_as(
|
|
208
|
+
type_=EvaluatorConfig, # type: ignore
|
|
209
|
+
object_=_response.json(),
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
if _response.status_code == 422:
|
|
213
|
+
raise UnprocessableEntityError(
|
|
214
|
+
typing.cast(
|
|
215
|
+
HttpValidationError,
|
|
216
|
+
parse_obj_as(
|
|
217
|
+
type_=HttpValidationError, # type: ignore
|
|
218
|
+
object_=_response.json(),
|
|
219
|
+
),
|
|
220
|
+
)
|
|
221
|
+
)
|
|
222
|
+
_response_json = _response.json()
|
|
223
|
+
except JSONDecodeError:
|
|
224
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
225
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
226
|
+
|
|
227
|
+
def get_evaluator_config(
|
|
228
|
+
self,
|
|
229
|
+
evaluator_config_id: str,
|
|
230
|
+
*,
|
|
231
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
232
|
+
) -> EvaluatorConfig:
|
|
233
|
+
"""
|
|
234
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
235
|
+
|
|
236
|
+
Returns:
|
|
237
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
238
|
+
|
|
239
|
+
Parameters
|
|
240
|
+
----------
|
|
241
|
+
evaluator_config_id : str
|
|
242
|
+
|
|
243
|
+
request_options : typing.Optional[RequestOptions]
|
|
244
|
+
Request-specific configuration.
|
|
245
|
+
|
|
246
|
+
Returns
|
|
247
|
+
-------
|
|
248
|
+
EvaluatorConfig
|
|
249
|
+
Successful Response
|
|
250
|
+
|
|
251
|
+
Examples
|
|
252
|
+
--------
|
|
253
|
+
from agenta import AgentaApi
|
|
254
|
+
|
|
255
|
+
client = AgentaApi(
|
|
256
|
+
api_key="YOUR_API_KEY",
|
|
257
|
+
base_url="https://yourhost.com/path/to/api",
|
|
258
|
+
)
|
|
259
|
+
client.evaluators.get_evaluator_config(
|
|
260
|
+
evaluator_config_id="evaluator_config_id",
|
|
261
|
+
)
|
|
262
|
+
"""
|
|
263
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
264
|
+
f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
|
|
265
|
+
method="GET",
|
|
266
|
+
request_options=request_options,
|
|
267
|
+
)
|
|
268
|
+
try:
|
|
269
|
+
if 200 <= _response.status_code < 300:
|
|
270
|
+
return typing.cast(
|
|
271
|
+
EvaluatorConfig,
|
|
272
|
+
parse_obj_as(
|
|
273
|
+
type_=EvaluatorConfig, # type: ignore
|
|
274
|
+
object_=_response.json(),
|
|
275
|
+
),
|
|
276
|
+
)
|
|
277
|
+
if _response.status_code == 422:
|
|
278
|
+
raise UnprocessableEntityError(
|
|
279
|
+
typing.cast(
|
|
280
|
+
HttpValidationError,
|
|
281
|
+
parse_obj_as(
|
|
282
|
+
type_=HttpValidationError, # type: ignore
|
|
283
|
+
object_=_response.json(),
|
|
284
|
+
),
|
|
285
|
+
)
|
|
286
|
+
)
|
|
287
|
+
_response_json = _response.json()
|
|
288
|
+
except JSONDecodeError:
|
|
289
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
290
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
291
|
+
|
|
292
|
+
def update_evaluator_config(
|
|
293
|
+
self,
|
|
294
|
+
evaluator_config_id: str,
|
|
295
|
+
*,
|
|
296
|
+
name: typing.Optional[str] = OMIT,
|
|
297
|
+
evaluator_key: typing.Optional[str] = OMIT,
|
|
298
|
+
settings_values: typing.Optional[
|
|
299
|
+
typing.Dict[str, typing.Optional[typing.Any]]
|
|
300
|
+
] = OMIT,
|
|
301
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
302
|
+
) -> EvaluatorConfig:
|
|
303
|
+
"""
|
|
304
|
+
Endpoint to update evaluator configurations for a specific app.
|
|
305
|
+
|
|
306
|
+
Returns:
|
|
307
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
308
|
+
|
|
309
|
+
Parameters
|
|
310
|
+
----------
|
|
311
|
+
evaluator_config_id : str
|
|
312
|
+
|
|
313
|
+
name : typing.Optional[str]
|
|
314
|
+
|
|
315
|
+
evaluator_key : typing.Optional[str]
|
|
316
|
+
|
|
317
|
+
settings_values : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
318
|
+
|
|
319
|
+
request_options : typing.Optional[RequestOptions]
|
|
320
|
+
Request-specific configuration.
|
|
321
|
+
|
|
322
|
+
Returns
|
|
323
|
+
-------
|
|
324
|
+
EvaluatorConfig
|
|
325
|
+
Successful Response
|
|
326
|
+
|
|
327
|
+
Examples
|
|
328
|
+
--------
|
|
329
|
+
from agenta import AgentaApi
|
|
330
|
+
|
|
331
|
+
client = AgentaApi(
|
|
332
|
+
api_key="YOUR_API_KEY",
|
|
333
|
+
base_url="https://yourhost.com/path/to/api",
|
|
334
|
+
)
|
|
335
|
+
client.evaluators.update_evaluator_config(
|
|
336
|
+
evaluator_config_id="evaluator_config_id",
|
|
337
|
+
)
|
|
338
|
+
"""
|
|
339
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
340
|
+
f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
|
|
341
|
+
method="PUT",
|
|
342
|
+
json={
|
|
343
|
+
"name": name,
|
|
344
|
+
"evaluator_key": evaluator_key,
|
|
345
|
+
"settings_values": settings_values,
|
|
346
|
+
},
|
|
347
|
+
request_options=request_options,
|
|
348
|
+
omit=OMIT,
|
|
349
|
+
)
|
|
350
|
+
try:
|
|
351
|
+
if 200 <= _response.status_code < 300:
|
|
352
|
+
return typing.cast(
|
|
353
|
+
EvaluatorConfig,
|
|
354
|
+
parse_obj_as(
|
|
355
|
+
type_=EvaluatorConfig, # type: ignore
|
|
356
|
+
object_=_response.json(),
|
|
357
|
+
),
|
|
358
|
+
)
|
|
359
|
+
if _response.status_code == 422:
|
|
360
|
+
raise UnprocessableEntityError(
|
|
361
|
+
typing.cast(
|
|
362
|
+
HttpValidationError,
|
|
363
|
+
parse_obj_as(
|
|
364
|
+
type_=HttpValidationError, # type: ignore
|
|
365
|
+
object_=_response.json(),
|
|
366
|
+
),
|
|
367
|
+
)
|
|
368
|
+
)
|
|
369
|
+
_response_json = _response.json()
|
|
370
|
+
except JSONDecodeError:
|
|
371
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
372
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
373
|
+
|
|
374
|
+
def delete_evaluator_config(
|
|
375
|
+
self,
|
|
376
|
+
evaluator_config_id: str,
|
|
377
|
+
*,
|
|
378
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
379
|
+
) -> bool:
|
|
380
|
+
"""
|
|
381
|
+
Endpoint to delete a specific evaluator configuration.
|
|
382
|
+
|
|
383
|
+
Args:
|
|
384
|
+
evaluator_config_id (str): The unique identifier of the evaluator configuration.
|
|
385
|
+
|
|
386
|
+
Returns:
|
|
387
|
+
bool: True if deletion was successful, False otherwise.
|
|
388
|
+
|
|
389
|
+
Parameters
|
|
390
|
+
----------
|
|
391
|
+
evaluator_config_id : str
|
|
392
|
+
|
|
393
|
+
request_options : typing.Optional[RequestOptions]
|
|
394
|
+
Request-specific configuration.
|
|
395
|
+
|
|
396
|
+
Returns
|
|
397
|
+
-------
|
|
398
|
+
bool
|
|
399
|
+
Successful Response
|
|
400
|
+
|
|
401
|
+
Examples
|
|
402
|
+
--------
|
|
403
|
+
from agenta import AgentaApi
|
|
404
|
+
|
|
405
|
+
client = AgentaApi(
|
|
406
|
+
api_key="YOUR_API_KEY",
|
|
407
|
+
base_url="https://yourhost.com/path/to/api",
|
|
408
|
+
)
|
|
409
|
+
client.evaluators.delete_evaluator_config(
|
|
410
|
+
evaluator_config_id="evaluator_config_id",
|
|
411
|
+
)
|
|
412
|
+
"""
|
|
413
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
414
|
+
f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
|
|
415
|
+
method="DELETE",
|
|
416
|
+
request_options=request_options,
|
|
417
|
+
)
|
|
418
|
+
try:
|
|
419
|
+
if 200 <= _response.status_code < 300:
|
|
420
|
+
return typing.cast(
|
|
421
|
+
bool,
|
|
422
|
+
parse_obj_as(
|
|
423
|
+
type_=bool, # type: ignore
|
|
424
|
+
object_=_response.json(),
|
|
425
|
+
),
|
|
426
|
+
)
|
|
427
|
+
if _response.status_code == 422:
|
|
428
|
+
raise UnprocessableEntityError(
|
|
429
|
+
typing.cast(
|
|
430
|
+
HttpValidationError,
|
|
431
|
+
parse_obj_as(
|
|
432
|
+
type_=HttpValidationError, # type: ignore
|
|
433
|
+
object_=_response.json(),
|
|
434
|
+
),
|
|
435
|
+
)
|
|
436
|
+
)
|
|
437
|
+
_response_json = _response.json()
|
|
438
|
+
except JSONDecodeError:
|
|
439
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
440
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
class AsyncEvaluatorsClient:
|
|
444
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
445
|
+
self._client_wrapper = client_wrapper
|
|
446
|
+
|
|
447
|
+
async def get_evaluators_endpoint(
|
|
448
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
449
|
+
) -> typing.List[Evaluator]:
|
|
450
|
+
"""
|
|
451
|
+
Endpoint to fetch a list of evaluators.
|
|
452
|
+
|
|
453
|
+
Returns:
|
|
454
|
+
List[Evaluator]: A list of evaluator objects.
|
|
455
|
+
|
|
456
|
+
Parameters
|
|
457
|
+
----------
|
|
458
|
+
request_options : typing.Optional[RequestOptions]
|
|
459
|
+
Request-specific configuration.
|
|
460
|
+
|
|
461
|
+
Returns
|
|
462
|
+
-------
|
|
463
|
+
typing.List[Evaluator]
|
|
464
|
+
Successful Response
|
|
465
|
+
|
|
466
|
+
Examples
|
|
467
|
+
--------
|
|
468
|
+
import asyncio
|
|
469
|
+
|
|
470
|
+
from agenta import AsyncAgentaApi
|
|
471
|
+
|
|
472
|
+
client = AsyncAgentaApi(
|
|
473
|
+
api_key="YOUR_API_KEY",
|
|
474
|
+
base_url="https://yourhost.com/path/to/api",
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
async def main() -> None:
|
|
479
|
+
await client.evaluators.get_evaluators_endpoint()
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
asyncio.run(main())
|
|
483
|
+
"""
|
|
484
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
485
|
+
"evaluators",
|
|
486
|
+
method="GET",
|
|
487
|
+
request_options=request_options,
|
|
488
|
+
)
|
|
489
|
+
try:
|
|
490
|
+
if 200 <= _response.status_code < 300:
|
|
491
|
+
return typing.cast(
|
|
492
|
+
typing.List[Evaluator],
|
|
493
|
+
parse_obj_as(
|
|
494
|
+
type_=typing.List[Evaluator], # type: ignore
|
|
495
|
+
object_=_response.json(),
|
|
496
|
+
),
|
|
497
|
+
)
|
|
498
|
+
_response_json = _response.json()
|
|
499
|
+
except JSONDecodeError:
|
|
500
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
501
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
502
|
+
|
|
503
|
+
async def get_evaluator_configs(
|
|
504
|
+
self, *, app_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
505
|
+
) -> typing.List[EvaluatorConfig]:
|
|
506
|
+
"""
|
|
507
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
508
|
+
|
|
509
|
+
Args:
|
|
510
|
+
app_id (str): The ID of the app.
|
|
511
|
+
|
|
512
|
+
Returns:
|
|
513
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
514
|
+
|
|
515
|
+
Parameters
|
|
516
|
+
----------
|
|
517
|
+
app_id : str
|
|
518
|
+
|
|
519
|
+
request_options : typing.Optional[RequestOptions]
|
|
520
|
+
Request-specific configuration.
|
|
521
|
+
|
|
522
|
+
Returns
|
|
523
|
+
-------
|
|
524
|
+
typing.List[EvaluatorConfig]
|
|
525
|
+
Successful Response
|
|
526
|
+
|
|
527
|
+
Examples
|
|
528
|
+
--------
|
|
529
|
+
import asyncio
|
|
530
|
+
|
|
531
|
+
from agenta import AsyncAgentaApi
|
|
532
|
+
|
|
533
|
+
client = AsyncAgentaApi(
|
|
534
|
+
api_key="YOUR_API_KEY",
|
|
535
|
+
base_url="https://yourhost.com/path/to/api",
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
async def main() -> None:
|
|
540
|
+
await client.evaluators.get_evaluator_configs(
|
|
541
|
+
app_id="app_id",
|
|
542
|
+
)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
asyncio.run(main())
|
|
546
|
+
"""
|
|
547
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
548
|
+
"evaluators/configs",
|
|
549
|
+
method="GET",
|
|
550
|
+
params={
|
|
551
|
+
"app_id": app_id,
|
|
552
|
+
},
|
|
553
|
+
request_options=request_options,
|
|
554
|
+
)
|
|
555
|
+
try:
|
|
556
|
+
if 200 <= _response.status_code < 300:
|
|
557
|
+
return typing.cast(
|
|
558
|
+
typing.List[EvaluatorConfig],
|
|
559
|
+
parse_obj_as(
|
|
560
|
+
type_=typing.List[EvaluatorConfig], # type: ignore
|
|
561
|
+
object_=_response.json(),
|
|
562
|
+
),
|
|
563
|
+
)
|
|
564
|
+
if _response.status_code == 422:
|
|
565
|
+
raise UnprocessableEntityError(
|
|
566
|
+
typing.cast(
|
|
567
|
+
HttpValidationError,
|
|
568
|
+
parse_obj_as(
|
|
569
|
+
type_=HttpValidationError, # type: ignore
|
|
570
|
+
object_=_response.json(),
|
|
571
|
+
),
|
|
572
|
+
)
|
|
573
|
+
)
|
|
574
|
+
_response_json = _response.json()
|
|
575
|
+
except JSONDecodeError:
|
|
576
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
577
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
578
|
+
|
|
579
|
+
async def create_new_evaluator_config(
|
|
580
|
+
self,
|
|
581
|
+
*,
|
|
582
|
+
app_id: str,
|
|
583
|
+
name: str,
|
|
584
|
+
evaluator_key: str,
|
|
585
|
+
settings_values: typing.Dict[str, typing.Optional[typing.Any]],
|
|
586
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
587
|
+
) -> EvaluatorConfig:
|
|
588
|
+
"""
|
|
589
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
590
|
+
|
|
591
|
+
Args:
|
|
592
|
+
app_id (str): The ID of the app.
|
|
593
|
+
|
|
594
|
+
Returns:
|
|
595
|
+
EvaluatorConfigDB: Evaluator configuration api model.
|
|
596
|
+
|
|
597
|
+
Parameters
|
|
598
|
+
----------
|
|
599
|
+
app_id : str
|
|
600
|
+
|
|
601
|
+
name : str
|
|
602
|
+
|
|
603
|
+
evaluator_key : str
|
|
604
|
+
|
|
605
|
+
settings_values : typing.Dict[str, typing.Optional[typing.Any]]
|
|
606
|
+
|
|
607
|
+
request_options : typing.Optional[RequestOptions]
|
|
608
|
+
Request-specific configuration.
|
|
609
|
+
|
|
610
|
+
Returns
|
|
611
|
+
-------
|
|
612
|
+
EvaluatorConfig
|
|
613
|
+
Successful Response
|
|
614
|
+
|
|
615
|
+
Examples
|
|
616
|
+
--------
|
|
617
|
+
import asyncio
|
|
618
|
+
|
|
619
|
+
from agenta import AsyncAgentaApi
|
|
620
|
+
|
|
621
|
+
client = AsyncAgentaApi(
|
|
622
|
+
api_key="YOUR_API_KEY",
|
|
623
|
+
base_url="https://yourhost.com/path/to/api",
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
async def main() -> None:
|
|
628
|
+
await client.evaluators.create_new_evaluator_config(
|
|
629
|
+
app_id="app_id",
|
|
630
|
+
name="name",
|
|
631
|
+
evaluator_key="evaluator_key",
|
|
632
|
+
settings_values={"key": "value"},
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
asyncio.run(main())
|
|
637
|
+
"""
|
|
638
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
639
|
+
"evaluators/configs",
|
|
640
|
+
method="POST",
|
|
641
|
+
json={
|
|
642
|
+
"app_id": app_id,
|
|
643
|
+
"name": name,
|
|
644
|
+
"evaluator_key": evaluator_key,
|
|
645
|
+
"settings_values": settings_values,
|
|
646
|
+
},
|
|
647
|
+
request_options=request_options,
|
|
648
|
+
omit=OMIT,
|
|
649
|
+
)
|
|
650
|
+
try:
|
|
651
|
+
if 200 <= _response.status_code < 300:
|
|
652
|
+
return typing.cast(
|
|
653
|
+
EvaluatorConfig,
|
|
654
|
+
parse_obj_as(
|
|
655
|
+
type_=EvaluatorConfig, # type: ignore
|
|
656
|
+
object_=_response.json(),
|
|
657
|
+
),
|
|
658
|
+
)
|
|
659
|
+
if _response.status_code == 422:
|
|
660
|
+
raise UnprocessableEntityError(
|
|
661
|
+
typing.cast(
|
|
662
|
+
HttpValidationError,
|
|
663
|
+
parse_obj_as(
|
|
664
|
+
type_=HttpValidationError, # type: ignore
|
|
665
|
+
object_=_response.json(),
|
|
666
|
+
),
|
|
667
|
+
)
|
|
668
|
+
)
|
|
669
|
+
_response_json = _response.json()
|
|
670
|
+
except JSONDecodeError:
|
|
671
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
672
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
673
|
+
|
|
674
|
+
async def get_evaluator_config(
|
|
675
|
+
self,
|
|
676
|
+
evaluator_config_id: str,
|
|
677
|
+
*,
|
|
678
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
679
|
+
) -> EvaluatorConfig:
|
|
680
|
+
"""
|
|
681
|
+
Endpoint to fetch evaluator configurations for a specific app.
|
|
682
|
+
|
|
683
|
+
Returns:
|
|
684
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
685
|
+
|
|
686
|
+
Parameters
|
|
687
|
+
----------
|
|
688
|
+
evaluator_config_id : str
|
|
689
|
+
|
|
690
|
+
request_options : typing.Optional[RequestOptions]
|
|
691
|
+
Request-specific configuration.
|
|
692
|
+
|
|
693
|
+
Returns
|
|
694
|
+
-------
|
|
695
|
+
EvaluatorConfig
|
|
696
|
+
Successful Response
|
|
697
|
+
|
|
698
|
+
Examples
|
|
699
|
+
--------
|
|
700
|
+
import asyncio
|
|
701
|
+
|
|
702
|
+
from agenta import AsyncAgentaApi
|
|
703
|
+
|
|
704
|
+
client = AsyncAgentaApi(
|
|
705
|
+
api_key="YOUR_API_KEY",
|
|
706
|
+
base_url="https://yourhost.com/path/to/api",
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
async def main() -> None:
|
|
711
|
+
await client.evaluators.get_evaluator_config(
|
|
712
|
+
evaluator_config_id="evaluator_config_id",
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
asyncio.run(main())
|
|
717
|
+
"""
|
|
718
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
719
|
+
f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
|
|
720
|
+
method="GET",
|
|
721
|
+
request_options=request_options,
|
|
722
|
+
)
|
|
723
|
+
try:
|
|
724
|
+
if 200 <= _response.status_code < 300:
|
|
725
|
+
return typing.cast(
|
|
726
|
+
EvaluatorConfig,
|
|
727
|
+
parse_obj_as(
|
|
728
|
+
type_=EvaluatorConfig, # type: ignore
|
|
729
|
+
object_=_response.json(),
|
|
730
|
+
),
|
|
731
|
+
)
|
|
732
|
+
if _response.status_code == 422:
|
|
733
|
+
raise UnprocessableEntityError(
|
|
734
|
+
typing.cast(
|
|
735
|
+
HttpValidationError,
|
|
736
|
+
parse_obj_as(
|
|
737
|
+
type_=HttpValidationError, # type: ignore
|
|
738
|
+
object_=_response.json(),
|
|
739
|
+
),
|
|
740
|
+
)
|
|
741
|
+
)
|
|
742
|
+
_response_json = _response.json()
|
|
743
|
+
except JSONDecodeError:
|
|
744
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
745
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
746
|
+
|
|
747
|
+
async def update_evaluator_config(
|
|
748
|
+
self,
|
|
749
|
+
evaluator_config_id: str,
|
|
750
|
+
*,
|
|
751
|
+
name: typing.Optional[str] = OMIT,
|
|
752
|
+
evaluator_key: typing.Optional[str] = OMIT,
|
|
753
|
+
settings_values: typing.Optional[
|
|
754
|
+
typing.Dict[str, typing.Optional[typing.Any]]
|
|
755
|
+
] = OMIT,
|
|
756
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
757
|
+
) -> EvaluatorConfig:
|
|
758
|
+
"""
|
|
759
|
+
Endpoint to update evaluator configurations for a specific app.
|
|
760
|
+
|
|
761
|
+
Returns:
|
|
762
|
+
List[EvaluatorConfigDB]: A list of evaluator configuration objects.
|
|
763
|
+
|
|
764
|
+
Parameters
|
|
765
|
+
----------
|
|
766
|
+
evaluator_config_id : str
|
|
767
|
+
|
|
768
|
+
name : typing.Optional[str]
|
|
769
|
+
|
|
770
|
+
evaluator_key : typing.Optional[str]
|
|
771
|
+
|
|
772
|
+
settings_values : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
773
|
+
|
|
774
|
+
request_options : typing.Optional[RequestOptions]
|
|
775
|
+
Request-specific configuration.
|
|
776
|
+
|
|
777
|
+
Returns
|
|
778
|
+
-------
|
|
779
|
+
EvaluatorConfig
|
|
780
|
+
Successful Response
|
|
781
|
+
|
|
782
|
+
Examples
|
|
783
|
+
--------
|
|
784
|
+
import asyncio
|
|
785
|
+
|
|
786
|
+
from agenta import AsyncAgentaApi
|
|
787
|
+
|
|
788
|
+
client = AsyncAgentaApi(
|
|
789
|
+
api_key="YOUR_API_KEY",
|
|
790
|
+
base_url="https://yourhost.com/path/to/api",
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
async def main() -> None:
|
|
795
|
+
await client.evaluators.update_evaluator_config(
|
|
796
|
+
evaluator_config_id="evaluator_config_id",
|
|
797
|
+
)
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
asyncio.run(main())
|
|
801
|
+
"""
|
|
802
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
803
|
+
f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
|
|
804
|
+
method="PUT",
|
|
805
|
+
json={
|
|
806
|
+
"name": name,
|
|
807
|
+
"evaluator_key": evaluator_key,
|
|
808
|
+
"settings_values": settings_values,
|
|
809
|
+
},
|
|
810
|
+
request_options=request_options,
|
|
811
|
+
omit=OMIT,
|
|
812
|
+
)
|
|
813
|
+
try:
|
|
814
|
+
if 200 <= _response.status_code < 300:
|
|
815
|
+
return typing.cast(
|
|
816
|
+
EvaluatorConfig,
|
|
817
|
+
parse_obj_as(
|
|
818
|
+
type_=EvaluatorConfig, # type: ignore
|
|
819
|
+
object_=_response.json(),
|
|
820
|
+
),
|
|
821
|
+
)
|
|
822
|
+
if _response.status_code == 422:
|
|
823
|
+
raise UnprocessableEntityError(
|
|
824
|
+
typing.cast(
|
|
825
|
+
HttpValidationError,
|
|
826
|
+
parse_obj_as(
|
|
827
|
+
type_=HttpValidationError, # type: ignore
|
|
828
|
+
object_=_response.json(),
|
|
829
|
+
),
|
|
830
|
+
)
|
|
831
|
+
)
|
|
832
|
+
_response_json = _response.json()
|
|
833
|
+
except JSONDecodeError:
|
|
834
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
835
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
836
|
+
|
|
837
|
+
async def delete_evaluator_config(
|
|
838
|
+
self,
|
|
839
|
+
evaluator_config_id: str,
|
|
840
|
+
*,
|
|
841
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
842
|
+
) -> bool:
|
|
843
|
+
"""
|
|
844
|
+
Endpoint to delete a specific evaluator configuration.
|
|
845
|
+
|
|
846
|
+
Args:
|
|
847
|
+
evaluator_config_id (str): The unique identifier of the evaluator configuration.
|
|
848
|
+
|
|
849
|
+
Returns:
|
|
850
|
+
bool: True if deletion was successful, False otherwise.
|
|
851
|
+
|
|
852
|
+
Parameters
|
|
853
|
+
----------
|
|
854
|
+
evaluator_config_id : str
|
|
855
|
+
|
|
856
|
+
request_options : typing.Optional[RequestOptions]
|
|
857
|
+
Request-specific configuration.
|
|
858
|
+
|
|
859
|
+
Returns
|
|
860
|
+
-------
|
|
861
|
+
bool
|
|
862
|
+
Successful Response
|
|
863
|
+
|
|
864
|
+
Examples
|
|
865
|
+
--------
|
|
866
|
+
import asyncio
|
|
867
|
+
|
|
868
|
+
from agenta import AsyncAgentaApi
|
|
869
|
+
|
|
870
|
+
client = AsyncAgentaApi(
|
|
871
|
+
api_key="YOUR_API_KEY",
|
|
872
|
+
base_url="https://yourhost.com/path/to/api",
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
async def main() -> None:
|
|
877
|
+
await client.evaluators.delete_evaluator_config(
|
|
878
|
+
evaluator_config_id="evaluator_config_id",
|
|
879
|
+
)
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
asyncio.run(main())
|
|
883
|
+
"""
|
|
884
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
885
|
+
f"evaluators/configs/{jsonable_encoder(evaluator_config_id)}",
|
|
886
|
+
method="DELETE",
|
|
887
|
+
request_options=request_options,
|
|
888
|
+
)
|
|
889
|
+
try:
|
|
890
|
+
if 200 <= _response.status_code < 300:
|
|
891
|
+
return typing.cast(
|
|
892
|
+
bool,
|
|
893
|
+
parse_obj_as(
|
|
894
|
+
type_=bool, # type: ignore
|
|
895
|
+
object_=_response.json(),
|
|
896
|
+
),
|
|
897
|
+
)
|
|
898
|
+
if _response.status_code == 422:
|
|
899
|
+
raise UnprocessableEntityError(
|
|
900
|
+
typing.cast(
|
|
901
|
+
HttpValidationError,
|
|
902
|
+
parse_obj_as(
|
|
903
|
+
type_=HttpValidationError, # type: ignore
|
|
904
|
+
object_=_response.json(),
|
|
905
|
+
),
|
|
906
|
+
)
|
|
907
|
+
)
|
|
908
|
+
_response_json = _response.json()
|
|
909
|
+
except JSONDecodeError:
|
|
910
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
911
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|