agenta 0.24.1a0__py3-none-any.whl → 0.24.2__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 +10 -12
- {agenta-0.24.1a0.dist-info → agenta-0.24.2.dist-info}/METADATA +1 -1
- agenta-0.24.2.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.2.dist-info}/WHEEL +0 -0
- {agenta-0.24.1a0.dist-info → agenta-0.24.2.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,598 @@
|
|
|
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.get_config_response import GetConfigResponse
|
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
9
|
+
from ..types.http_validation_error import HttpValidationError
|
|
10
|
+
from json.decoder import JSONDecodeError
|
|
11
|
+
from ..core.api_error import ApiError
|
|
12
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
13
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
14
|
+
|
|
15
|
+
# this is used as the default value for optional parameters
|
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ConfigsClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._client_wrapper = client_wrapper
|
|
22
|
+
|
|
23
|
+
def get_config(
|
|
24
|
+
self,
|
|
25
|
+
*,
|
|
26
|
+
base_id: str,
|
|
27
|
+
config_name: typing.Optional[str] = None,
|
|
28
|
+
environment_name: typing.Optional[str] = None,
|
|
29
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
30
|
+
) -> GetConfigResponse:
|
|
31
|
+
"""
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
base_id : str
|
|
35
|
+
|
|
36
|
+
config_name : typing.Optional[str]
|
|
37
|
+
|
|
38
|
+
environment_name : typing.Optional[str]
|
|
39
|
+
|
|
40
|
+
request_options : typing.Optional[RequestOptions]
|
|
41
|
+
Request-specific configuration.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
GetConfigResponse
|
|
46
|
+
Successful Response
|
|
47
|
+
|
|
48
|
+
Examples
|
|
49
|
+
--------
|
|
50
|
+
from agenta import AgentaApi
|
|
51
|
+
|
|
52
|
+
client = AgentaApi(
|
|
53
|
+
api_key="YOUR_API_KEY",
|
|
54
|
+
base_url="https://yourhost.com/path/to/api",
|
|
55
|
+
)
|
|
56
|
+
client.configs.get_config(
|
|
57
|
+
base_id="base_id",
|
|
58
|
+
)
|
|
59
|
+
"""
|
|
60
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
61
|
+
"configs",
|
|
62
|
+
method="GET",
|
|
63
|
+
params={
|
|
64
|
+
"base_id": base_id,
|
|
65
|
+
"config_name": config_name,
|
|
66
|
+
"environment_name": environment_name,
|
|
67
|
+
},
|
|
68
|
+
request_options=request_options,
|
|
69
|
+
)
|
|
70
|
+
try:
|
|
71
|
+
if 200 <= _response.status_code < 300:
|
|
72
|
+
return typing.cast(
|
|
73
|
+
GetConfigResponse,
|
|
74
|
+
parse_obj_as(
|
|
75
|
+
type_=GetConfigResponse, # type: ignore
|
|
76
|
+
object_=_response.json(),
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
if _response.status_code == 422:
|
|
80
|
+
raise UnprocessableEntityError(
|
|
81
|
+
typing.cast(
|
|
82
|
+
HttpValidationError,
|
|
83
|
+
parse_obj_as(
|
|
84
|
+
type_=HttpValidationError, # type: ignore
|
|
85
|
+
object_=_response.json(),
|
|
86
|
+
),
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
_response_json = _response.json()
|
|
90
|
+
except JSONDecodeError:
|
|
91
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
92
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
93
|
+
|
|
94
|
+
def save_config(
|
|
95
|
+
self,
|
|
96
|
+
*,
|
|
97
|
+
base_id: str,
|
|
98
|
+
config_name: str,
|
|
99
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]],
|
|
100
|
+
overwrite: bool,
|
|
101
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
102
|
+
) -> typing.Optional[typing.Any]:
|
|
103
|
+
"""
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
base_id : str
|
|
107
|
+
|
|
108
|
+
config_name : str
|
|
109
|
+
|
|
110
|
+
parameters : typing.Dict[str, typing.Optional[typing.Any]]
|
|
111
|
+
|
|
112
|
+
overwrite : bool
|
|
113
|
+
|
|
114
|
+
request_options : typing.Optional[RequestOptions]
|
|
115
|
+
Request-specific configuration.
|
|
116
|
+
|
|
117
|
+
Returns
|
|
118
|
+
-------
|
|
119
|
+
typing.Optional[typing.Any]
|
|
120
|
+
Successful Response
|
|
121
|
+
|
|
122
|
+
Examples
|
|
123
|
+
--------
|
|
124
|
+
from agenta import AgentaApi
|
|
125
|
+
|
|
126
|
+
client = AgentaApi(
|
|
127
|
+
api_key="YOUR_API_KEY",
|
|
128
|
+
base_url="https://yourhost.com/path/to/api",
|
|
129
|
+
)
|
|
130
|
+
client.configs.save_config(
|
|
131
|
+
base_id="base_id",
|
|
132
|
+
config_name="config_name",
|
|
133
|
+
parameters={"key": "value"},
|
|
134
|
+
overwrite=True,
|
|
135
|
+
)
|
|
136
|
+
"""
|
|
137
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
138
|
+
"configs",
|
|
139
|
+
method="POST",
|
|
140
|
+
json={
|
|
141
|
+
"base_id": base_id,
|
|
142
|
+
"config_name": config_name,
|
|
143
|
+
"parameters": parameters,
|
|
144
|
+
"overwrite": overwrite,
|
|
145
|
+
},
|
|
146
|
+
request_options=request_options,
|
|
147
|
+
omit=OMIT,
|
|
148
|
+
)
|
|
149
|
+
try:
|
|
150
|
+
if 200 <= _response.status_code < 300:
|
|
151
|
+
return typing.cast(
|
|
152
|
+
typing.Optional[typing.Any],
|
|
153
|
+
parse_obj_as(
|
|
154
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
155
|
+
object_=_response.json(),
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
if _response.status_code == 422:
|
|
159
|
+
raise UnprocessableEntityError(
|
|
160
|
+
typing.cast(
|
|
161
|
+
HttpValidationError,
|
|
162
|
+
parse_obj_as(
|
|
163
|
+
type_=HttpValidationError, # type: ignore
|
|
164
|
+
object_=_response.json(),
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
_response_json = _response.json()
|
|
169
|
+
except JSONDecodeError:
|
|
170
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
171
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
172
|
+
|
|
173
|
+
def get_config_deployment_revision(
|
|
174
|
+
self,
|
|
175
|
+
deployment_revision_id: str,
|
|
176
|
+
*,
|
|
177
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
178
|
+
) -> typing.Optional[typing.Any]:
|
|
179
|
+
"""
|
|
180
|
+
Parameters
|
|
181
|
+
----------
|
|
182
|
+
deployment_revision_id : str
|
|
183
|
+
|
|
184
|
+
request_options : typing.Optional[RequestOptions]
|
|
185
|
+
Request-specific configuration.
|
|
186
|
+
|
|
187
|
+
Returns
|
|
188
|
+
-------
|
|
189
|
+
typing.Optional[typing.Any]
|
|
190
|
+
Successful Response
|
|
191
|
+
|
|
192
|
+
Examples
|
|
193
|
+
--------
|
|
194
|
+
from agenta import AgentaApi
|
|
195
|
+
|
|
196
|
+
client = AgentaApi(
|
|
197
|
+
api_key="YOUR_API_KEY",
|
|
198
|
+
base_url="https://yourhost.com/path/to/api",
|
|
199
|
+
)
|
|
200
|
+
client.configs.get_config_deployment_revision(
|
|
201
|
+
deployment_revision_id="deployment_revision_id",
|
|
202
|
+
)
|
|
203
|
+
"""
|
|
204
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
205
|
+
f"configs/deployment/{jsonable_encoder(deployment_revision_id)}",
|
|
206
|
+
method="GET",
|
|
207
|
+
request_options=request_options,
|
|
208
|
+
)
|
|
209
|
+
try:
|
|
210
|
+
if 200 <= _response.status_code < 300:
|
|
211
|
+
return typing.cast(
|
|
212
|
+
typing.Optional[typing.Any],
|
|
213
|
+
parse_obj_as(
|
|
214
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
215
|
+
object_=_response.json(),
|
|
216
|
+
),
|
|
217
|
+
)
|
|
218
|
+
if _response.status_code == 422:
|
|
219
|
+
raise UnprocessableEntityError(
|
|
220
|
+
typing.cast(
|
|
221
|
+
HttpValidationError,
|
|
222
|
+
parse_obj_as(
|
|
223
|
+
type_=HttpValidationError, # type: ignore
|
|
224
|
+
object_=_response.json(),
|
|
225
|
+
),
|
|
226
|
+
)
|
|
227
|
+
)
|
|
228
|
+
_response_json = _response.json()
|
|
229
|
+
except JSONDecodeError:
|
|
230
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
231
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
232
|
+
|
|
233
|
+
def revert_deployment_revision(
|
|
234
|
+
self,
|
|
235
|
+
deployment_revision_id: str,
|
|
236
|
+
*,
|
|
237
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
238
|
+
) -> typing.Optional[typing.Any]:
|
|
239
|
+
"""
|
|
240
|
+
Parameters
|
|
241
|
+
----------
|
|
242
|
+
deployment_revision_id : str
|
|
243
|
+
|
|
244
|
+
request_options : typing.Optional[RequestOptions]
|
|
245
|
+
Request-specific configuration.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
typing.Optional[typing.Any]
|
|
250
|
+
Successful Response
|
|
251
|
+
|
|
252
|
+
Examples
|
|
253
|
+
--------
|
|
254
|
+
from agenta import AgentaApi
|
|
255
|
+
|
|
256
|
+
client = AgentaApi(
|
|
257
|
+
api_key="YOUR_API_KEY",
|
|
258
|
+
base_url="https://yourhost.com/path/to/api",
|
|
259
|
+
)
|
|
260
|
+
client.configs.revert_deployment_revision(
|
|
261
|
+
deployment_revision_id="deployment_revision_id",
|
|
262
|
+
)
|
|
263
|
+
"""
|
|
264
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
265
|
+
f"configs/deployment/{jsonable_encoder(deployment_revision_id)}/revert",
|
|
266
|
+
method="POST",
|
|
267
|
+
request_options=request_options,
|
|
268
|
+
)
|
|
269
|
+
try:
|
|
270
|
+
if 200 <= _response.status_code < 300:
|
|
271
|
+
return typing.cast(
|
|
272
|
+
typing.Optional[typing.Any],
|
|
273
|
+
parse_obj_as(
|
|
274
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
275
|
+
object_=_response.json(),
|
|
276
|
+
),
|
|
277
|
+
)
|
|
278
|
+
if _response.status_code == 422:
|
|
279
|
+
raise UnprocessableEntityError(
|
|
280
|
+
typing.cast(
|
|
281
|
+
HttpValidationError,
|
|
282
|
+
parse_obj_as(
|
|
283
|
+
type_=HttpValidationError, # type: ignore
|
|
284
|
+
object_=_response.json(),
|
|
285
|
+
),
|
|
286
|
+
)
|
|
287
|
+
)
|
|
288
|
+
_response_json = _response.json()
|
|
289
|
+
except JSONDecodeError:
|
|
290
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
291
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
class AsyncConfigsClient:
|
|
295
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
296
|
+
self._client_wrapper = client_wrapper
|
|
297
|
+
|
|
298
|
+
async def get_config(
|
|
299
|
+
self,
|
|
300
|
+
*,
|
|
301
|
+
base_id: str,
|
|
302
|
+
config_name: typing.Optional[str] = None,
|
|
303
|
+
environment_name: typing.Optional[str] = None,
|
|
304
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
305
|
+
) -> GetConfigResponse:
|
|
306
|
+
"""
|
|
307
|
+
Parameters
|
|
308
|
+
----------
|
|
309
|
+
base_id : str
|
|
310
|
+
|
|
311
|
+
config_name : typing.Optional[str]
|
|
312
|
+
|
|
313
|
+
environment_name : typing.Optional[str]
|
|
314
|
+
|
|
315
|
+
request_options : typing.Optional[RequestOptions]
|
|
316
|
+
Request-specific configuration.
|
|
317
|
+
|
|
318
|
+
Returns
|
|
319
|
+
-------
|
|
320
|
+
GetConfigResponse
|
|
321
|
+
Successful Response
|
|
322
|
+
|
|
323
|
+
Examples
|
|
324
|
+
--------
|
|
325
|
+
import asyncio
|
|
326
|
+
|
|
327
|
+
from agenta import AsyncAgentaApi
|
|
328
|
+
|
|
329
|
+
client = AsyncAgentaApi(
|
|
330
|
+
api_key="YOUR_API_KEY",
|
|
331
|
+
base_url="https://yourhost.com/path/to/api",
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
async def main() -> None:
|
|
336
|
+
await client.configs.get_config(
|
|
337
|
+
base_id="base_id",
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
asyncio.run(main())
|
|
342
|
+
"""
|
|
343
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
344
|
+
"configs",
|
|
345
|
+
method="GET",
|
|
346
|
+
params={
|
|
347
|
+
"base_id": base_id,
|
|
348
|
+
"config_name": config_name,
|
|
349
|
+
"environment_name": environment_name,
|
|
350
|
+
},
|
|
351
|
+
request_options=request_options,
|
|
352
|
+
)
|
|
353
|
+
try:
|
|
354
|
+
if 200 <= _response.status_code < 300:
|
|
355
|
+
return typing.cast(
|
|
356
|
+
GetConfigResponse,
|
|
357
|
+
parse_obj_as(
|
|
358
|
+
type_=GetConfigResponse, # type: ignore
|
|
359
|
+
object_=_response.json(),
|
|
360
|
+
),
|
|
361
|
+
)
|
|
362
|
+
if _response.status_code == 422:
|
|
363
|
+
raise UnprocessableEntityError(
|
|
364
|
+
typing.cast(
|
|
365
|
+
HttpValidationError,
|
|
366
|
+
parse_obj_as(
|
|
367
|
+
type_=HttpValidationError, # type: ignore
|
|
368
|
+
object_=_response.json(),
|
|
369
|
+
),
|
|
370
|
+
)
|
|
371
|
+
)
|
|
372
|
+
_response_json = _response.json()
|
|
373
|
+
except JSONDecodeError:
|
|
374
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
375
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
376
|
+
|
|
377
|
+
async def save_config(
|
|
378
|
+
self,
|
|
379
|
+
*,
|
|
380
|
+
base_id: str,
|
|
381
|
+
config_name: str,
|
|
382
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]],
|
|
383
|
+
overwrite: bool,
|
|
384
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
385
|
+
) -> typing.Optional[typing.Any]:
|
|
386
|
+
"""
|
|
387
|
+
Parameters
|
|
388
|
+
----------
|
|
389
|
+
base_id : str
|
|
390
|
+
|
|
391
|
+
config_name : str
|
|
392
|
+
|
|
393
|
+
parameters : typing.Dict[str, typing.Optional[typing.Any]]
|
|
394
|
+
|
|
395
|
+
overwrite : bool
|
|
396
|
+
|
|
397
|
+
request_options : typing.Optional[RequestOptions]
|
|
398
|
+
Request-specific configuration.
|
|
399
|
+
|
|
400
|
+
Returns
|
|
401
|
+
-------
|
|
402
|
+
typing.Optional[typing.Any]
|
|
403
|
+
Successful Response
|
|
404
|
+
|
|
405
|
+
Examples
|
|
406
|
+
--------
|
|
407
|
+
import asyncio
|
|
408
|
+
|
|
409
|
+
from agenta import AsyncAgentaApi
|
|
410
|
+
|
|
411
|
+
client = AsyncAgentaApi(
|
|
412
|
+
api_key="YOUR_API_KEY",
|
|
413
|
+
base_url="https://yourhost.com/path/to/api",
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
async def main() -> None:
|
|
418
|
+
await client.configs.save_config(
|
|
419
|
+
base_id="base_id",
|
|
420
|
+
config_name="config_name",
|
|
421
|
+
parameters={"key": "value"},
|
|
422
|
+
overwrite=True,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
asyncio.run(main())
|
|
427
|
+
"""
|
|
428
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
429
|
+
"configs",
|
|
430
|
+
method="POST",
|
|
431
|
+
json={
|
|
432
|
+
"base_id": base_id,
|
|
433
|
+
"config_name": config_name,
|
|
434
|
+
"parameters": parameters,
|
|
435
|
+
"overwrite": overwrite,
|
|
436
|
+
},
|
|
437
|
+
request_options=request_options,
|
|
438
|
+
omit=OMIT,
|
|
439
|
+
)
|
|
440
|
+
try:
|
|
441
|
+
if 200 <= _response.status_code < 300:
|
|
442
|
+
return typing.cast(
|
|
443
|
+
typing.Optional[typing.Any],
|
|
444
|
+
parse_obj_as(
|
|
445
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
446
|
+
object_=_response.json(),
|
|
447
|
+
),
|
|
448
|
+
)
|
|
449
|
+
if _response.status_code == 422:
|
|
450
|
+
raise UnprocessableEntityError(
|
|
451
|
+
typing.cast(
|
|
452
|
+
HttpValidationError,
|
|
453
|
+
parse_obj_as(
|
|
454
|
+
type_=HttpValidationError, # type: ignore
|
|
455
|
+
object_=_response.json(),
|
|
456
|
+
),
|
|
457
|
+
)
|
|
458
|
+
)
|
|
459
|
+
_response_json = _response.json()
|
|
460
|
+
except JSONDecodeError:
|
|
461
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
462
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
463
|
+
|
|
464
|
+
async def get_config_deployment_revision(
|
|
465
|
+
self,
|
|
466
|
+
deployment_revision_id: str,
|
|
467
|
+
*,
|
|
468
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
469
|
+
) -> typing.Optional[typing.Any]:
|
|
470
|
+
"""
|
|
471
|
+
Parameters
|
|
472
|
+
----------
|
|
473
|
+
deployment_revision_id : str
|
|
474
|
+
|
|
475
|
+
request_options : typing.Optional[RequestOptions]
|
|
476
|
+
Request-specific configuration.
|
|
477
|
+
|
|
478
|
+
Returns
|
|
479
|
+
-------
|
|
480
|
+
typing.Optional[typing.Any]
|
|
481
|
+
Successful Response
|
|
482
|
+
|
|
483
|
+
Examples
|
|
484
|
+
--------
|
|
485
|
+
import asyncio
|
|
486
|
+
|
|
487
|
+
from agenta import AsyncAgentaApi
|
|
488
|
+
|
|
489
|
+
client = AsyncAgentaApi(
|
|
490
|
+
api_key="YOUR_API_KEY",
|
|
491
|
+
base_url="https://yourhost.com/path/to/api",
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
async def main() -> None:
|
|
496
|
+
await client.configs.get_config_deployment_revision(
|
|
497
|
+
deployment_revision_id="deployment_revision_id",
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
asyncio.run(main())
|
|
502
|
+
"""
|
|
503
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
504
|
+
f"configs/deployment/{jsonable_encoder(deployment_revision_id)}",
|
|
505
|
+
method="GET",
|
|
506
|
+
request_options=request_options,
|
|
507
|
+
)
|
|
508
|
+
try:
|
|
509
|
+
if 200 <= _response.status_code < 300:
|
|
510
|
+
return typing.cast(
|
|
511
|
+
typing.Optional[typing.Any],
|
|
512
|
+
parse_obj_as(
|
|
513
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
514
|
+
object_=_response.json(),
|
|
515
|
+
),
|
|
516
|
+
)
|
|
517
|
+
if _response.status_code == 422:
|
|
518
|
+
raise UnprocessableEntityError(
|
|
519
|
+
typing.cast(
|
|
520
|
+
HttpValidationError,
|
|
521
|
+
parse_obj_as(
|
|
522
|
+
type_=HttpValidationError, # type: ignore
|
|
523
|
+
object_=_response.json(),
|
|
524
|
+
),
|
|
525
|
+
)
|
|
526
|
+
)
|
|
527
|
+
_response_json = _response.json()
|
|
528
|
+
except JSONDecodeError:
|
|
529
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
530
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
531
|
+
|
|
532
|
+
async def revert_deployment_revision(
|
|
533
|
+
self,
|
|
534
|
+
deployment_revision_id: str,
|
|
535
|
+
*,
|
|
536
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
537
|
+
) -> typing.Optional[typing.Any]:
|
|
538
|
+
"""
|
|
539
|
+
Parameters
|
|
540
|
+
----------
|
|
541
|
+
deployment_revision_id : str
|
|
542
|
+
|
|
543
|
+
request_options : typing.Optional[RequestOptions]
|
|
544
|
+
Request-specific configuration.
|
|
545
|
+
|
|
546
|
+
Returns
|
|
547
|
+
-------
|
|
548
|
+
typing.Optional[typing.Any]
|
|
549
|
+
Successful Response
|
|
550
|
+
|
|
551
|
+
Examples
|
|
552
|
+
--------
|
|
553
|
+
import asyncio
|
|
554
|
+
|
|
555
|
+
from agenta import AsyncAgentaApi
|
|
556
|
+
|
|
557
|
+
client = AsyncAgentaApi(
|
|
558
|
+
api_key="YOUR_API_KEY",
|
|
559
|
+
base_url="https://yourhost.com/path/to/api",
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
async def main() -> None:
|
|
564
|
+
await client.configs.revert_deployment_revision(
|
|
565
|
+
deployment_revision_id="deployment_revision_id",
|
|
566
|
+
)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
asyncio.run(main())
|
|
570
|
+
"""
|
|
571
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
572
|
+
f"configs/deployment/{jsonable_encoder(deployment_revision_id)}/revert",
|
|
573
|
+
method="POST",
|
|
574
|
+
request_options=request_options,
|
|
575
|
+
)
|
|
576
|
+
try:
|
|
577
|
+
if 200 <= _response.status_code < 300:
|
|
578
|
+
return typing.cast(
|
|
579
|
+
typing.Optional[typing.Any],
|
|
580
|
+
parse_obj_as(
|
|
581
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
582
|
+
object_=_response.json(),
|
|
583
|
+
),
|
|
584
|
+
)
|
|
585
|
+
if _response.status_code == 422:
|
|
586
|
+
raise UnprocessableEntityError(
|
|
587
|
+
typing.cast(
|
|
588
|
+
HttpValidationError,
|
|
589
|
+
parse_obj_as(
|
|
590
|
+
type_=HttpValidationError, # type: ignore
|
|
591
|
+
object_=_response.json(),
|
|
592
|
+
),
|
|
593
|
+
)
|
|
594
|
+
)
|
|
595
|
+
_response_json = _response.json()
|
|
596
|
+
except JSONDecodeError:
|
|
597
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
598
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|