agenta 0.48.8__py3-none-any.whl → 0.48.10__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 (297) hide show
  1. agenta/__init__.py +3 -2
  2. agenta/client/Readme.md +258 -80
  3. agenta/client/__init__.py +205 -29
  4. agenta/client/backend/__init__.py +461 -0
  5. agenta/client/backend/access_control/__init__.py +2 -0
  6. agenta/client/backend/access_control/client.py +53 -73
  7. agenta/client/backend/access_control/raw_client.py +180 -0
  8. agenta/client/backend/admin/__init__.py +2 -0
  9. agenta/client/backend/admin/client.py +473 -268
  10. agenta/client/backend/admin/raw_client.py +1017 -0
  11. agenta/client/backend/api_keys/__init__.py +2 -0
  12. agenta/client/backend/api_keys/client.py +43 -276
  13. agenta/client/backend/api_keys/raw_client.py +364 -0
  14. agenta/client/backend/apps/__init__.py +2 -0
  15. agenta/client/backend/apps/client.py +132 -895
  16. agenta/client/backend/apps/raw_client.py +1516 -0
  17. agenta/client/backend/bases/__init__.py +2 -0
  18. agenta/client/backend/bases/client.py +33 -73
  19. agenta/client/backend/bases/raw_client.py +179 -0
  20. agenta/client/backend/billing/__init__.py +3 -0
  21. agenta/client/backend/billing/client.py +564 -0
  22. agenta/client/backend/billing/raw_client.py +805 -0
  23. agenta/client/backend/client.py +1268 -0
  24. agenta/client/backend/configs/__init__.py +2 -0
  25. agenta/client/backend/configs/client.py +49 -361
  26. agenta/client/backend/configs/raw_client.py +402 -0
  27. agenta/client/backend/containers/__init__.py +1 -3
  28. agenta/client/backend/containers/client.py +25 -548
  29. agenta/client/backend/containers/raw_client.py +112 -0
  30. agenta/client/backend/core/__init__.py +5 -0
  31. agenta/client/backend/core/api_error.py +12 -6
  32. agenta/client/backend/core/client_wrapper.py +4 -4
  33. agenta/client/backend/core/file.py +1 -3
  34. agenta/client/backend/core/force_multipart.py +16 -0
  35. agenta/client/backend/core/http_client.py +78 -34
  36. agenta/client/backend/core/http_response.py +55 -0
  37. agenta/client/backend/core/jsonable_encoder.py +0 -1
  38. agenta/client/backend/core/pydantic_utilities.py +88 -113
  39. agenta/client/backend/core/serialization.py +9 -3
  40. agenta/client/backend/environment.py +7 -0
  41. agenta/client/backend/environments/__init__.py +2 -0
  42. agenta/client/backend/environments/client.py +43 -79
  43. agenta/client/backend/environments/raw_client.py +193 -0
  44. agenta/client/backend/errors/__init__.py +2 -0
  45. agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
  46. agenta/client/backend/evals/__init__.py +3 -0
  47. agenta/client/backend/evals/client.py +1042 -0
  48. agenta/client/backend/evals/raw_client.py +1549 -0
  49. agenta/client/backend/evaluations/__init__.py +2 -0
  50. agenta/client/backend/evaluations/client.py +106 -590
  51. agenta/client/backend/evaluations/raw_client.py +1344 -0
  52. agenta/client/backend/evaluators/__init__.py +2 -0
  53. agenta/client/backend/evaluators/client.py +99 -516
  54. agenta/client/backend/evaluators/raw_client.py +1182 -0
  55. agenta/client/backend/human_evaluations/__init__.py +2 -0
  56. agenta/client/backend/human_evaluations/client.py +120 -680
  57. agenta/client/backend/human_evaluations/raw_client.py +1577 -0
  58. agenta/client/backend/observability/__init__.py +14 -2
  59. agenta/client/backend/observability/client.py +185 -341
  60. agenta/client/backend/observability/raw_client.py +943 -0
  61. agenta/client/backend/observability/types/__init__.py +10 -2
  62. agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
  63. agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
  64. agenta/client/backend/observability/types/query_analytics_response.py +2 -1
  65. agenta/client/backend/observability/types/query_traces_response.py +7 -3
  66. agenta/client/backend/organization/__init__.py +2 -0
  67. agenta/client/backend/organization/client.py +105 -361
  68. agenta/client/backend/organization/raw_client.py +774 -0
  69. agenta/client/backend/raw_client.py +1432 -0
  70. agenta/client/backend/scopes/__init__.py +2 -0
  71. agenta/client/backend/scopes/client.py +31 -45
  72. agenta/client/backend/scopes/raw_client.py +105 -0
  73. agenta/client/backend/testsets/__init__.py +14 -0
  74. agenta/client/backend/testsets/client.py +1098 -653
  75. agenta/client/backend/testsets/raw_client.py +2348 -0
  76. agenta/client/backend/testsets/types/__init__.py +17 -0
  77. agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
  78. agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
  79. agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
  80. agenta/client/backend/tracing/__init__.py +7 -0
  81. agenta/client/backend/tracing/client.py +782 -0
  82. agenta/client/backend/tracing/raw_client.py +1223 -0
  83. agenta/client/backend/tracing/types/__init__.py +8 -0
  84. agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
  85. agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
  86. agenta/client/backend/types/__init__.py +153 -26
  87. agenta/client/backend/types/account_request.py +24 -0
  88. agenta/client/backend/types/account_response.py +5 -7
  89. agenta/client/backend/types/agenta_node_dto.py +13 -13
  90. agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
  91. agenta/client/backend/types/agenta_nodes_response.py +14 -8
  92. agenta/client/backend/types/agenta_root_dto.py +16 -8
  93. agenta/client/backend/types/agenta_roots_response.py +16 -8
  94. agenta/client/backend/types/agenta_tree_dto.py +16 -8
  95. agenta/client/backend/types/agenta_trees_response.py +16 -8
  96. agenta/client/backend/types/aggregated_result.py +5 -7
  97. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
  98. agenta/client/backend/types/analytics_response.py +4 -6
  99. agenta/client/backend/types/annotation.py +50 -0
  100. agenta/client/backend/types/annotation_create.py +39 -0
  101. agenta/client/backend/types/annotation_edit.py +31 -0
  102. agenta/client/backend/types/annotation_kind.py +5 -0
  103. agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
  104. agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
  105. agenta/client/backend/types/annotation_query.py +40 -0
  106. agenta/client/backend/types/annotation_query_request.py +20 -0
  107. agenta/client/backend/types/annotation_reference.py +21 -0
  108. agenta/client/backend/types/annotation_references.py +22 -0
  109. agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
  110. agenta/client/backend/types/annotation_source.py +5 -0
  111. agenta/client/backend/types/annotations_response.py +24 -0
  112. agenta/client/backend/types/app.py +3 -5
  113. agenta/client/backend/types/app_variant_response.py +3 -6
  114. agenta/client/backend/types/app_variant_revision.py +5 -6
  115. agenta/client/backend/types/artifact.py +44 -0
  116. agenta/client/backend/types/base_output.py +3 -5
  117. agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
  118. agenta/client/backend/types/body_import_testset.py +3 -5
  119. agenta/client/backend/types/bucket_dto.py +4 -6
  120. agenta/client/backend/types/collect_status_response.py +3 -5
  121. agenta/client/backend/types/config_db.py +3 -5
  122. agenta/client/backend/types/config_dto.py +5 -7
  123. agenta/client/backend/types/config_response_model.py +5 -7
  124. agenta/client/backend/types/correct_answer.py +3 -5
  125. agenta/client/backend/types/create_app_output.py +3 -5
  126. agenta/client/backend/types/custom_model_settings_dto.py +3 -5
  127. agenta/client/backend/types/custom_provider_dto.py +6 -9
  128. agenta/client/backend/types/custom_provider_kind.py +5 -5
  129. agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
  130. agenta/client/backend/types/data.py +2 -1
  131. agenta/client/backend/types/delete_evaluation.py +3 -5
  132. agenta/client/backend/types/environment_output.py +3 -5
  133. agenta/client/backend/types/environment_output_extended.py +4 -6
  134. agenta/client/backend/types/environment_revision.py +5 -5
  135. agenta/client/backend/types/error.py +3 -5
  136. agenta/client/backend/types/evaluation.py +6 -8
  137. agenta/client/backend/types/evaluation_scenario.py +5 -7
  138. agenta/client/backend/types/evaluation_scenario_input.py +3 -5
  139. agenta/client/backend/types/evaluation_scenario_output.py +4 -6
  140. agenta/client/backend/types/evaluation_scenario_result.py +4 -6
  141. agenta/client/backend/types/evaluator.py +31 -12
  142. agenta/client/backend/types/evaluator_config.py +3 -5
  143. agenta/client/backend/types/evaluator_flags.py +21 -0
  144. agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
  145. agenta/client/backend/types/evaluator_output_interface.py +3 -5
  146. agenta/client/backend/types/evaluator_query.py +32 -0
  147. agenta/client/backend/types/evaluator_query_request.py +30 -0
  148. agenta/client/backend/types/evaluator_request.py +20 -0
  149. agenta/client/backend/types/evaluator_response.py +21 -0
  150. agenta/client/backend/types/evaluators_response.py +21 -0
  151. agenta/client/backend/types/exception_dto.py +3 -5
  152. agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
  153. agenta/client/backend/types/focus.py +5 -0
  154. agenta/client/backend/types/format.py +5 -0
  155. agenta/client/backend/types/full_json_input.py +34 -0
  156. agenta/client/backend/types/full_json_output.py +29 -0
  157. agenta/client/backend/types/get_config_response.py +3 -5
  158. agenta/client/backend/types/{header_dto.py → header.py} +4 -6
  159. agenta/client/backend/types/http_validation_error.py +4 -6
  160. agenta/client/backend/types/human_evaluation.py +3 -5
  161. agenta/client/backend/types/human_evaluation_scenario.py +4 -6
  162. agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
  163. agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
  164. agenta/client/backend/types/invite_request.py +4 -6
  165. agenta/client/backend/types/legacy_analytics_response.py +4 -6
  166. agenta/client/backend/types/legacy_data_point.py +3 -5
  167. agenta/client/backend/types/legacy_evaluator.py +26 -0
  168. agenta/client/backend/types/legacy_scope_request.py +4 -6
  169. agenta/client/backend/types/legacy_scopes_response.py +3 -5
  170. agenta/client/backend/types/legacy_subscription_request.py +19 -0
  171. agenta/client/backend/types/legacy_user_request.py +5 -7
  172. agenta/client/backend/types/legacy_user_response.py +3 -5
  173. agenta/client/backend/types/lifecycle_dto.py +3 -5
  174. agenta/client/backend/types/link_dto.py +4 -6
  175. agenta/client/backend/types/list_api_keys_response.py +3 -5
  176. agenta/client/backend/types/llm_run_rate_limit.py +3 -5
  177. agenta/client/backend/types/meta_request.py +30 -0
  178. agenta/client/backend/types/metrics_dto.py +3 -5
  179. agenta/client/backend/types/new_testset.py +3 -5
  180. agenta/client/backend/types/node_dto.py +4 -6
  181. agenta/client/backend/types/o_tel_context_dto.py +3 -5
  182. agenta/client/backend/types/o_tel_event.py +35 -0
  183. agenta/client/backend/types/o_tel_event_dto.py +3 -5
  184. agenta/client/backend/types/o_tel_extra_dto.py +4 -6
  185. agenta/client/backend/types/o_tel_flat_span.py +56 -0
  186. agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
  187. agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
  188. agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
  189. agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
  190. agenta/client/backend/types/o_tel_link.py +34 -0
  191. agenta/client/backend/types/o_tel_link_dto.py +4 -6
  192. agenta/client/backend/types/o_tel_links_response.py +22 -0
  193. agenta/client/backend/types/o_tel_span.py +58 -0
  194. agenta/client/backend/types/o_tel_span_dto.py +8 -10
  195. agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
  196. agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
  197. agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
  198. agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
  199. agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
  200. agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
  201. agenta/client/backend/types/o_tel_spans_tree.py +22 -0
  202. agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
  203. agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
  204. agenta/client/backend/types/o_tel_status_code.py +1 -1
  205. agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
  206. agenta/client/backend/types/o_tel_tracing_request.py +22 -0
  207. agenta/client/backend/types/o_tel_tracing_response.py +27 -0
  208. agenta/client/backend/types/organization.py +3 -5
  209. agenta/client/backend/types/organization_details.py +3 -5
  210. agenta/client/backend/types/organization_membership_request.py +5 -7
  211. agenta/client/backend/types/organization_output.py +3 -5
  212. agenta/client/backend/types/organization_request.py +3 -5
  213. agenta/client/backend/types/parent_dto.py +3 -5
  214. agenta/client/backend/types/permission.py +11 -0
  215. agenta/client/backend/types/plan.py +14 -0
  216. agenta/client/backend/types/project_membership_request.py +5 -7
  217. agenta/client/backend/types/project_request.py +4 -6
  218. agenta/client/backend/types/project_scope.py +5 -7
  219. agenta/client/backend/types/projects_response.py +3 -5
  220. agenta/client/backend/types/recursive_types.py +23 -0
  221. agenta/client/backend/types/reference.py +18 -5
  222. agenta/client/backend/types/reference_dto.py +4 -5
  223. agenta/client/backend/types/reference_request_model.py +4 -5
  224. agenta/client/backend/types/result.py +4 -6
  225. agenta/client/backend/types/root_dto.py +3 -5
  226. agenta/client/backend/types/scopes_response_model.py +4 -6
  227. agenta/client/backend/types/secret_dto.py +5 -7
  228. agenta/client/backend/types/secret_response_dto.py +11 -11
  229. agenta/client/backend/types/simple_evaluation_output.py +4 -6
  230. agenta/client/backend/types/span_dto.py +18 -14
  231. agenta/client/backend/types/span_dto_nodes_value.py +1 -1
  232. agenta/client/backend/types/standard_provider_dto.py +5 -7
  233. agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
  234. agenta/client/backend/types/status_dto.py +4 -6
  235. agenta/client/backend/types/tags_request.py +30 -0
  236. agenta/client/backend/types/test_set_output_response.py +5 -7
  237. agenta/client/backend/types/test_set_simple_response.py +3 -5
  238. agenta/client/backend/types/testcase_response.py +33 -0
  239. agenta/client/backend/types/testset.py +46 -0
  240. agenta/client/backend/types/testset_request.py +20 -0
  241. agenta/client/backend/types/testset_response.py +21 -0
  242. agenta/client/backend/types/testsets_response.py +21 -0
  243. agenta/client/backend/types/time_dto.py +3 -5
  244. agenta/client/backend/types/timestamp.py +6 -0
  245. agenta/client/backend/types/tree_dto.py +4 -6
  246. agenta/client/backend/types/update_app_output.py +3 -5
  247. agenta/client/backend/types/user_request.py +3 -5
  248. agenta/client/backend/types/validation_error.py +4 -6
  249. agenta/client/backend/types/workflow_artifact.py +45 -0
  250. agenta/client/backend/types/workflow_data.py +20 -0
  251. agenta/client/backend/types/workflow_flags.py +21 -0
  252. agenta/client/backend/types/workflow_request.py +20 -0
  253. agenta/client/backend/types/workflow_response.py +21 -0
  254. agenta/client/backend/types/workflow_revision.py +57 -0
  255. agenta/client/backend/types/workflow_revision_request.py +20 -0
  256. agenta/client/backend/types/workflow_revision_response.py +21 -0
  257. agenta/client/backend/types/workflow_revisions_response.py +21 -0
  258. agenta/client/backend/types/workflow_variant.py +48 -0
  259. agenta/client/backend/types/workflow_variant_request.py +20 -0
  260. agenta/client/backend/types/workflow_variant_response.py +21 -0
  261. agenta/client/backend/types/workflow_variants_response.py +21 -0
  262. agenta/client/backend/types/workflows_response.py +21 -0
  263. agenta/client/backend/types/workspace.py +3 -5
  264. agenta/client/backend/types/workspace_member_response.py +4 -6
  265. agenta/client/backend/types/workspace_membership_request.py +5 -7
  266. agenta/client/backend/types/workspace_permission.py +5 -7
  267. agenta/client/backend/types/workspace_request.py +4 -6
  268. agenta/client/backend/types/workspace_response.py +4 -6
  269. agenta/client/backend/variants/__init__.py +2 -0
  270. agenta/client/backend/variants/client.py +306 -1651
  271. agenta/client/backend/variants/raw_client.py +2482 -0
  272. agenta/client/backend/variants/types/__init__.py +2 -0
  273. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
  274. agenta/client/backend/vault/__init__.py +2 -0
  275. agenta/client/backend/vault/client.py +69 -323
  276. agenta/client/backend/vault/raw_client.py +616 -0
  277. agenta/client/backend/workflows/__init__.py +3 -0
  278. agenta/client/backend/workflows/client.py +2398 -0
  279. agenta/client/backend/workflows/raw_client.py +3639 -0
  280. agenta/client/backend/workspace/__init__.py +2 -0
  281. agenta/client/backend/workspace/client.py +46 -147
  282. agenta/client/backend/workspace/raw_client.py +376 -0
  283. agenta/client/types.py +4 -0
  284. agenta/sdk/decorators/tracing.py +2 -4
  285. agenta/sdk/tracing/processors.py +26 -39
  286. agenta/sdk/types.py +28 -1
  287. {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
  288. agenta-0.48.10.dist-info/RECORD +362 -0
  289. agenta/client/backend/containers/types/__init__.py +0 -5
  290. agenta/client/backend/containers/types/container_templates_response.py +0 -6
  291. agenta/client/backend/types/image.py +0 -25
  292. agenta/client/backend/types/provider_kind.py +0 -21
  293. agenta/client/backend/types/template.py +0 -23
  294. agenta/client/backend/types/template_image_info.py +0 -29
  295. agenta/client/backend/types/variant_action.py +0 -22
  296. agenta-0.48.8.dist-info/RECORD +0 -255
  297. {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
@@ -1,21 +1,16 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from ..core.client_wrapper import SyncClientWrapper
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
5
6
  from ..core.request_options import RequestOptions
6
- from ..types.app_variant_response import AppVariantResponse
7
- from ..core.jsonable_encoder import jsonable_encoder
8
- from ..core.pydantic_utilities import parse_obj_as
9
- from ..errors.unprocessable_entity_error import UnprocessableEntityError
10
- from ..types.http_validation_error import HttpValidationError
11
- from json.decoder import JSONDecodeError
12
- from ..core.api_error import ApiError
13
7
  from ..types.app import App
8
+ from ..types.app_variant_response import AppVariantResponse
14
9
  from ..types.create_app_output import CreateAppOutput
15
- from ..types.update_app_output import UpdateAppOutput
16
10
  from ..types.environment_output import EnvironmentOutput
17
11
  from ..types.environment_output_extended import EnvironmentOutputExtended
18
- from ..core.client_wrapper import AsyncClientWrapper
12
+ from ..types.update_app_output import UpdateAppOutput
13
+ from .raw_client import AsyncRawAppsClient, RawAppsClient
19
14
 
20
15
  # this is used as the default value for optional parameters
21
16
  OMIT = typing.cast(typing.Any, ...)
@@ -23,7 +18,18 @@ OMIT = typing.cast(typing.Any, ...)
23
18
 
24
19
  class AppsClient:
25
20
  def __init__(self, *, client_wrapper: SyncClientWrapper):
26
- self._client_wrapper = client_wrapper
21
+ self._raw_client = RawAppsClient(client_wrapper=client_wrapper)
22
+
23
+ @property
24
+ def with_raw_response(self) -> RawAppsClient:
25
+ """
26
+ Retrieves a raw implementation of this client that returns raw responses.
27
+
28
+ Returns
29
+ -------
30
+ RawAppsClient
31
+ """
32
+ return self._raw_client
27
33
 
28
34
  def list_app_variants(
29
35
  self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -55,40 +61,15 @@ class AppsClient:
55
61
 
56
62
  client = AgentaApi(
57
63
  api_key="YOUR_API_KEY",
58
- base_url="https://yourhost.com/path/to/api",
59
64
  )
60
65
  client.apps.list_app_variants(
61
66
  app_id="app_id",
62
67
  )
63
68
  """
64
- _response = self._client_wrapper.httpx_client.request(
65
- f"apps/{jsonable_encoder(app_id)}/variants",
66
- method="GET",
67
- request_options=request_options,
69
+ _response = self._raw_client.list_app_variants(
70
+ app_id, request_options=request_options
68
71
  )
69
- try:
70
- if 200 <= _response.status_code < 300:
71
- return typing.cast(
72
- typing.List[AppVariantResponse],
73
- parse_obj_as(
74
- type_=typing.List[AppVariantResponse], # type: ignore
75
- object_=_response.json(),
76
- ),
77
- )
78
- if _response.status_code == 422:
79
- raise UnprocessableEntityError(
80
- typing.cast(
81
- HttpValidationError,
82
- parse_obj_as(
83
- type_=HttpValidationError, # type: ignore
84
- object_=_response.json(),
85
- ),
86
- )
87
- )
88
- _response_json = _response.json()
89
- except JSONDecodeError:
90
- raise ApiError(status_code=_response.status_code, body=_response.text)
91
- raise ApiError(status_code=_response.status_code, body=_response_json)
72
+ return _response.data
92
73
 
93
74
  def get_variant_by_env(
94
75
  self,
@@ -130,45 +111,16 @@ class AppsClient:
130
111
 
131
112
  client = AgentaApi(
132
113
  api_key="YOUR_API_KEY",
133
- base_url="https://yourhost.com/path/to/api",
134
114
  )
135
115
  client.apps.get_variant_by_env(
136
116
  app_id="app_id",
137
117
  environment="environment",
138
118
  )
139
119
  """
140
- _response = self._client_wrapper.httpx_client.request(
141
- "apps/get_variant_by_env",
142
- method="GET",
143
- params={
144
- "app_id": app_id,
145
- "environment": environment,
146
- },
147
- request_options=request_options,
120
+ _response = self._raw_client.get_variant_by_env(
121
+ app_id=app_id, environment=environment, request_options=request_options
148
122
  )
149
- try:
150
- if 200 <= _response.status_code < 300:
151
- return typing.cast(
152
- AppVariantResponse,
153
- parse_obj_as(
154
- type_=AppVariantResponse, # 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)
123
+ return _response.data
172
124
 
173
125
  def list_apps(
174
126
  self,
@@ -206,41 +158,13 @@ class AppsClient:
206
158
 
207
159
  client = AgentaApi(
208
160
  api_key="YOUR_API_KEY",
209
- base_url="https://yourhost.com/path/to/api",
210
161
  )
211
162
  client.apps.list_apps()
212
163
  """
213
- _response = self._client_wrapper.httpx_client.request(
214
- "apps",
215
- method="GET",
216
- params={
217
- "app_name": app_name,
218
- },
219
- request_options=request_options,
164
+ _response = self._raw_client.list_apps(
165
+ app_name=app_name, request_options=request_options
220
166
  )
221
- try:
222
- if 200 <= _response.status_code < 300:
223
- return typing.cast(
224
- typing.List[App],
225
- parse_obj_as(
226
- type_=typing.List[App], # type: ignore
227
- object_=_response.json(),
228
- ),
229
- )
230
- if _response.status_code == 422:
231
- raise UnprocessableEntityError(
232
- typing.cast(
233
- HttpValidationError,
234
- parse_obj_as(
235
- type_=HttpValidationError, # type: ignore
236
- object_=_response.json(),
237
- ),
238
- )
239
- )
240
- _response_json = _response.json()
241
- except JSONDecodeError:
242
- raise ApiError(status_code=_response.status_code, body=_response.text)
243
- raise ApiError(status_code=_response.status_code, body=_response_json)
167
+ return _response.data
244
168
 
245
169
  def create_app(
246
170
  self,
@@ -290,57 +214,26 @@ class AppsClient:
290
214
 
291
215
  client = AgentaApi(
292
216
  api_key="YOUR_API_KEY",
293
- base_url="https://yourhost.com/path/to/api",
294
217
  )
295
218
  client.apps.create_app(
296
219
  app_name="app_name",
297
220
  )
298
221
  """
299
- _response = self._client_wrapper.httpx_client.request(
300
- "apps",
301
- method="POST",
302
- json={
303
- "app_name": app_name,
304
- "template_key": template_key,
305
- "project_id": project_id,
306
- "workspace_id": workspace_id,
307
- "organization_id": organization_id,
308
- },
309
- headers={
310
- "content-type": "application/json",
311
- },
222
+ _response = self._raw_client.create_app(
223
+ app_name=app_name,
224
+ template_key=template_key,
225
+ project_id=project_id,
226
+ workspace_id=workspace_id,
227
+ organization_id=organization_id,
312
228
  request_options=request_options,
313
- omit=OMIT,
314
229
  )
315
- try:
316
- if 200 <= _response.status_code < 300:
317
- return typing.cast(
318
- CreateAppOutput,
319
- parse_obj_as(
320
- type_=CreateAppOutput, # type: ignore
321
- object_=_response.json(),
322
- ),
323
- )
324
- if _response.status_code == 422:
325
- raise UnprocessableEntityError(
326
- typing.cast(
327
- HttpValidationError,
328
- parse_obj_as(
329
- type_=HttpValidationError, # type: ignore
330
- object_=_response.json(),
331
- ),
332
- )
333
- )
334
- _response_json = _response.json()
335
- except JSONDecodeError:
336
- raise ApiError(status_code=_response.status_code, body=_response.text)
337
- raise ApiError(status_code=_response.status_code, body=_response_json)
230
+ return _response.data
338
231
 
339
232
  def remove_app(
340
233
  self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
341
234
  ) -> typing.Optional[typing.Any]:
342
235
  """
343
- Remove app, all its variant, containers and images
236
+ Remove app, all its variant.
344
237
 
345
238
  Arguments:
346
239
  app -- App to remove
@@ -363,40 +256,13 @@ class AppsClient:
363
256
 
364
257
  client = AgentaApi(
365
258
  api_key="YOUR_API_KEY",
366
- base_url="https://yourhost.com/path/to/api",
367
259
  )
368
260
  client.apps.remove_app(
369
261
  app_id="app_id",
370
262
  )
371
263
  """
372
- _response = self._client_wrapper.httpx_client.request(
373
- f"apps/{jsonable_encoder(app_id)}",
374
- method="DELETE",
375
- request_options=request_options,
376
- )
377
- try:
378
- if 200 <= _response.status_code < 300:
379
- return typing.cast(
380
- typing.Optional[typing.Any],
381
- parse_obj_as(
382
- type_=typing.Optional[typing.Any], # type: ignore
383
- object_=_response.json(),
384
- ),
385
- )
386
- if _response.status_code == 422:
387
- raise UnprocessableEntityError(
388
- typing.cast(
389
- HttpValidationError,
390
- parse_obj_as(
391
- type_=HttpValidationError, # type: ignore
392
- object_=_response.json(),
393
- ),
394
- )
395
- )
396
- _response_json = _response.json()
397
- except JSONDecodeError:
398
- raise ApiError(status_code=_response.status_code, body=_response.text)
399
- raise ApiError(status_code=_response.status_code, body=_response_json)
264
+ _response = self._raw_client.remove_app(app_id, request_options=request_options)
265
+ return _response.data
400
266
 
401
267
  def update_app(
402
268
  self,
@@ -413,7 +279,7 @@ class AppsClient:
413
279
  payload (UpdateApp): The payload containing the app name.
414
280
 
415
281
  Returns:
416
- UpdateAppOuput: The output containing the newly created app's ID and name.
282
+ UpdateAppOutput: The output containing the newly created app's ID and name.
417
283
 
418
284
  Raises:
419
285
  HTTPException: If there is an error creating the app or the user does not have permission to access the app.
@@ -438,149 +304,16 @@ class AppsClient:
438
304
 
439
305
  client = AgentaApi(
440
306
  api_key="YOUR_API_KEY",
441
- base_url="https://yourhost.com/path/to/api",
442
307
  )
443
308
  client.apps.update_app(
444
309
  app_id="app_id",
445
310
  app_name="app_name",
446
311
  )
447
312
  """
448
- _response = self._client_wrapper.httpx_client.request(
449
- f"apps/{jsonable_encoder(app_id)}",
450
- method="PATCH",
451
- json={
452
- "app_name": app_name,
453
- },
454
- headers={
455
- "content-type": "application/json",
456
- },
457
- request_options=request_options,
458
- omit=OMIT,
459
- )
460
- try:
461
- if 200 <= _response.status_code < 300:
462
- return typing.cast(
463
- UpdateAppOutput,
464
- parse_obj_as(
465
- type_=UpdateAppOutput, # type: ignore
466
- object_=_response.json(),
467
- ),
468
- )
469
- if _response.status_code == 422:
470
- raise UnprocessableEntityError(
471
- typing.cast(
472
- HttpValidationError,
473
- parse_obj_as(
474
- type_=HttpValidationError, # type: ignore
475
- object_=_response.json(),
476
- ),
477
- )
478
- )
479
- _response_json = _response.json()
480
- except JSONDecodeError:
481
- raise ApiError(status_code=_response.status_code, body=_response.text)
482
- raise ApiError(status_code=_response.status_code, body=_response_json)
483
-
484
- def add_variant_from_image(
485
- self,
486
- app_id: str,
487
- *,
488
- variant_name: str,
489
- docker_id: str,
490
- tags: str,
491
- base_name: typing.Optional[str] = OMIT,
492
- config_name: typing.Optional[str] = OMIT,
493
- request_options: typing.Optional[RequestOptions] = None,
494
- ) -> typing.Optional[typing.Any]:
495
- """
496
- Add a new variant to an app based on a Docker image.
497
-
498
- Args:
499
- app_id (str): The ID of the app to add the variant to.
500
- payload (AddVariantFromImagePayload): The payload containing information about the variant to add.
501
-
502
- Raises:
503
- HTTPException: If the feature flag is set to "demo" or if the image does not have a tag starting with the registry name (agenta-server) or if the image is not found or if the user does not have access to the app.
504
-
505
- Returns:
506
- dict: The newly added variant.
507
-
508
- Parameters
509
- ----------
510
- app_id : str
511
-
512
- variant_name : str
513
-
514
- docker_id : str
515
-
516
- tags : str
517
-
518
- base_name : typing.Optional[str]
519
-
520
- config_name : typing.Optional[str]
521
-
522
- request_options : typing.Optional[RequestOptions]
523
- Request-specific configuration.
524
-
525
- Returns
526
- -------
527
- typing.Optional[typing.Any]
528
- Successful Response
529
-
530
- Examples
531
- --------
532
- from agenta import AgentaApi
533
-
534
- client = AgentaApi(
535
- api_key="YOUR_API_KEY",
536
- base_url="https://yourhost.com/path/to/api",
537
- )
538
- client.apps.add_variant_from_image(
539
- app_id="app_id",
540
- variant_name="variant_name",
541
- docker_id="docker_id",
542
- tags="tags",
543
- )
544
- """
545
- _response = self._client_wrapper.httpx_client.request(
546
- f"apps/{jsonable_encoder(app_id)}/variant/from-image",
547
- method="POST",
548
- json={
549
- "variant_name": variant_name,
550
- "docker_id": docker_id,
551
- "tags": tags,
552
- "base_name": base_name,
553
- "config_name": config_name,
554
- },
555
- headers={
556
- "content-type": "application/json",
557
- },
558
- request_options=request_options,
559
- omit=OMIT,
313
+ _response = self._raw_client.update_app(
314
+ app_id, app_name=app_name, request_options=request_options
560
315
  )
561
- try:
562
- if 200 <= _response.status_code < 300:
563
- return typing.cast(
564
- typing.Optional[typing.Any],
565
- parse_obj_as(
566
- type_=typing.Optional[typing.Any], # type: ignore
567
- object_=_response.json(),
568
- ),
569
- )
570
- if _response.status_code == 422:
571
- raise UnprocessableEntityError(
572
- typing.cast(
573
- HttpValidationError,
574
- parse_obj_as(
575
- type_=HttpValidationError, # type: ignore
576
- object_=_response.json(),
577
- ),
578
- )
579
- )
580
- _response_json = _response.json()
581
- except JSONDecodeError:
582
- raise ApiError(status_code=_response.status_code, body=_response.text)
583
- raise ApiError(status_code=_response.status_code, body=_response_json)
316
+ return _response.data
584
317
 
585
318
  def add_variant_from_url(
586
319
  self,
@@ -588,23 +321,12 @@ class AppsClient:
588
321
  *,
589
322
  variant_name: str,
590
323
  url: str,
324
+ commit_message: typing.Optional[str] = OMIT,
591
325
  base_name: typing.Optional[str] = OMIT,
592
326
  config_name: typing.Optional[str] = OMIT,
593
327
  request_options: typing.Optional[RequestOptions] = None,
594
328
  ) -> typing.Optional[typing.Any]:
595
329
  """
596
- Add a new variant to an app based on a URL.
597
-
598
- Args:
599
- app_id (str): The ID of the app to add the variant to.
600
- payload (AddVariantFromURLPayload): The payload containing information about the variant to add.
601
-
602
- Raises:
603
- HTTPException: If the user does not have access to the app or if there is an error adding the variant.
604
-
605
- Returns:
606
- dict: The newly added variant.
607
-
608
330
  Parameters
609
331
  ----------
610
332
  app_id : str
@@ -613,6 +335,8 @@ class AppsClient:
613
335
 
614
336
  url : str
615
337
 
338
+ commit_message : typing.Optional[str]
339
+
616
340
  base_name : typing.Optional[str]
617
341
 
618
342
  config_name : typing.Optional[str]
@@ -631,7 +355,6 @@ class AppsClient:
631
355
 
632
356
  client = AgentaApi(
633
357
  api_key="YOUR_API_KEY",
634
- base_url="https://yourhost.com/path/to/api",
635
358
  )
636
359
  client.apps.add_variant_from_url(
637
360
  app_id="app_id",
@@ -639,44 +362,16 @@ class AppsClient:
639
362
  url="url",
640
363
  )
641
364
  """
642
- _response = self._client_wrapper.httpx_client.request(
643
- f"apps/{jsonable_encoder(app_id)}/variant/from-service",
644
- method="POST",
645
- json={
646
- "variant_name": variant_name,
647
- "url": url,
648
- "base_name": base_name,
649
- "config_name": config_name,
650
- },
651
- headers={
652
- "content-type": "application/json",
653
- },
365
+ _response = self._raw_client.add_variant_from_url(
366
+ app_id,
367
+ variant_name=variant_name,
368
+ url=url,
369
+ commit_message=commit_message,
370
+ base_name=base_name,
371
+ config_name=config_name,
654
372
  request_options=request_options,
655
- omit=OMIT,
656
373
  )
657
- try:
658
- if 200 <= _response.status_code < 300:
659
- return typing.cast(
660
- typing.Optional[typing.Any],
661
- parse_obj_as(
662
- type_=typing.Optional[typing.Any], # type: ignore
663
- object_=_response.json(),
664
- ),
665
- )
666
- if _response.status_code == 422:
667
- raise UnprocessableEntityError(
668
- typing.cast(
669
- HttpValidationError,
670
- parse_obj_as(
671
- type_=HttpValidationError, # type: ignore
672
- object_=_response.json(),
673
- ),
674
- )
675
- )
676
- _response_json = _response.json()
677
- except JSONDecodeError:
678
- raise ApiError(status_code=_response.status_code, body=_response.text)
679
- raise ApiError(status_code=_response.status_code, body=_response_json)
374
+ return _response.data
680
375
 
681
376
  def add_variant_from_key(
682
377
  self,
@@ -684,6 +379,7 @@ class AppsClient:
684
379
  *,
685
380
  variant_name: str,
686
381
  key: str,
382
+ commit_message: typing.Optional[str] = OMIT,
687
383
  base_name: typing.Optional[str] = OMIT,
688
384
  config_name: typing.Optional[str] = OMIT,
689
385
  request_options: typing.Optional[RequestOptions] = None,
@@ -697,6 +393,8 @@ class AppsClient:
697
393
 
698
394
  key : str
699
395
 
396
+ commit_message : typing.Optional[str]
397
+
700
398
  base_name : typing.Optional[str]
701
399
 
702
400
  config_name : typing.Optional[str]
@@ -715,7 +413,6 @@ class AppsClient:
715
413
 
716
414
  client = AgentaApi(
717
415
  api_key="YOUR_API_KEY",
718
- base_url="https://yourhost.com/path/to/api",
719
416
  )
720
417
  client.apps.add_variant_from_key(
721
418
  app_id="app_id",
@@ -723,44 +420,16 @@ class AppsClient:
723
420
  key="key",
724
421
  )
725
422
  """
726
- _response = self._client_wrapper.httpx_client.request(
727
- f"apps/{jsonable_encoder(app_id)}/variant/from-template",
728
- method="POST",
729
- json={
730
- "variant_name": variant_name,
731
- "key": key,
732
- "base_name": base_name,
733
- "config_name": config_name,
734
- },
735
- headers={
736
- "content-type": "application/json",
737
- },
423
+ _response = self._raw_client.add_variant_from_key(
424
+ app_id,
425
+ variant_name=variant_name,
426
+ key=key,
427
+ commit_message=commit_message,
428
+ base_name=base_name,
429
+ config_name=config_name,
738
430
  request_options=request_options,
739
- omit=OMIT,
740
431
  )
741
- try:
742
- if 200 <= _response.status_code < 300:
743
- return typing.cast(
744
- typing.Optional[typing.Any],
745
- parse_obj_as(
746
- type_=typing.Optional[typing.Any], # type: ignore
747
- object_=_response.json(),
748
- ),
749
- )
750
- if _response.status_code == 422:
751
- raise UnprocessableEntityError(
752
- typing.cast(
753
- HttpValidationError,
754
- parse_obj_as(
755
- type_=HttpValidationError, # type: ignore
756
- object_=_response.json(),
757
- ),
758
- )
759
- )
760
- _response_json = _response.json()
761
- except JSONDecodeError:
762
- raise ApiError(status_code=_response.status_code, body=_response.text)
763
- raise ApiError(status_code=_response.status_code, body=_response_json)
432
+ return _response.data
764
433
 
765
434
  def list_environments(
766
435
  self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -792,40 +461,15 @@ class AppsClient:
792
461
 
793
462
  client = AgentaApi(
794
463
  api_key="YOUR_API_KEY",
795
- base_url="https://yourhost.com/path/to/api",
796
464
  )
797
465
  client.apps.list_environments(
798
466
  app_id="app_id",
799
467
  )
800
468
  """
801
- _response = self._client_wrapper.httpx_client.request(
802
- f"apps/{jsonable_encoder(app_id)}/environments",
803
- method="GET",
804
- request_options=request_options,
469
+ _response = self._raw_client.list_environments(
470
+ app_id, request_options=request_options
805
471
  )
806
- try:
807
- if 200 <= _response.status_code < 300:
808
- return typing.cast(
809
- typing.List[EnvironmentOutput],
810
- parse_obj_as(
811
- type_=typing.List[EnvironmentOutput], # type: ignore
812
- object_=_response.json(),
813
- ),
814
- )
815
- if _response.status_code == 422:
816
- raise UnprocessableEntityError(
817
- typing.cast(
818
- HttpValidationError,
819
- parse_obj_as(
820
- type_=HttpValidationError, # type: ignore
821
- object_=_response.json(),
822
- ),
823
- )
824
- )
825
- _response_json = _response.json()
826
- except JSONDecodeError:
827
- raise ApiError(status_code=_response.status_code, body=_response.text)
828
- raise ApiError(status_code=_response.status_code, body=_response_json)
472
+ return _response.data
829
473
 
830
474
  def environment_revisions(
831
475
  self,
@@ -855,46 +499,32 @@ class AppsClient:
855
499
 
856
500
  client = AgentaApi(
857
501
  api_key="YOUR_API_KEY",
858
- base_url="https://yourhost.com/path/to/api",
859
502
  )
860
503
  client.apps.environment_revisions(
861
504
  app_id="app_id",
862
505
  environment_name={"key": "value"},
863
506
  )
864
507
  """
865
- _response = self._client_wrapper.httpx_client.request(
866
- f"apps/{jsonable_encoder(app_id)}/revisions/{jsonable_encoder(environment_name)}",
867
- method="GET",
868
- request_options=request_options,
508
+ _response = self._raw_client.environment_revisions(
509
+ app_id, environment_name, request_options=request_options
869
510
  )
870
- try:
871
- if 200 <= _response.status_code < 300:
872
- return typing.cast(
873
- EnvironmentOutputExtended,
874
- parse_obj_as(
875
- type_=EnvironmentOutputExtended, # type: ignore
876
- object_=_response.json(),
877
- ),
878
- )
879
- if _response.status_code == 422:
880
- raise UnprocessableEntityError(
881
- typing.cast(
882
- HttpValidationError,
883
- parse_obj_as(
884
- type_=HttpValidationError, # type: ignore
885
- object_=_response.json(),
886
- ),
887
- )
888
- )
889
- _response_json = _response.json()
890
- except JSONDecodeError:
891
- raise ApiError(status_code=_response.status_code, body=_response.text)
892
- raise ApiError(status_code=_response.status_code, body=_response_json)
511
+ return _response.data
893
512
 
894
513
 
895
514
  class AsyncAppsClient:
896
515
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
897
- self._client_wrapper = client_wrapper
516
+ self._raw_client = AsyncRawAppsClient(client_wrapper=client_wrapper)
517
+
518
+ @property
519
+ def with_raw_response(self) -> AsyncRawAppsClient:
520
+ """
521
+ Retrieves a raw implementation of this client that returns raw responses.
522
+
523
+ Returns
524
+ -------
525
+ AsyncRawAppsClient
526
+ """
527
+ return self._raw_client
898
528
 
899
529
  async def list_app_variants(
900
530
  self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -928,7 +558,6 @@ class AsyncAppsClient:
928
558
 
929
559
  client = AsyncAgentaApi(
930
560
  api_key="YOUR_API_KEY",
931
- base_url="https://yourhost.com/path/to/api",
932
561
  )
933
562
 
934
563
 
@@ -940,34 +569,10 @@ class AsyncAppsClient:
940
569
 
941
570
  asyncio.run(main())
942
571
  """
943
- _response = await self._client_wrapper.httpx_client.request(
944
- f"apps/{jsonable_encoder(app_id)}/variants",
945
- method="GET",
946
- request_options=request_options,
572
+ _response = await self._raw_client.list_app_variants(
573
+ app_id, request_options=request_options
947
574
  )
948
- try:
949
- if 200 <= _response.status_code < 300:
950
- return typing.cast(
951
- typing.List[AppVariantResponse],
952
- parse_obj_as(
953
- type_=typing.List[AppVariantResponse], # type: ignore
954
- object_=_response.json(),
955
- ),
956
- )
957
- if _response.status_code == 422:
958
- raise UnprocessableEntityError(
959
- typing.cast(
960
- HttpValidationError,
961
- parse_obj_as(
962
- type_=HttpValidationError, # type: ignore
963
- object_=_response.json(),
964
- ),
965
- )
966
- )
967
- _response_json = _response.json()
968
- except JSONDecodeError:
969
- raise ApiError(status_code=_response.status_code, body=_response.text)
970
- raise ApiError(status_code=_response.status_code, body=_response_json)
575
+ return _response.data
971
576
 
972
577
  async def get_variant_by_env(
973
578
  self,
@@ -1011,7 +616,6 @@ class AsyncAppsClient:
1011
616
 
1012
617
  client = AsyncAgentaApi(
1013
618
  api_key="YOUR_API_KEY",
1014
- base_url="https://yourhost.com/path/to/api",
1015
619
  )
1016
620
 
1017
621
 
@@ -1024,38 +628,10 @@ class AsyncAppsClient:
1024
628
 
1025
629
  asyncio.run(main())
1026
630
  """
1027
- _response = await self._client_wrapper.httpx_client.request(
1028
- "apps/get_variant_by_env",
1029
- method="GET",
1030
- params={
1031
- "app_id": app_id,
1032
- "environment": environment,
1033
- },
1034
- request_options=request_options,
631
+ _response = await self._raw_client.get_variant_by_env(
632
+ app_id=app_id, environment=environment, request_options=request_options
1035
633
  )
1036
- try:
1037
- if 200 <= _response.status_code < 300:
1038
- return typing.cast(
1039
- AppVariantResponse,
1040
- parse_obj_as(
1041
- type_=AppVariantResponse, # type: ignore
1042
- object_=_response.json(),
1043
- ),
1044
- )
1045
- if _response.status_code == 422:
1046
- raise UnprocessableEntityError(
1047
- typing.cast(
1048
- HttpValidationError,
1049
- parse_obj_as(
1050
- type_=HttpValidationError, # type: ignore
1051
- object_=_response.json(),
1052
- ),
1053
- )
1054
- )
1055
- _response_json = _response.json()
1056
- except JSONDecodeError:
1057
- raise ApiError(status_code=_response.status_code, body=_response.text)
1058
- raise ApiError(status_code=_response.status_code, body=_response_json)
634
+ return _response.data
1059
635
 
1060
636
  async def list_apps(
1061
637
  self,
@@ -1095,7 +671,6 @@ class AsyncAppsClient:
1095
671
 
1096
672
  client = AsyncAgentaApi(
1097
673
  api_key="YOUR_API_KEY",
1098
- base_url="https://yourhost.com/path/to/api",
1099
674
  )
1100
675
 
1101
676
 
@@ -1105,37 +680,10 @@ class AsyncAppsClient:
1105
680
 
1106
681
  asyncio.run(main())
1107
682
  """
1108
- _response = await self._client_wrapper.httpx_client.request(
1109
- "apps",
1110
- method="GET",
1111
- params={
1112
- "app_name": app_name,
1113
- },
1114
- request_options=request_options,
683
+ _response = await self._raw_client.list_apps(
684
+ app_name=app_name, request_options=request_options
1115
685
  )
1116
- try:
1117
- if 200 <= _response.status_code < 300:
1118
- return typing.cast(
1119
- typing.List[App],
1120
- parse_obj_as(
1121
- type_=typing.List[App], # type: ignore
1122
- object_=_response.json(),
1123
- ),
1124
- )
1125
- if _response.status_code == 422:
1126
- raise UnprocessableEntityError(
1127
- typing.cast(
1128
- HttpValidationError,
1129
- parse_obj_as(
1130
- type_=HttpValidationError, # type: ignore
1131
- object_=_response.json(),
1132
- ),
1133
- )
1134
- )
1135
- _response_json = _response.json()
1136
- except JSONDecodeError:
1137
- raise ApiError(status_code=_response.status_code, body=_response.text)
1138
- raise ApiError(status_code=_response.status_code, body=_response_json)
686
+ return _response.data
1139
687
 
1140
688
  async def create_app(
1141
689
  self,
@@ -1187,7 +735,6 @@ class AsyncAppsClient:
1187
735
 
1188
736
  client = AsyncAgentaApi(
1189
737
  api_key="YOUR_API_KEY",
1190
- base_url="https://yourhost.com/path/to/api",
1191
738
  )
1192
739
 
1193
740
 
@@ -1199,51 +746,21 @@ class AsyncAppsClient:
1199
746
 
1200
747
  asyncio.run(main())
1201
748
  """
1202
- _response = await self._client_wrapper.httpx_client.request(
1203
- "apps",
1204
- method="POST",
1205
- json={
1206
- "app_name": app_name,
1207
- "template_key": template_key,
1208
- "project_id": project_id,
1209
- "workspace_id": workspace_id,
1210
- "organization_id": organization_id,
1211
- },
1212
- headers={
1213
- "content-type": "application/json",
1214
- },
749
+ _response = await self._raw_client.create_app(
750
+ app_name=app_name,
751
+ template_key=template_key,
752
+ project_id=project_id,
753
+ workspace_id=workspace_id,
754
+ organization_id=organization_id,
1215
755
  request_options=request_options,
1216
- omit=OMIT,
1217
756
  )
1218
- try:
1219
- if 200 <= _response.status_code < 300:
1220
- return typing.cast(
1221
- CreateAppOutput,
1222
- parse_obj_as(
1223
- type_=CreateAppOutput, # type: ignore
1224
- object_=_response.json(),
1225
- ),
1226
- )
1227
- if _response.status_code == 422:
1228
- raise UnprocessableEntityError(
1229
- typing.cast(
1230
- HttpValidationError,
1231
- parse_obj_as(
1232
- type_=HttpValidationError, # type: ignore
1233
- object_=_response.json(),
1234
- ),
1235
- )
1236
- )
1237
- _response_json = _response.json()
1238
- except JSONDecodeError:
1239
- raise ApiError(status_code=_response.status_code, body=_response.text)
1240
- raise ApiError(status_code=_response.status_code, body=_response_json)
757
+ return _response.data
1241
758
 
1242
759
  async def remove_app(
1243
760
  self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
1244
761
  ) -> typing.Optional[typing.Any]:
1245
762
  """
1246
- Remove app, all its variant, containers and images
763
+ Remove app, all its variant.
1247
764
 
1248
765
  Arguments:
1249
766
  app -- App to remove
@@ -1268,7 +785,6 @@ class AsyncAppsClient:
1268
785
 
1269
786
  client = AsyncAgentaApi(
1270
787
  api_key="YOUR_API_KEY",
1271
- base_url="https://yourhost.com/path/to/api",
1272
788
  )
1273
789
 
1274
790
 
@@ -1280,34 +796,10 @@ class AsyncAppsClient:
1280
796
 
1281
797
  asyncio.run(main())
1282
798
  """
1283
- _response = await self._client_wrapper.httpx_client.request(
1284
- f"apps/{jsonable_encoder(app_id)}",
1285
- method="DELETE",
1286
- request_options=request_options,
799
+ _response = await self._raw_client.remove_app(
800
+ app_id, request_options=request_options
1287
801
  )
1288
- try:
1289
- if 200 <= _response.status_code < 300:
1290
- return typing.cast(
1291
- typing.Optional[typing.Any],
1292
- parse_obj_as(
1293
- type_=typing.Optional[typing.Any], # type: ignore
1294
- object_=_response.json(),
1295
- ),
1296
- )
1297
- if _response.status_code == 422:
1298
- raise UnprocessableEntityError(
1299
- typing.cast(
1300
- HttpValidationError,
1301
- parse_obj_as(
1302
- type_=HttpValidationError, # type: ignore
1303
- object_=_response.json(),
1304
- ),
1305
- )
1306
- )
1307
- _response_json = _response.json()
1308
- except JSONDecodeError:
1309
- raise ApiError(status_code=_response.status_code, body=_response.text)
1310
- raise ApiError(status_code=_response.status_code, body=_response_json)
802
+ return _response.data
1311
803
 
1312
804
  async def update_app(
1313
805
  self,
@@ -1324,7 +816,7 @@ class AsyncAppsClient:
1324
816
  payload (UpdateApp): The payload containing the app name.
1325
817
 
1326
818
  Returns:
1327
- UpdateAppOuput: The output containing the newly created app's ID and name.
819
+ UpdateAppOutput: The output containing the newly created app's ID and name.
1328
820
 
1329
821
  Raises:
1330
822
  HTTPException: If there is an error creating the app or the user does not have permission to access the app.
@@ -1351,7 +843,6 @@ class AsyncAppsClient:
1351
843
 
1352
844
  client = AsyncAgentaApi(
1353
845
  api_key="YOUR_API_KEY",
1354
- base_url="https://yourhost.com/path/to/api",
1355
846
  )
1356
847
 
1357
848
 
@@ -1364,150 +855,10 @@ class AsyncAppsClient:
1364
855
 
1365
856
  asyncio.run(main())
1366
857
  """
1367
- _response = await self._client_wrapper.httpx_client.request(
1368
- f"apps/{jsonable_encoder(app_id)}",
1369
- method="PATCH",
1370
- json={
1371
- "app_name": app_name,
1372
- },
1373
- headers={
1374
- "content-type": "application/json",
1375
- },
1376
- request_options=request_options,
1377
- omit=OMIT,
1378
- )
1379
- try:
1380
- if 200 <= _response.status_code < 300:
1381
- return typing.cast(
1382
- UpdateAppOutput,
1383
- parse_obj_as(
1384
- type_=UpdateAppOutput, # type: ignore
1385
- object_=_response.json(),
1386
- ),
1387
- )
1388
- if _response.status_code == 422:
1389
- raise UnprocessableEntityError(
1390
- typing.cast(
1391
- HttpValidationError,
1392
- parse_obj_as(
1393
- type_=HttpValidationError, # type: ignore
1394
- object_=_response.json(),
1395
- ),
1396
- )
1397
- )
1398
- _response_json = _response.json()
1399
- except JSONDecodeError:
1400
- raise ApiError(status_code=_response.status_code, body=_response.text)
1401
- raise ApiError(status_code=_response.status_code, body=_response_json)
1402
-
1403
- async def add_variant_from_image(
1404
- self,
1405
- app_id: str,
1406
- *,
1407
- variant_name: str,
1408
- docker_id: str,
1409
- tags: str,
1410
- base_name: typing.Optional[str] = OMIT,
1411
- config_name: typing.Optional[str] = OMIT,
1412
- request_options: typing.Optional[RequestOptions] = None,
1413
- ) -> typing.Optional[typing.Any]:
1414
- """
1415
- Add a new variant to an app based on a Docker image.
1416
-
1417
- Args:
1418
- app_id (str): The ID of the app to add the variant to.
1419
- payload (AddVariantFromImagePayload): The payload containing information about the variant to add.
1420
-
1421
- Raises:
1422
- HTTPException: If the feature flag is set to "demo" or if the image does not have a tag starting with the registry name (agenta-server) or if the image is not found or if the user does not have access to the app.
1423
-
1424
- Returns:
1425
- dict: The newly added variant.
1426
-
1427
- Parameters
1428
- ----------
1429
- app_id : str
1430
-
1431
- variant_name : str
1432
-
1433
- docker_id : str
1434
-
1435
- tags : str
1436
-
1437
- base_name : typing.Optional[str]
1438
-
1439
- config_name : typing.Optional[str]
1440
-
1441
- request_options : typing.Optional[RequestOptions]
1442
- Request-specific configuration.
1443
-
1444
- Returns
1445
- -------
1446
- typing.Optional[typing.Any]
1447
- Successful Response
1448
-
1449
- Examples
1450
- --------
1451
- import asyncio
1452
-
1453
- from agenta import AsyncAgentaApi
1454
-
1455
- client = AsyncAgentaApi(
1456
- api_key="YOUR_API_KEY",
1457
- base_url="https://yourhost.com/path/to/api",
1458
- )
1459
-
1460
-
1461
- async def main() -> None:
1462
- await client.apps.add_variant_from_image(
1463
- app_id="app_id",
1464
- variant_name="variant_name",
1465
- docker_id="docker_id",
1466
- tags="tags",
1467
- )
1468
-
1469
-
1470
- asyncio.run(main())
1471
- """
1472
- _response = await self._client_wrapper.httpx_client.request(
1473
- f"apps/{jsonable_encoder(app_id)}/variant/from-image",
1474
- method="POST",
1475
- json={
1476
- "variant_name": variant_name,
1477
- "docker_id": docker_id,
1478
- "tags": tags,
1479
- "base_name": base_name,
1480
- "config_name": config_name,
1481
- },
1482
- headers={
1483
- "content-type": "application/json",
1484
- },
1485
- request_options=request_options,
1486
- omit=OMIT,
858
+ _response = await self._raw_client.update_app(
859
+ app_id, app_name=app_name, request_options=request_options
1487
860
  )
1488
- try:
1489
- if 200 <= _response.status_code < 300:
1490
- return typing.cast(
1491
- typing.Optional[typing.Any],
1492
- parse_obj_as(
1493
- type_=typing.Optional[typing.Any], # type: ignore
1494
- object_=_response.json(),
1495
- ),
1496
- )
1497
- if _response.status_code == 422:
1498
- raise UnprocessableEntityError(
1499
- typing.cast(
1500
- HttpValidationError,
1501
- parse_obj_as(
1502
- type_=HttpValidationError, # type: ignore
1503
- object_=_response.json(),
1504
- ),
1505
- )
1506
- )
1507
- _response_json = _response.json()
1508
- except JSONDecodeError:
1509
- raise ApiError(status_code=_response.status_code, body=_response.text)
1510
- raise ApiError(status_code=_response.status_code, body=_response_json)
861
+ return _response.data
1511
862
 
1512
863
  async def add_variant_from_url(
1513
864
  self,
@@ -1515,23 +866,12 @@ class AsyncAppsClient:
1515
866
  *,
1516
867
  variant_name: str,
1517
868
  url: str,
869
+ commit_message: typing.Optional[str] = OMIT,
1518
870
  base_name: typing.Optional[str] = OMIT,
1519
871
  config_name: typing.Optional[str] = OMIT,
1520
872
  request_options: typing.Optional[RequestOptions] = None,
1521
873
  ) -> typing.Optional[typing.Any]:
1522
874
  """
1523
- Add a new variant to an app based on a URL.
1524
-
1525
- Args:
1526
- app_id (str): The ID of the app to add the variant to.
1527
- payload (AddVariantFromURLPayload): The payload containing information about the variant to add.
1528
-
1529
- Raises:
1530
- HTTPException: If the user does not have access to the app or if there is an error adding the variant.
1531
-
1532
- Returns:
1533
- dict: The newly added variant.
1534
-
1535
875
  Parameters
1536
876
  ----------
1537
877
  app_id : str
@@ -1540,6 +880,8 @@ class AsyncAppsClient:
1540
880
 
1541
881
  url : str
1542
882
 
883
+ commit_message : typing.Optional[str]
884
+
1543
885
  base_name : typing.Optional[str]
1544
886
 
1545
887
  config_name : typing.Optional[str]
@@ -1560,7 +902,6 @@ class AsyncAppsClient:
1560
902
 
1561
903
  client = AsyncAgentaApi(
1562
904
  api_key="YOUR_API_KEY",
1563
- base_url="https://yourhost.com/path/to/api",
1564
905
  )
1565
906
 
1566
907
 
@@ -1574,44 +915,16 @@ class AsyncAppsClient:
1574
915
 
1575
916
  asyncio.run(main())
1576
917
  """
1577
- _response = await self._client_wrapper.httpx_client.request(
1578
- f"apps/{jsonable_encoder(app_id)}/variant/from-service",
1579
- method="POST",
1580
- json={
1581
- "variant_name": variant_name,
1582
- "url": url,
1583
- "base_name": base_name,
1584
- "config_name": config_name,
1585
- },
1586
- headers={
1587
- "content-type": "application/json",
1588
- },
918
+ _response = await self._raw_client.add_variant_from_url(
919
+ app_id,
920
+ variant_name=variant_name,
921
+ url=url,
922
+ commit_message=commit_message,
923
+ base_name=base_name,
924
+ config_name=config_name,
1589
925
  request_options=request_options,
1590
- omit=OMIT,
1591
926
  )
1592
- try:
1593
- if 200 <= _response.status_code < 300:
1594
- return typing.cast(
1595
- typing.Optional[typing.Any],
1596
- parse_obj_as(
1597
- type_=typing.Optional[typing.Any], # type: ignore
1598
- object_=_response.json(),
1599
- ),
1600
- )
1601
- if _response.status_code == 422:
1602
- raise UnprocessableEntityError(
1603
- typing.cast(
1604
- HttpValidationError,
1605
- parse_obj_as(
1606
- type_=HttpValidationError, # type: ignore
1607
- object_=_response.json(),
1608
- ),
1609
- )
1610
- )
1611
- _response_json = _response.json()
1612
- except JSONDecodeError:
1613
- raise ApiError(status_code=_response.status_code, body=_response.text)
1614
- raise ApiError(status_code=_response.status_code, body=_response_json)
927
+ return _response.data
1615
928
 
1616
929
  async def add_variant_from_key(
1617
930
  self,
@@ -1619,6 +932,7 @@ class AsyncAppsClient:
1619
932
  *,
1620
933
  variant_name: str,
1621
934
  key: str,
935
+ commit_message: typing.Optional[str] = OMIT,
1622
936
  base_name: typing.Optional[str] = OMIT,
1623
937
  config_name: typing.Optional[str] = OMIT,
1624
938
  request_options: typing.Optional[RequestOptions] = None,
@@ -1632,6 +946,8 @@ class AsyncAppsClient:
1632
946
 
1633
947
  key : str
1634
948
 
949
+ commit_message : typing.Optional[str]
950
+
1635
951
  base_name : typing.Optional[str]
1636
952
 
1637
953
  config_name : typing.Optional[str]
@@ -1652,7 +968,6 @@ class AsyncAppsClient:
1652
968
 
1653
969
  client = AsyncAgentaApi(
1654
970
  api_key="YOUR_API_KEY",
1655
- base_url="https://yourhost.com/path/to/api",
1656
971
  )
1657
972
 
1658
973
 
@@ -1666,44 +981,16 @@ class AsyncAppsClient:
1666
981
 
1667
982
  asyncio.run(main())
1668
983
  """
1669
- _response = await self._client_wrapper.httpx_client.request(
1670
- f"apps/{jsonable_encoder(app_id)}/variant/from-template",
1671
- method="POST",
1672
- json={
1673
- "variant_name": variant_name,
1674
- "key": key,
1675
- "base_name": base_name,
1676
- "config_name": config_name,
1677
- },
1678
- headers={
1679
- "content-type": "application/json",
1680
- },
984
+ _response = await self._raw_client.add_variant_from_key(
985
+ app_id,
986
+ variant_name=variant_name,
987
+ key=key,
988
+ commit_message=commit_message,
989
+ base_name=base_name,
990
+ config_name=config_name,
1681
991
  request_options=request_options,
1682
- omit=OMIT,
1683
992
  )
1684
- try:
1685
- if 200 <= _response.status_code < 300:
1686
- return typing.cast(
1687
- typing.Optional[typing.Any],
1688
- parse_obj_as(
1689
- type_=typing.Optional[typing.Any], # type: ignore
1690
- object_=_response.json(),
1691
- ),
1692
- )
1693
- if _response.status_code == 422:
1694
- raise UnprocessableEntityError(
1695
- typing.cast(
1696
- HttpValidationError,
1697
- parse_obj_as(
1698
- type_=HttpValidationError, # type: ignore
1699
- object_=_response.json(),
1700
- ),
1701
- )
1702
- )
1703
- _response_json = _response.json()
1704
- except JSONDecodeError:
1705
- raise ApiError(status_code=_response.status_code, body=_response.text)
1706
- raise ApiError(status_code=_response.status_code, body=_response_json)
993
+ return _response.data
1707
994
 
1708
995
  async def list_environments(
1709
996
  self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1737,7 +1024,6 @@ class AsyncAppsClient:
1737
1024
 
1738
1025
  client = AsyncAgentaApi(
1739
1026
  api_key="YOUR_API_KEY",
1740
- base_url="https://yourhost.com/path/to/api",
1741
1027
  )
1742
1028
 
1743
1029
 
@@ -1749,34 +1035,10 @@ class AsyncAppsClient:
1749
1035
 
1750
1036
  asyncio.run(main())
1751
1037
  """
1752
- _response = await self._client_wrapper.httpx_client.request(
1753
- f"apps/{jsonable_encoder(app_id)}/environments",
1754
- method="GET",
1755
- request_options=request_options,
1038
+ _response = await self._raw_client.list_environments(
1039
+ app_id, request_options=request_options
1756
1040
  )
1757
- try:
1758
- if 200 <= _response.status_code < 300:
1759
- return typing.cast(
1760
- typing.List[EnvironmentOutput],
1761
- parse_obj_as(
1762
- type_=typing.List[EnvironmentOutput], # type: ignore
1763
- object_=_response.json(),
1764
- ),
1765
- )
1766
- if _response.status_code == 422:
1767
- raise UnprocessableEntityError(
1768
- typing.cast(
1769
- HttpValidationError,
1770
- parse_obj_as(
1771
- type_=HttpValidationError, # type: ignore
1772
- object_=_response.json(),
1773
- ),
1774
- )
1775
- )
1776
- _response_json = _response.json()
1777
- except JSONDecodeError:
1778
- raise ApiError(status_code=_response.status_code, body=_response.text)
1779
- raise ApiError(status_code=_response.status_code, body=_response_json)
1041
+ return _response.data
1780
1042
 
1781
1043
  async def environment_revisions(
1782
1044
  self,
@@ -1808,7 +1070,6 @@ class AsyncAppsClient:
1808
1070
 
1809
1071
  client = AsyncAgentaApi(
1810
1072
  api_key="YOUR_API_KEY",
1811
- base_url="https://yourhost.com/path/to/api",
1812
1073
  )
1813
1074
 
1814
1075
 
@@ -1821,31 +1082,7 @@ class AsyncAppsClient:
1821
1082
 
1822
1083
  asyncio.run(main())
1823
1084
  """
1824
- _response = await self._client_wrapper.httpx_client.request(
1825
- f"apps/{jsonable_encoder(app_id)}/revisions/{jsonable_encoder(environment_name)}",
1826
- method="GET",
1827
- request_options=request_options,
1085
+ _response = await self._raw_client.environment_revisions(
1086
+ app_id, environment_name, request_options=request_options
1828
1087
  )
1829
- try:
1830
- if 200 <= _response.status_code < 300:
1831
- return typing.cast(
1832
- EnvironmentOutputExtended,
1833
- parse_obj_as(
1834
- type_=EnvironmentOutputExtended, # type: ignore
1835
- object_=_response.json(),
1836
- ),
1837
- )
1838
- if _response.status_code == 422:
1839
- raise UnprocessableEntityError(
1840
- typing.cast(
1841
- HttpValidationError,
1842
- parse_obj_as(
1843
- type_=HttpValidationError, # type: ignore
1844
- object_=_response.json(),
1845
- ),
1846
- )
1847
- )
1848
- _response_json = _response.json()
1849
- except JSONDecodeError:
1850
- raise ApiError(status_code=_response.status_code, body=_response.text)
1851
- raise ApiError(status_code=_response.status_code, body=_response_json)
1088
+ return _response.data