agenta 0.12.3__py3-none-any.whl → 0.32.0a1__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 (244) hide show
  1. agenta/__init__.py +64 -7
  2. agenta/cli/helper.py +7 -3
  3. agenta/cli/main.py +15 -50
  4. agenta/cli/variant_commands.py +50 -29
  5. agenta/client/Readme.md +72 -64
  6. agenta/client/api.py +2 -2
  7. agenta/client/backend/__init__.py +193 -22
  8. agenta/client/backend/access_control/__init__.py +1 -0
  9. agenta/client/backend/access_control/client.py +167 -0
  10. agenta/client/backend/apps/__init__.py +1 -0
  11. agenta/client/backend/apps/client.py +1691 -0
  12. agenta/client/backend/bases/__init__.py +1 -0
  13. agenta/client/backend/bases/client.py +190 -0
  14. agenta/client/backend/client.py +2508 -5712
  15. agenta/client/backend/configs/__init__.py +1 -0
  16. agenta/client/backend/configs/client.py +604 -0
  17. agenta/client/backend/containers/__init__.py +5 -0
  18. agenta/client/backend/containers/client.py +648 -0
  19. agenta/client/backend/containers/types/__init__.py +5 -0
  20. agenta/client/backend/{types → containers/types}/container_templates_response.py +1 -2
  21. agenta/client/backend/core/__init__.py +30 -0
  22. agenta/client/backend/core/client_wrapper.py +42 -9
  23. agenta/client/backend/core/file.py +70 -0
  24. agenta/client/backend/core/http_client.py +575 -0
  25. agenta/client/backend/core/jsonable_encoder.py +33 -39
  26. agenta/client/backend/core/pydantic_utilities.py +325 -0
  27. agenta/client/backend/core/query_encoder.py +60 -0
  28. agenta/client/backend/core/remove_none_from_dict.py +2 -2
  29. agenta/client/backend/core/request_options.py +35 -0
  30. agenta/client/backend/core/serialization.py +276 -0
  31. agenta/client/backend/environments/__init__.py +1 -0
  32. agenta/client/backend/environments/client.py +196 -0
  33. agenta/client/backend/evaluations/__init__.py +1 -0
  34. agenta/client/backend/evaluations/client.py +1469 -0
  35. agenta/client/backend/evaluators/__init__.py +1 -0
  36. agenta/client/backend/evaluators/client.py +1283 -0
  37. agenta/client/backend/observability/__init__.py +1 -0
  38. agenta/client/backend/observability/client.py +1286 -0
  39. agenta/client/backend/observability_v_1/__init__.py +5 -0
  40. agenta/client/backend/observability_v_1/client.py +763 -0
  41. agenta/client/backend/observability_v_1/types/__init__.py +7 -0
  42. agenta/client/backend/observability_v_1/types/format.py +5 -0
  43. agenta/client/backend/observability_v_1/types/query_analytics_response.py +7 -0
  44. agenta/client/backend/observability_v_1/types/query_traces_response.py +11 -0
  45. agenta/client/backend/scopes/__init__.py +1 -0
  46. agenta/client/backend/scopes/client.py +114 -0
  47. agenta/client/backend/testsets/__init__.py +1 -0
  48. agenta/client/backend/testsets/client.py +1284 -0
  49. agenta/client/backend/types/__init__.py +154 -26
  50. agenta/client/backend/types/agenta_node_dto.py +48 -0
  51. agenta/client/backend/types/agenta_node_dto_nodes_value.py +6 -0
  52. agenta/client/backend/types/agenta_nodes_response.py +30 -0
  53. agenta/client/backend/types/agenta_root_dto.py +30 -0
  54. agenta/client/backend/types/agenta_roots_response.py +30 -0
  55. agenta/client/backend/types/agenta_tree_dto.py +30 -0
  56. agenta/client/backend/types/agenta_trees_response.py +30 -0
  57. agenta/client/backend/types/aggregated_result.py +16 -31
  58. agenta/client/backend/types/aggregated_result_evaluator_config.py +8 -0
  59. agenta/client/backend/types/analytics_response.py +24 -0
  60. agenta/client/backend/types/app.py +17 -30
  61. agenta/client/backend/types/app_variant_response.py +36 -0
  62. agenta/client/backend/types/app_variant_revision.py +17 -32
  63. agenta/client/backend/types/base_output.py +13 -28
  64. agenta/client/backend/types/body_import_testset.py +15 -31
  65. agenta/client/backend/types/bucket_dto.py +26 -0
  66. agenta/client/backend/types/collect_status_response.py +22 -0
  67. agenta/client/backend/types/config_db.py +16 -31
  68. agenta/client/backend/types/config_dto.py +32 -0
  69. agenta/client/backend/types/config_response_model.py +32 -0
  70. agenta/client/backend/types/correct_answer.py +22 -0
  71. agenta/client/backend/types/create_app_output.py +13 -28
  72. agenta/client/backend/types/create_span.py +45 -0
  73. agenta/client/backend/types/create_trace_response.py +22 -0
  74. agenta/client/backend/types/docker_env_vars.py +13 -28
  75. agenta/client/backend/types/environment_output.py +22 -34
  76. agenta/client/backend/types/environment_output_extended.py +31 -0
  77. agenta/client/backend/types/environment_revision.py +26 -0
  78. agenta/client/backend/types/error.py +22 -0
  79. agenta/client/backend/types/evaluation.py +22 -33
  80. agenta/client/backend/types/evaluation_scenario.py +18 -33
  81. agenta/client/backend/types/evaluation_scenario_input.py +16 -31
  82. agenta/client/backend/types/evaluation_scenario_output.py +17 -30
  83. agenta/client/backend/types/evaluation_scenario_result.py +14 -29
  84. agenta/client/backend/types/evaluation_scenario_score_update.py +21 -0
  85. agenta/client/backend/types/evaluation_status_enum.py +11 -29
  86. agenta/client/backend/types/evaluation_type.py +3 -21
  87. agenta/client/backend/types/evaluator.py +20 -31
  88. agenta/client/backend/types/evaluator_config.py +21 -33
  89. agenta/client/backend/types/evaluator_mapping_output_interface.py +21 -0
  90. agenta/client/backend/types/evaluator_output_interface.py +21 -0
  91. agenta/client/backend/types/exception_dto.py +26 -0
  92. agenta/client/backend/types/get_config_response.py +23 -0
  93. agenta/client/backend/types/header_dto.py +22 -0
  94. agenta/client/backend/types/http_validation_error.py +14 -29
  95. agenta/client/backend/types/human_evaluation.py +18 -34
  96. agenta/client/backend/types/human_evaluation_scenario.py +22 -38
  97. agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
  98. agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
  99. agenta/client/backend/types/human_evaluation_scenario_update.py +30 -0
  100. agenta/client/backend/types/human_evaluation_update.py +22 -0
  101. agenta/client/backend/types/image.py +18 -32
  102. agenta/client/backend/types/invite_request.py +16 -30
  103. agenta/client/backend/types/legacy_analytics_response.py +29 -0
  104. agenta/client/backend/types/legacy_data_point.py +27 -0
  105. agenta/client/backend/types/lifecycle_dto.py +24 -0
  106. agenta/client/backend/types/link_dto.py +24 -0
  107. agenta/client/backend/types/list_api_keys_response.py +24 -0
  108. agenta/client/backend/types/llm_run_rate_limit.py +13 -28
  109. agenta/client/backend/types/llm_tokens.py +23 -0
  110. agenta/client/backend/types/metrics_dto.py +24 -0
  111. agenta/client/backend/types/new_human_evaluation.py +27 -0
  112. agenta/client/backend/types/new_testset.py +16 -31
  113. agenta/client/backend/types/node_dto.py +24 -0
  114. agenta/client/backend/types/node_type.py +19 -0
  115. agenta/client/backend/types/o_tel_context_dto.py +22 -0
  116. agenta/client/backend/types/o_tel_event_dto.py +23 -0
  117. agenta/client/backend/types/o_tel_extra_dto.py +26 -0
  118. agenta/client/backend/types/o_tel_link_dto.py +23 -0
  119. agenta/client/backend/types/o_tel_span_dto.py +37 -0
  120. agenta/client/backend/types/o_tel_span_kind.py +15 -0
  121. agenta/client/backend/types/o_tel_spans_response.py +24 -0
  122. agenta/client/backend/types/o_tel_status_code.py +8 -0
  123. agenta/client/backend/types/organization.py +22 -35
  124. agenta/client/backend/types/organization_output.py +13 -28
  125. agenta/client/backend/types/outputs.py +5 -0
  126. agenta/client/backend/types/parent_dto.py +21 -0
  127. agenta/client/backend/types/permission.py +41 -0
  128. agenta/client/backend/types/projects_response.py +28 -0
  129. agenta/client/backend/types/provider_key_dto.py +23 -0
  130. agenta/client/backend/types/provider_kind.py +21 -0
  131. agenta/client/backend/types/reference_dto.py +23 -0
  132. agenta/client/backend/types/reference_request_model.py +23 -0
  133. agenta/client/backend/types/result.py +18 -31
  134. agenta/client/backend/types/root_dto.py +21 -0
  135. agenta/client/backend/types/{human_evaluation_scenario_score.py → score.py} +1 -1
  136. agenta/client/backend/types/secret_dto.py +24 -0
  137. agenta/client/backend/types/{human_evaluation_scenario_update_score.py → secret_kind.py} +1 -1
  138. agenta/client/backend/types/secret_response_dto.py +27 -0
  139. agenta/client/backend/types/simple_evaluation_output.py +13 -28
  140. agenta/client/backend/types/span.py +39 -49
  141. agenta/client/backend/types/span_detail.py +44 -0
  142. agenta/client/backend/types/span_dto.py +54 -0
  143. agenta/client/backend/types/span_dto_nodes_value.py +9 -0
  144. agenta/client/backend/types/span_status_code.py +5 -0
  145. agenta/client/backend/types/span_variant.py +23 -0
  146. agenta/client/backend/types/status_code.py +5 -0
  147. agenta/client/backend/types/status_dto.py +23 -0
  148. agenta/client/backend/types/template.py +14 -29
  149. agenta/client/backend/types/template_image_info.py +21 -35
  150. agenta/client/backend/types/test_set_output_response.py +20 -33
  151. agenta/client/backend/types/test_set_simple_response.py +13 -28
  152. agenta/client/backend/types/time_dto.py +23 -0
  153. agenta/client/backend/types/trace_detail.py +44 -0
  154. agenta/client/backend/types/tree_dto.py +23 -0
  155. agenta/client/backend/types/tree_type.py +5 -0
  156. agenta/client/backend/types/update_app_output.py +22 -0
  157. agenta/client/backend/types/uri.py +13 -28
  158. agenta/client/backend/types/validation_error.py +13 -28
  159. agenta/client/backend/types/variant_action.py +14 -29
  160. agenta/client/backend/types/variant_action_enum.py +1 -19
  161. agenta/client/backend/types/with_pagination.py +26 -0
  162. agenta/client/backend/types/workspace_member_response.py +23 -0
  163. agenta/client/backend/types/workspace_permission.py +25 -0
  164. agenta/client/backend/types/workspace_response.py +29 -0
  165. agenta/client/backend/types/workspace_role.py +15 -0
  166. agenta/client/backend/types/workspace_role_response.py +23 -0
  167. agenta/client/backend/variants/__init__.py +5 -0
  168. agenta/client/backend/variants/client.py +2814 -0
  169. agenta/client/backend/variants/types/__init__.py +7 -0
  170. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
  171. agenta/client/backend/vault/__init__.py +1 -0
  172. agenta/client/backend/vault/client.py +685 -0
  173. agenta/client/client.py +1 -1
  174. agenta/config.py +0 -2
  175. agenta/config.toml +0 -1
  176. agenta/docker/docker-assets/Dockerfile.cloud.template +2 -1
  177. agenta/docker/docker-assets/Dockerfile.template +2 -1
  178. agenta/docker/docker_utils.py +11 -12
  179. agenta/sdk/__init__.py +58 -7
  180. agenta/sdk/agenta_init.py +182 -164
  181. agenta/sdk/assets.py +95 -0
  182. agenta/sdk/client.py +56 -0
  183. agenta/sdk/context/__init__.py +0 -0
  184. agenta/sdk/context/exporting.py +25 -0
  185. agenta/sdk/context/routing.py +27 -0
  186. agenta/sdk/context/tracing.py +28 -0
  187. agenta/sdk/decorators/__init__.py +0 -0
  188. agenta/sdk/decorators/routing.py +576 -0
  189. agenta/sdk/decorators/tracing.py +296 -0
  190. agenta/sdk/litellm/__init__.py +1 -0
  191. agenta/sdk/litellm/litellm.py +314 -0
  192. agenta/sdk/litellm/mockllm.py +27 -0
  193. agenta/sdk/litellm/mocks/__init__.py +26 -0
  194. agenta/sdk/managers/__init__.py +6 -0
  195. agenta/sdk/managers/config.py +208 -0
  196. agenta/sdk/managers/deployment.py +45 -0
  197. agenta/sdk/managers/secrets.py +38 -0
  198. agenta/sdk/managers/shared.py +639 -0
  199. agenta/sdk/managers/variant.py +182 -0
  200. agenta/sdk/managers/vault.py +16 -0
  201. agenta/sdk/middleware/__init__.py +0 -0
  202. agenta/sdk/middleware/auth.py +180 -0
  203. agenta/sdk/middleware/cache.py +47 -0
  204. agenta/sdk/middleware/config.py +255 -0
  205. agenta/sdk/middleware/cors.py +29 -0
  206. agenta/sdk/middleware/inline.py +38 -0
  207. agenta/sdk/middleware/mock.py +33 -0
  208. agenta/sdk/middleware/otel.py +40 -0
  209. agenta/sdk/middleware/vault.py +145 -0
  210. agenta/sdk/router.py +0 -7
  211. agenta/sdk/tracing/__init__.py +1 -0
  212. agenta/sdk/tracing/attributes.py +141 -0
  213. agenta/sdk/tracing/conventions.py +49 -0
  214. agenta/sdk/tracing/exporters.py +103 -0
  215. agenta/sdk/tracing/inline.py +1146 -0
  216. agenta/sdk/tracing/processors.py +121 -0
  217. agenta/sdk/tracing/spans.py +136 -0
  218. agenta/sdk/tracing/tracing.py +237 -0
  219. agenta/sdk/types.py +478 -74
  220. agenta/sdk/utils/__init__.py +0 -0
  221. agenta/sdk/utils/constants.py +1 -0
  222. agenta/sdk/utils/{helper/openai_cost.py → costs.py} +3 -0
  223. agenta/sdk/utils/exceptions.py +59 -0
  224. agenta/sdk/utils/globals.py +6 -10
  225. agenta/sdk/utils/helpers.py +8 -0
  226. agenta/sdk/utils/logging.py +21 -0
  227. agenta/sdk/utils/singleton.py +13 -0
  228. agenta/sdk/utils/timing.py +58 -0
  229. {agenta-0.12.3.dist-info → agenta-0.32.0a1.dist-info}/METADATA +98 -151
  230. agenta-0.32.0a1.dist-info/RECORD +263 -0
  231. {agenta-0.12.3.dist-info → agenta-0.32.0a1.dist-info}/WHEEL +1 -1
  232. agenta/client/backend/types/add_variant_from_base_and_config_response.py +0 -7
  233. agenta/client/backend/types/app_variant_output.py +0 -47
  234. agenta/client/backend/types/app_variant_output_extended.py +0 -50
  235. agenta/client/backend/types/delete_evaluation.py +0 -36
  236. agenta/client/backend/types/evaluation_webhook.py +0 -36
  237. agenta/client/backend/types/feedback.py +0 -40
  238. agenta/client/backend/types/get_config_reponse.py +0 -39
  239. agenta/client/backend/types/list_api_keys_output.py +0 -39
  240. agenta/client/backend/types/trace.py +0 -48
  241. agenta/sdk/agenta_decorator.py +0 -443
  242. agenta/sdk/context.py +0 -41
  243. agenta-0.12.3.dist-info/RECORD +0 -114
  244. {agenta-0.12.3.dist-info → agenta-0.32.0a1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1 @@
1
+ # This file was auto-generated by Fern from our API Definition.
@@ -0,0 +1,604 @@
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
+ headers={
147
+ "content-type": "application/json",
148
+ },
149
+ request_options=request_options,
150
+ omit=OMIT,
151
+ )
152
+ try:
153
+ if 200 <= _response.status_code < 300:
154
+ return typing.cast(
155
+ typing.Optional[typing.Any],
156
+ parse_obj_as(
157
+ type_=typing.Optional[typing.Any], # type: ignore
158
+ object_=_response.json(),
159
+ ),
160
+ )
161
+ if _response.status_code == 422:
162
+ raise UnprocessableEntityError(
163
+ typing.cast(
164
+ HttpValidationError,
165
+ parse_obj_as(
166
+ type_=HttpValidationError, # type: ignore
167
+ object_=_response.json(),
168
+ ),
169
+ )
170
+ )
171
+ _response_json = _response.json()
172
+ except JSONDecodeError:
173
+ raise ApiError(status_code=_response.status_code, body=_response.text)
174
+ raise ApiError(status_code=_response.status_code, body=_response_json)
175
+
176
+ def get_config_deployment_revision(
177
+ self,
178
+ deployment_revision_id: str,
179
+ *,
180
+ request_options: typing.Optional[RequestOptions] = None,
181
+ ) -> typing.Optional[typing.Any]:
182
+ """
183
+ Parameters
184
+ ----------
185
+ deployment_revision_id : str
186
+
187
+ request_options : typing.Optional[RequestOptions]
188
+ Request-specific configuration.
189
+
190
+ Returns
191
+ -------
192
+ typing.Optional[typing.Any]
193
+ Successful Response
194
+
195
+ Examples
196
+ --------
197
+ from agenta import AgentaApi
198
+
199
+ client = AgentaApi(
200
+ api_key="YOUR_API_KEY",
201
+ base_url="https://yourhost.com/path/to/api",
202
+ )
203
+ client.configs.get_config_deployment_revision(
204
+ deployment_revision_id="deployment_revision_id",
205
+ )
206
+ """
207
+ _response = self._client_wrapper.httpx_client.request(
208
+ f"configs/deployment/{jsonable_encoder(deployment_revision_id)}",
209
+ method="GET",
210
+ request_options=request_options,
211
+ )
212
+ try:
213
+ if 200 <= _response.status_code < 300:
214
+ return typing.cast(
215
+ typing.Optional[typing.Any],
216
+ parse_obj_as(
217
+ type_=typing.Optional[typing.Any], # type: ignore
218
+ object_=_response.json(),
219
+ ),
220
+ )
221
+ if _response.status_code == 422:
222
+ raise UnprocessableEntityError(
223
+ typing.cast(
224
+ HttpValidationError,
225
+ parse_obj_as(
226
+ type_=HttpValidationError, # type: ignore
227
+ object_=_response.json(),
228
+ ),
229
+ )
230
+ )
231
+ _response_json = _response.json()
232
+ except JSONDecodeError:
233
+ raise ApiError(status_code=_response.status_code, body=_response.text)
234
+ raise ApiError(status_code=_response.status_code, body=_response_json)
235
+
236
+ def revert_deployment_revision(
237
+ self,
238
+ deployment_revision_id: str,
239
+ *,
240
+ request_options: typing.Optional[RequestOptions] = None,
241
+ ) -> typing.Optional[typing.Any]:
242
+ """
243
+ Parameters
244
+ ----------
245
+ deployment_revision_id : str
246
+
247
+ request_options : typing.Optional[RequestOptions]
248
+ Request-specific configuration.
249
+
250
+ Returns
251
+ -------
252
+ typing.Optional[typing.Any]
253
+ Successful Response
254
+
255
+ Examples
256
+ --------
257
+ from agenta import AgentaApi
258
+
259
+ client = AgentaApi(
260
+ api_key="YOUR_API_KEY",
261
+ base_url="https://yourhost.com/path/to/api",
262
+ )
263
+ client.configs.revert_deployment_revision(
264
+ deployment_revision_id="deployment_revision_id",
265
+ )
266
+ """
267
+ _response = self._client_wrapper.httpx_client.request(
268
+ f"configs/deployment/{jsonable_encoder(deployment_revision_id)}/revert",
269
+ method="POST",
270
+ request_options=request_options,
271
+ )
272
+ try:
273
+ if 200 <= _response.status_code < 300:
274
+ return typing.cast(
275
+ typing.Optional[typing.Any],
276
+ parse_obj_as(
277
+ type_=typing.Optional[typing.Any], # type: ignore
278
+ object_=_response.json(),
279
+ ),
280
+ )
281
+ if _response.status_code == 422:
282
+ raise UnprocessableEntityError(
283
+ typing.cast(
284
+ HttpValidationError,
285
+ parse_obj_as(
286
+ type_=HttpValidationError, # type: ignore
287
+ object_=_response.json(),
288
+ ),
289
+ )
290
+ )
291
+ _response_json = _response.json()
292
+ except JSONDecodeError:
293
+ raise ApiError(status_code=_response.status_code, body=_response.text)
294
+ raise ApiError(status_code=_response.status_code, body=_response_json)
295
+
296
+
297
+ class AsyncConfigsClient:
298
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
299
+ self._client_wrapper = client_wrapper
300
+
301
+ async def get_config(
302
+ self,
303
+ *,
304
+ base_id: str,
305
+ config_name: typing.Optional[str] = None,
306
+ environment_name: typing.Optional[str] = None,
307
+ request_options: typing.Optional[RequestOptions] = None,
308
+ ) -> GetConfigResponse:
309
+ """
310
+ Parameters
311
+ ----------
312
+ base_id : str
313
+
314
+ config_name : typing.Optional[str]
315
+
316
+ environment_name : typing.Optional[str]
317
+
318
+ request_options : typing.Optional[RequestOptions]
319
+ Request-specific configuration.
320
+
321
+ Returns
322
+ -------
323
+ GetConfigResponse
324
+ Successful Response
325
+
326
+ Examples
327
+ --------
328
+ import asyncio
329
+
330
+ from agenta import AsyncAgentaApi
331
+
332
+ client = AsyncAgentaApi(
333
+ api_key="YOUR_API_KEY",
334
+ base_url="https://yourhost.com/path/to/api",
335
+ )
336
+
337
+
338
+ async def main() -> None:
339
+ await client.configs.get_config(
340
+ base_id="base_id",
341
+ )
342
+
343
+
344
+ asyncio.run(main())
345
+ """
346
+ _response = await self._client_wrapper.httpx_client.request(
347
+ "configs",
348
+ method="GET",
349
+ params={
350
+ "base_id": base_id,
351
+ "config_name": config_name,
352
+ "environment_name": environment_name,
353
+ },
354
+ request_options=request_options,
355
+ )
356
+ try:
357
+ if 200 <= _response.status_code < 300:
358
+ return typing.cast(
359
+ GetConfigResponse,
360
+ parse_obj_as(
361
+ type_=GetConfigResponse, # type: ignore
362
+ object_=_response.json(),
363
+ ),
364
+ )
365
+ if _response.status_code == 422:
366
+ raise UnprocessableEntityError(
367
+ typing.cast(
368
+ HttpValidationError,
369
+ parse_obj_as(
370
+ type_=HttpValidationError, # type: ignore
371
+ object_=_response.json(),
372
+ ),
373
+ )
374
+ )
375
+ _response_json = _response.json()
376
+ except JSONDecodeError:
377
+ raise ApiError(status_code=_response.status_code, body=_response.text)
378
+ raise ApiError(status_code=_response.status_code, body=_response_json)
379
+
380
+ async def save_config(
381
+ self,
382
+ *,
383
+ base_id: str,
384
+ config_name: str,
385
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
386
+ overwrite: bool,
387
+ request_options: typing.Optional[RequestOptions] = None,
388
+ ) -> typing.Optional[typing.Any]:
389
+ """
390
+ Parameters
391
+ ----------
392
+ base_id : str
393
+
394
+ config_name : str
395
+
396
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
397
+
398
+ overwrite : bool
399
+
400
+ request_options : typing.Optional[RequestOptions]
401
+ Request-specific configuration.
402
+
403
+ Returns
404
+ -------
405
+ typing.Optional[typing.Any]
406
+ Successful Response
407
+
408
+ Examples
409
+ --------
410
+ import asyncio
411
+
412
+ from agenta import AsyncAgentaApi
413
+
414
+ client = AsyncAgentaApi(
415
+ api_key="YOUR_API_KEY",
416
+ base_url="https://yourhost.com/path/to/api",
417
+ )
418
+
419
+
420
+ async def main() -> None:
421
+ await client.configs.save_config(
422
+ base_id="base_id",
423
+ config_name="config_name",
424
+ parameters={"key": "value"},
425
+ overwrite=True,
426
+ )
427
+
428
+
429
+ asyncio.run(main())
430
+ """
431
+ _response = await self._client_wrapper.httpx_client.request(
432
+ "configs",
433
+ method="POST",
434
+ json={
435
+ "base_id": base_id,
436
+ "config_name": config_name,
437
+ "parameters": parameters,
438
+ "overwrite": overwrite,
439
+ },
440
+ headers={
441
+ "content-type": "application/json",
442
+ },
443
+ request_options=request_options,
444
+ omit=OMIT,
445
+ )
446
+ try:
447
+ if 200 <= _response.status_code < 300:
448
+ return typing.cast(
449
+ typing.Optional[typing.Any],
450
+ parse_obj_as(
451
+ type_=typing.Optional[typing.Any], # type: ignore
452
+ object_=_response.json(),
453
+ ),
454
+ )
455
+ if _response.status_code == 422:
456
+ raise UnprocessableEntityError(
457
+ typing.cast(
458
+ HttpValidationError,
459
+ parse_obj_as(
460
+ type_=HttpValidationError, # type: ignore
461
+ object_=_response.json(),
462
+ ),
463
+ )
464
+ )
465
+ _response_json = _response.json()
466
+ except JSONDecodeError:
467
+ raise ApiError(status_code=_response.status_code, body=_response.text)
468
+ raise ApiError(status_code=_response.status_code, body=_response_json)
469
+
470
+ async def get_config_deployment_revision(
471
+ self,
472
+ deployment_revision_id: str,
473
+ *,
474
+ request_options: typing.Optional[RequestOptions] = None,
475
+ ) -> typing.Optional[typing.Any]:
476
+ """
477
+ Parameters
478
+ ----------
479
+ deployment_revision_id : str
480
+
481
+ request_options : typing.Optional[RequestOptions]
482
+ Request-specific configuration.
483
+
484
+ Returns
485
+ -------
486
+ typing.Optional[typing.Any]
487
+ Successful Response
488
+
489
+ Examples
490
+ --------
491
+ import asyncio
492
+
493
+ from agenta import AsyncAgentaApi
494
+
495
+ client = AsyncAgentaApi(
496
+ api_key="YOUR_API_KEY",
497
+ base_url="https://yourhost.com/path/to/api",
498
+ )
499
+
500
+
501
+ async def main() -> None:
502
+ await client.configs.get_config_deployment_revision(
503
+ deployment_revision_id="deployment_revision_id",
504
+ )
505
+
506
+
507
+ asyncio.run(main())
508
+ """
509
+ _response = await self._client_wrapper.httpx_client.request(
510
+ f"configs/deployment/{jsonable_encoder(deployment_revision_id)}",
511
+ method="GET",
512
+ request_options=request_options,
513
+ )
514
+ try:
515
+ if 200 <= _response.status_code < 300:
516
+ return typing.cast(
517
+ typing.Optional[typing.Any],
518
+ parse_obj_as(
519
+ type_=typing.Optional[typing.Any], # type: ignore
520
+ object_=_response.json(),
521
+ ),
522
+ )
523
+ if _response.status_code == 422:
524
+ raise UnprocessableEntityError(
525
+ typing.cast(
526
+ HttpValidationError,
527
+ parse_obj_as(
528
+ type_=HttpValidationError, # type: ignore
529
+ object_=_response.json(),
530
+ ),
531
+ )
532
+ )
533
+ _response_json = _response.json()
534
+ except JSONDecodeError:
535
+ raise ApiError(status_code=_response.status_code, body=_response.text)
536
+ raise ApiError(status_code=_response.status_code, body=_response_json)
537
+
538
+ async def revert_deployment_revision(
539
+ self,
540
+ deployment_revision_id: str,
541
+ *,
542
+ request_options: typing.Optional[RequestOptions] = None,
543
+ ) -> typing.Optional[typing.Any]:
544
+ """
545
+ Parameters
546
+ ----------
547
+ deployment_revision_id : str
548
+
549
+ request_options : typing.Optional[RequestOptions]
550
+ Request-specific configuration.
551
+
552
+ Returns
553
+ -------
554
+ typing.Optional[typing.Any]
555
+ Successful Response
556
+
557
+ Examples
558
+ --------
559
+ import asyncio
560
+
561
+ from agenta import AsyncAgentaApi
562
+
563
+ client = AsyncAgentaApi(
564
+ api_key="YOUR_API_KEY",
565
+ base_url="https://yourhost.com/path/to/api",
566
+ )
567
+
568
+
569
+ async def main() -> None:
570
+ await client.configs.revert_deployment_revision(
571
+ deployment_revision_id="deployment_revision_id",
572
+ )
573
+
574
+
575
+ asyncio.run(main())
576
+ """
577
+ _response = await self._client_wrapper.httpx_client.request(
578
+ f"configs/deployment/{jsonable_encoder(deployment_revision_id)}/revert",
579
+ method="POST",
580
+ request_options=request_options,
581
+ )
582
+ try:
583
+ if 200 <= _response.status_code < 300:
584
+ return typing.cast(
585
+ typing.Optional[typing.Any],
586
+ parse_obj_as(
587
+ type_=typing.Optional[typing.Any], # type: ignore
588
+ object_=_response.json(),
589
+ ),
590
+ )
591
+ if _response.status_code == 422:
592
+ raise UnprocessableEntityError(
593
+ typing.cast(
594
+ HttpValidationError,
595
+ parse_obj_as(
596
+ type_=HttpValidationError, # type: ignore
597
+ object_=_response.json(),
598
+ ),
599
+ )
600
+ )
601
+ _response_json = _response.json()
602
+ except JSONDecodeError:
603
+ raise ApiError(status_code=_response.status_code, body=_response.text)
604
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import ContainerTemplatesResponse
4
+
5
+ __all__ = ["ContainerTemplatesResponse"]