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.

Files changed (132) hide show
  1. agenta/cli/variant_commands.py +15 -10
  2. agenta/client/Readme.md +72 -64
  3. agenta/client/api.py +1 -1
  4. agenta/client/backend/__init__.py +14 -9
  5. agenta/client/backend/apps/client.py +1669 -0
  6. agenta/client/backend/bases/client.py +190 -0
  7. agenta/client/backend/client.py +2102 -868
  8. agenta/client/backend/configs/client.py +598 -0
  9. agenta/client/backend/containers/client.py +638 -0
  10. agenta/client/backend/{resources/containers → containers}/types/container_templates_response.py +1 -2
  11. agenta/client/backend/core/__init__.py +29 -0
  12. agenta/client/backend/core/client_wrapper.py +42 -9
  13. agenta/client/backend/core/datetime_utils.py +1 -1
  14. agenta/client/backend/core/file.py +43 -0
  15. agenta/client/backend/core/http_client.py +553 -0
  16. agenta/client/backend/core/jsonable_encoder.py +33 -39
  17. agenta/client/backend/core/pydantic_utilities.py +212 -0
  18. agenta/client/backend/core/query_encoder.py +60 -0
  19. agenta/client/backend/core/remove_none_from_dict.py +2 -2
  20. agenta/client/backend/core/request_options.py +32 -0
  21. agenta/client/backend/core/serialization.py +179 -0
  22. agenta/client/backend/environments/client.py +190 -0
  23. agenta/client/backend/evaluations/client.py +1462 -0
  24. agenta/client/backend/evaluators/client.py +911 -0
  25. agenta/client/backend/observability/client.py +1271 -0
  26. agenta/client/backend/testsets/client.py +1132 -0
  27. agenta/client/backend/types/__init__.py +8 -6
  28. agenta/client/backend/types/aggregated_result.py +14 -29
  29. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -2
  30. agenta/client/backend/types/app.py +13 -28
  31. agenta/client/backend/types/app_variant_response.py +21 -37
  32. agenta/client/backend/types/app_variant_revision.py +17 -32
  33. agenta/client/backend/types/base_output.py +13 -28
  34. agenta/client/backend/types/body_import_testset.py +16 -31
  35. agenta/client/backend/types/config_db.py +16 -31
  36. agenta/client/backend/types/correct_answer.py +22 -0
  37. agenta/client/backend/types/create_app_output.py +13 -28
  38. agenta/client/backend/types/create_span.py +33 -50
  39. agenta/client/backend/types/create_trace_response.py +16 -31
  40. agenta/client/backend/types/docker_env_vars.py +13 -28
  41. agenta/client/backend/types/environment_output.py +21 -36
  42. agenta/client/backend/types/environment_output_extended.py +21 -36
  43. agenta/client/backend/types/environment_revision.py +18 -33
  44. agenta/client/backend/types/error.py +16 -31
  45. agenta/client/backend/types/evaluation.py +20 -34
  46. agenta/client/backend/types/evaluation_scenario.py +18 -33
  47. agenta/client/backend/types/evaluation_scenario_input.py +16 -31
  48. agenta/client/backend/types/evaluation_scenario_output.py +18 -33
  49. agenta/client/backend/types/evaluation_scenario_result.py +14 -29
  50. agenta/client/backend/types/evaluation_scenario_score_update.py +13 -28
  51. agenta/client/backend/types/evaluation_status_enum.py +11 -33
  52. agenta/client/backend/types/evaluation_type.py +3 -21
  53. agenta/client/backend/types/evaluator.py +18 -32
  54. agenta/client/backend/types/evaluator_config.py +20 -33
  55. agenta/client/backend/types/get_config_response.py +16 -31
  56. agenta/client/backend/types/http_validation_error.py +14 -29
  57. agenta/client/backend/types/human_evaluation.py +17 -32
  58. agenta/client/backend/types/human_evaluation_scenario.py +21 -37
  59. agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
  60. agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
  61. agenta/client/backend/types/human_evaluation_scenario_update.py +26 -41
  62. agenta/client/backend/types/human_evaluation_update.py +14 -29
  63. agenta/client/backend/types/image.py +18 -33
  64. agenta/client/backend/types/invite_request.py +13 -28
  65. agenta/client/backend/types/list_api_keys_response.py +18 -33
  66. agenta/client/backend/types/llm_run_rate_limit.py +13 -28
  67. agenta/client/backend/types/llm_tokens.py +16 -31
  68. agenta/client/backend/types/lm_providers_enum.py +21 -0
  69. agenta/client/backend/types/new_human_evaluation.py +13 -28
  70. agenta/client/backend/types/new_testset.py +16 -31
  71. agenta/client/backend/types/organization.py +22 -36
  72. agenta/client/backend/types/organization_output.py +13 -28
  73. agenta/client/backend/types/outputs.py +5 -0
  74. agenta/client/backend/types/permission.py +36 -137
  75. agenta/client/backend/types/result.py +17 -32
  76. agenta/client/backend/types/simple_evaluation_output.py +13 -28
  77. agenta/client/backend/types/span.py +23 -38
  78. agenta/client/backend/types/span_detail.py +26 -40
  79. agenta/client/backend/types/span_status_code.py +1 -25
  80. agenta/client/backend/types/span_variant.py +16 -31
  81. agenta/client/backend/types/template.py +14 -29
  82. agenta/client/backend/types/template_image_info.py +21 -35
  83. agenta/client/backend/types/test_set_output_response.py +16 -32
  84. agenta/client/backend/types/test_set_simple_response.py +13 -28
  85. agenta/client/backend/types/trace_detail.py +26 -40
  86. agenta/client/backend/types/update_app_output.py +22 -0
  87. agenta/client/backend/types/uri.py +13 -28
  88. agenta/client/backend/types/validation_error.py +13 -28
  89. agenta/client/backend/types/variant_action.py +14 -29
  90. agenta/client/backend/types/variant_action_enum.py +1 -19
  91. agenta/client/backend/types/with_pagination.py +14 -30
  92. agenta/client/backend/types/workspace_member_response.py +14 -29
  93. agenta/client/backend/types/workspace_permission.py +18 -33
  94. agenta/client/backend/types/workspace_response.py +20 -35
  95. agenta/client/backend/types/workspace_role.py +11 -37
  96. agenta/client/backend/types/workspace_role_response.py +17 -32
  97. agenta/client/backend/variants/client.py +1447 -0
  98. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
  99. agenta/sdk/decorators/llm_entrypoint.py +8 -13
  100. agenta/sdk/tracing/llm_tracing.py +1 -1
  101. {agenta-0.24.1a0.dist-info → agenta-0.24.2a1.dist-info}/METADATA +1 -1
  102. agenta-0.24.2a1.dist-info/RECORD +175 -0
  103. agenta/client/backend/resources/__init__.py +0 -31
  104. agenta/client/backend/resources/apps/client.py +0 -977
  105. agenta/client/backend/resources/bases/client.py +0 -127
  106. agenta/client/backend/resources/configs/client.py +0 -377
  107. agenta/client/backend/resources/containers/client.py +0 -383
  108. agenta/client/backend/resources/environments/client.py +0 -131
  109. agenta/client/backend/resources/evaluations/client.py +0 -1008
  110. agenta/client/backend/resources/evaluators/client.py +0 -594
  111. agenta/client/backend/resources/observability/client.py +0 -1187
  112. agenta/client/backend/resources/testsets/client.py +0 -689
  113. agenta/client/backend/resources/variants/client.py +0 -796
  114. agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -7
  115. agenta/client/backend/types/evaluation_webhook.py +0 -36
  116. agenta/client/backend/types/feedback.py +0 -40
  117. agenta/client/backend/types/span_kind.py +0 -49
  118. agenta-0.24.1a0.dist-info/RECORD +0 -169
  119. /agenta/client/backend/{resources/apps → apps}/__init__.py +0 -0
  120. /agenta/client/backend/{resources/bases → bases}/__init__.py +0 -0
  121. /agenta/client/backend/{resources/configs → configs}/__init__.py +0 -0
  122. /agenta/client/backend/{resources/containers → containers}/__init__.py +0 -0
  123. /agenta/client/backend/{resources/containers → containers}/types/__init__.py +0 -0
  124. /agenta/client/backend/{resources/environments → environments}/__init__.py +0 -0
  125. /agenta/client/backend/{resources/evaluations → evaluations}/__init__.py +0 -0
  126. /agenta/client/backend/{resources/evaluators → evaluators}/__init__.py +0 -0
  127. /agenta/client/backend/{resources/observability → observability}/__init__.py +0 -0
  128. /agenta/client/backend/{resources/testsets → testsets}/__init__.py +0 -0
  129. /agenta/client/backend/{resources/variants → variants}/__init__.py +0 -0
  130. /agenta/client/backend/{resources/variants → variants}/types/__init__.py +0 -0
  131. {agenta-0.24.1a0.dist-info → agenta-0.24.2a1.dist-info}/WHEEL +0 -0
  132. {agenta-0.24.1a0.dist-info → agenta-0.24.2a1.dist-info}/entry_points.txt +0 -0
@@ -1,127 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- import urllib.parse
5
- from json.decoder import JSONDecodeError
6
-
7
- from ...core.api_error import ApiError
8
- from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
- from ...core.remove_none_from_dict import remove_none_from_dict
10
- from ...errors.unprocessable_entity_error import UnprocessableEntityError
11
- from ...types.base_output import BaseOutput
12
- from ...types.http_validation_error import HttpValidationError
13
-
14
- try:
15
- import pydantic.v1 as pydantic # type: ignore
16
- except ImportError:
17
- import pydantic # type: ignore
18
-
19
-
20
- class BasesClient:
21
- def __init__(self, *, client_wrapper: SyncClientWrapper):
22
- self._client_wrapper = client_wrapper
23
-
24
- def list_bases(
25
- self,
26
- *,
27
- app_id: typing.Optional[str] = None,
28
- base_name: typing.Optional[str] = None,
29
- ) -> typing.List[BaseOutput]:
30
- """
31
- Retrieve a list of bases filtered by app_id and base_name.
32
-
33
- Args:
34
- request (Request): The incoming request.
35
- app_id (Optional[str], optional): The ID of the app to filter by. Defaults to None.
36
- base_name (Optional[str], optional): The name of the base to filter by. Defaults to None.
37
-
38
- Returns:
39
- List[BaseOutput]: A list of BaseOutput objects representing the filtered bases.
40
-
41
- Raises:
42
- HTTPException: If there was an error retrieving the bases.
43
-
44
- Parameters:
45
- - app_id: typing.Optional[str].
46
-
47
- - base_name: typing.Optional[str].
48
- ---
49
- from agenta.client import AgentaApi
50
-
51
- client = AgentaApi(
52
- api_key="YOUR_API_KEY",
53
- base_url="https://yourhost.com/path/to/api",
54
- )
55
- client.bases.list_bases()
56
- """
57
- _response = self._client_wrapper.httpx_client.request(
58
- "GET",
59
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "bases"),
60
- params=remove_none_from_dict({"app_id": app_id, "base_name": base_name}),
61
- headers=self._client_wrapper.get_headers(),
62
- timeout=60,
63
- )
64
- if 200 <= _response.status_code < 300:
65
- return pydantic.parse_obj_as(typing.List[BaseOutput], _response.json()) # type: ignore
66
- if _response.status_code == 422:
67
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
68
- try:
69
- _response_json = _response.json()
70
- except JSONDecodeError:
71
- raise ApiError(status_code=_response.status_code, body=_response.text)
72
- raise ApiError(status_code=_response.status_code, body=_response_json)
73
-
74
-
75
- class AsyncBasesClient:
76
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
77
- self._client_wrapper = client_wrapper
78
-
79
- async def list_bases(
80
- self,
81
- *,
82
- app_id: typing.Optional[str] = None,
83
- base_name: typing.Optional[str] = None,
84
- ) -> typing.List[BaseOutput]:
85
- """
86
- Retrieve a list of bases filtered by app_id and base_name.
87
-
88
- Args:
89
- request (Request): The incoming request.
90
- app_id (Optional[str], optional): The ID of the app to filter by. Defaults to None.
91
- base_name (Optional[str], optional): The name of the base to filter by. Defaults to None.
92
-
93
- Returns:
94
- List[BaseOutput]: A list of BaseOutput objects representing the filtered bases.
95
-
96
- Raises:
97
- HTTPException: If there was an error retrieving the bases.
98
-
99
- Parameters:
100
- - app_id: typing.Optional[str].
101
-
102
- - base_name: typing.Optional[str].
103
- ---
104
- from agenta.client import AsyncAgentaApi
105
-
106
- client = AsyncAgentaApi(
107
- api_key="YOUR_API_KEY",
108
- base_url="https://yourhost.com/path/to/api",
109
- )
110
- await client.bases.list_bases()
111
- """
112
- _response = await self._client_wrapper.httpx_client.request(
113
- "GET",
114
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "bases"),
115
- params=remove_none_from_dict({"app_id": app_id, "base_name": base_name}),
116
- headers=self._client_wrapper.get_headers(),
117
- timeout=60,
118
- )
119
- if 200 <= _response.status_code < 300:
120
- return pydantic.parse_obj_as(typing.List[BaseOutput], _response.json()) # type: ignore
121
- if _response.status_code == 422:
122
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
123
- try:
124
- _response_json = _response.json()
125
- except JSONDecodeError:
126
- raise ApiError(status_code=_response.status_code, body=_response.text)
127
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,377 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- import urllib.parse
5
- from json.decoder import JSONDecodeError
6
-
7
- from ...core.api_error import ApiError
8
- from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
- from ...core.jsonable_encoder import jsonable_encoder
10
- from ...core.remove_none_from_dict import remove_none_from_dict
11
- from ...errors.unprocessable_entity_error import UnprocessableEntityError
12
- from ...types.get_config_response import GetConfigResponse
13
- from ...types.http_validation_error import HttpValidationError
14
-
15
- try:
16
- import pydantic.v1 as pydantic # type: ignore
17
- except ImportError:
18
- import pydantic # type: ignore
19
-
20
- # this is used as the default value for optional parameters
21
- OMIT = typing.cast(typing.Any, ...)
22
-
23
-
24
- class ConfigsClient:
25
- def __init__(self, *, client_wrapper: SyncClientWrapper):
26
- self._client_wrapper = client_wrapper
27
-
28
- def get_config(
29
- self,
30
- *,
31
- base_id: str,
32
- config_name: typing.Optional[str] = None,
33
- environment_name: typing.Optional[str] = None,
34
- ) -> GetConfigResponse:
35
- """
36
- Parameters:
37
- - base_id: str.
38
-
39
- - config_name: typing.Optional[str].
40
-
41
- - environment_name: typing.Optional[str].
42
- ---
43
- from agenta.client import AgentaApi
44
-
45
- client = AgentaApi(
46
- api_key="YOUR_API_KEY",
47
- base_url="https://yourhost.com/path/to/api",
48
- )
49
- client.configs.get_config(
50
- base_id="base_id",
51
- )
52
- """
53
- _response = self._client_wrapper.httpx_client.request(
54
- "GET",
55
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
56
- params=remove_none_from_dict(
57
- {
58
- "base_id": base_id,
59
- "config_name": config_name,
60
- "environment_name": environment_name,
61
- }
62
- ),
63
- headers=self._client_wrapper.get_headers(),
64
- timeout=60,
65
- )
66
- if 200 <= _response.status_code < 300:
67
- return pydantic.parse_obj_as(GetConfigResponse, _response.json()) # type: ignore
68
- if _response.status_code == 422:
69
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
70
- try:
71
- _response_json = _response.json()
72
- except JSONDecodeError:
73
- raise ApiError(status_code=_response.status_code, body=_response.text)
74
- raise ApiError(status_code=_response.status_code, body=_response_json)
75
-
76
- def save_config(
77
- self,
78
- *,
79
- base_id: str,
80
- config_name: str,
81
- parameters: typing.Dict[str, typing.Any],
82
- overwrite: bool,
83
- ) -> typing.Any:
84
- """
85
- Parameters:
86
- - base_id: str.
87
-
88
- - config_name: str.
89
-
90
- - parameters: typing.Dict[str, typing.Any].
91
-
92
- - overwrite: bool.
93
- ---
94
- from agenta.client import AgentaApi
95
-
96
- client = AgentaApi(
97
- api_key="YOUR_API_KEY",
98
- base_url="https://yourhost.com/path/to/api",
99
- )
100
- client.configs.save_config(
101
- base_id="base_id",
102
- config_name="config_name",
103
- parameters={},
104
- overwrite=True,
105
- )
106
- """
107
- _response = self._client_wrapper.httpx_client.request(
108
- "POST",
109
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
110
- json=jsonable_encoder(
111
- {
112
- "base_id": base_id,
113
- "config_name": config_name,
114
- "parameters": parameters,
115
- "overwrite": overwrite,
116
- }
117
- ),
118
- headers=self._client_wrapper.get_headers(),
119
- timeout=60,
120
- )
121
- if 200 <= _response.status_code < 300:
122
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
123
- if _response.status_code == 422:
124
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
125
- try:
126
- _response_json = _response.json()
127
- except JSONDecodeError:
128
- raise ApiError(status_code=_response.status_code, body=_response.text)
129
- raise ApiError(status_code=_response.status_code, body=_response_json)
130
-
131
- def get_config_deployment_revision(self, deployment_revision_id: str) -> typing.Any:
132
- """
133
- Parameters:
134
- - deployment_revision_id: str.
135
- ---
136
- from agenta.client import AgentaApi
137
-
138
- client = AgentaApi(
139
- api_key="YOUR_API_KEY",
140
- base_url="https://yourhost.com/path/to/api",
141
- )
142
- client.configs.get_config_deployment_revision(
143
- deployment_revision_id="deployment_revision_id",
144
- )
145
- """
146
- _response = self._client_wrapper.httpx_client.request(
147
- "GET",
148
- urllib.parse.urljoin(
149
- f"{self._client_wrapper.get_base_url()}/",
150
- f"configs/deployment/{deployment_revision_id}",
151
- ),
152
- headers=self._client_wrapper.get_headers(),
153
- timeout=60,
154
- )
155
- if 200 <= _response.status_code < 300:
156
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
157
- if _response.status_code == 422:
158
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
159
- try:
160
- _response_json = _response.json()
161
- except JSONDecodeError:
162
- raise ApiError(status_code=_response.status_code, body=_response.text)
163
- raise ApiError(status_code=_response.status_code, body=_response_json)
164
-
165
- def revert_deployment_revision(self, deployment_revision_id: str) -> typing.Any:
166
- """
167
- Parameters:
168
- - deployment_revision_id: str.
169
- ---
170
- from agenta.client import AgentaApi
171
-
172
- client = AgentaApi(
173
- api_key="YOUR_API_KEY",
174
- base_url="https://yourhost.com/path/to/api",
175
- )
176
- client.configs.revert_deployment_revision(
177
- deployment_revision_id="deployment_revision_id",
178
- )
179
- """
180
- _response = self._client_wrapper.httpx_client.request(
181
- "POST",
182
- urllib.parse.urljoin(
183
- f"{self._client_wrapper.get_base_url()}/",
184
- f"configs/deployment/{deployment_revision_id}/revert",
185
- ),
186
- headers=self._client_wrapper.get_headers(),
187
- timeout=60,
188
- )
189
- if 200 <= _response.status_code < 300:
190
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
191
- if _response.status_code == 422:
192
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
193
- try:
194
- _response_json = _response.json()
195
- except JSONDecodeError:
196
- raise ApiError(status_code=_response.status_code, body=_response.text)
197
- raise ApiError(status_code=_response.status_code, body=_response_json)
198
-
199
-
200
- class AsyncConfigsClient:
201
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
202
- self._client_wrapper = client_wrapper
203
-
204
- async def get_config(
205
- self,
206
- *,
207
- base_id: str,
208
- config_name: typing.Optional[str] = None,
209
- environment_name: typing.Optional[str] = None,
210
- ) -> GetConfigResponse:
211
- """
212
- Parameters:
213
- - base_id: str.
214
-
215
- - config_name: typing.Optional[str].
216
-
217
- - environment_name: typing.Optional[str].
218
- ---
219
- from agenta.client import AsyncAgentaApi
220
-
221
- client = AsyncAgentaApi(
222
- api_key="YOUR_API_KEY",
223
- base_url="https://yourhost.com/path/to/api",
224
- )
225
- await client.configs.get_config(
226
- base_id="base_id",
227
- )
228
- """
229
- _response = await self._client_wrapper.httpx_client.request(
230
- "GET",
231
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
232
- params=remove_none_from_dict(
233
- {
234
- "base_id": base_id,
235
- "config_name": config_name,
236
- "environment_name": environment_name,
237
- }
238
- ),
239
- headers=self._client_wrapper.get_headers(),
240
- timeout=60,
241
- )
242
- if 200 <= _response.status_code < 300:
243
- return pydantic.parse_obj_as(GetConfigResponse, _response.json()) # type: ignore
244
- if _response.status_code == 422:
245
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
246
- try:
247
- _response_json = _response.json()
248
- except JSONDecodeError:
249
- raise ApiError(status_code=_response.status_code, body=_response.text)
250
- raise ApiError(status_code=_response.status_code, body=_response_json)
251
-
252
- async def save_config(
253
- self,
254
- *,
255
- base_id: str,
256
- config_name: str,
257
- parameters: typing.Dict[str, typing.Any],
258
- overwrite: bool,
259
- ) -> typing.Any:
260
- """
261
- Parameters:
262
- - base_id: str.
263
-
264
- - config_name: str.
265
-
266
- - parameters: typing.Dict[str, typing.Any].
267
-
268
- - overwrite: bool.
269
- ---
270
- from agenta.client import AsyncAgentaApi
271
-
272
- client = AsyncAgentaApi(
273
- api_key="YOUR_API_KEY",
274
- base_url="https://yourhost.com/path/to/api",
275
- )
276
- await client.configs.save_config(
277
- base_id="base_id",
278
- config_name="config_name",
279
- parameters={},
280
- overwrite=True,
281
- )
282
- """
283
- _response = await self._client_wrapper.httpx_client.request(
284
- "POST",
285
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "configs"),
286
- json=jsonable_encoder(
287
- {
288
- "base_id": base_id,
289
- "config_name": config_name,
290
- "parameters": parameters,
291
- "overwrite": overwrite,
292
- }
293
- ),
294
- headers=self._client_wrapper.get_headers(),
295
- timeout=60,
296
- )
297
- if 200 <= _response.status_code < 300:
298
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
299
- if _response.status_code == 422:
300
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
301
- try:
302
- _response_json = _response.json()
303
- except JSONDecodeError:
304
- raise ApiError(status_code=_response.status_code, body=_response.text)
305
- raise ApiError(status_code=_response.status_code, body=_response_json)
306
-
307
- async def get_config_deployment_revision(
308
- self, deployment_revision_id: str
309
- ) -> typing.Any:
310
- """
311
- Parameters:
312
- - deployment_revision_id: str.
313
- ---
314
- from agenta.client import AsyncAgentaApi
315
-
316
- client = AsyncAgentaApi(
317
- api_key="YOUR_API_KEY",
318
- base_url="https://yourhost.com/path/to/api",
319
- )
320
- await client.configs.get_config_deployment_revision(
321
- deployment_revision_id="deployment_revision_id",
322
- )
323
- """
324
- _response = await self._client_wrapper.httpx_client.request(
325
- "GET",
326
- urllib.parse.urljoin(
327
- f"{self._client_wrapper.get_base_url()}/",
328
- f"configs/deployment/{deployment_revision_id}",
329
- ),
330
- headers=self._client_wrapper.get_headers(),
331
- timeout=60,
332
- )
333
- if 200 <= _response.status_code < 300:
334
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
335
- if _response.status_code == 422:
336
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
337
- try:
338
- _response_json = _response.json()
339
- except JSONDecodeError:
340
- raise ApiError(status_code=_response.status_code, body=_response.text)
341
- raise ApiError(status_code=_response.status_code, body=_response_json)
342
-
343
- async def revert_deployment_revision(
344
- self, deployment_revision_id: str
345
- ) -> typing.Any:
346
- """
347
- Parameters:
348
- - deployment_revision_id: str.
349
- ---
350
- from agenta.client import AsyncAgentaApi
351
-
352
- client = AsyncAgentaApi(
353
- api_key="YOUR_API_KEY",
354
- base_url="https://yourhost.com/path/to/api",
355
- )
356
- await client.configs.revert_deployment_revision(
357
- deployment_revision_id="deployment_revision_id",
358
- )
359
- """
360
- _response = await self._client_wrapper.httpx_client.request(
361
- "POST",
362
- urllib.parse.urljoin(
363
- f"{self._client_wrapper.get_base_url()}/",
364
- f"configs/deployment/{deployment_revision_id}/revert",
365
- ),
366
- headers=self._client_wrapper.get_headers(),
367
- timeout=60,
368
- )
369
- if 200 <= _response.status_code < 300:
370
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
371
- if _response.status_code == 422:
372
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
373
- try:
374
- _response_json = _response.json()
375
- except JSONDecodeError:
376
- raise ApiError(status_code=_response.status_code, body=_response.text)
377
- raise ApiError(status_code=_response.status_code, body=_response_json)