agenta 0.48.9__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 (295) 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/types.py +28 -1
  285. {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
  286. agenta-0.48.10.dist-info/RECORD +362 -0
  287. agenta/client/backend/containers/types/__init__.py +0 -5
  288. agenta/client/backend/containers/types/container_templates_response.py +0 -6
  289. agenta/client/backend/types/image.py +0 -25
  290. agenta/client/backend/types/provider_kind.py +0 -21
  291. agenta/client/backend/types/template.py +0 -23
  292. agenta/client/backend/types/template_image_info.py +0 -29
  293. agenta/client/backend/types/variant_action.py +0 -22
  294. agenta-0.48.9.dist-info/RECORD +0 -255
  295. {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
@@ -1,195 +1,33 @@
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
5
- from .. import core
6
- from ..core.request_options import RequestOptions
7
- from ..types.image import Image
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
- from .types.container_templates_response import ContainerTemplatesResponse
14
- from ..types.uri import Uri
15
- from ..core.client_wrapper import AsyncClientWrapper
16
4
 
17
- # this is used as the default value for optional parameters
18
- OMIT = typing.cast(typing.Any, ...)
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from .raw_client import AsyncRawContainersClient, RawContainersClient
19
8
 
20
9
 
21
10
  class ContainersClient:
22
11
  def __init__(self, *, client_wrapper: SyncClientWrapper):
23
- self._client_wrapper = client_wrapper
24
-
25
- def build_image(
26
- self,
27
- *,
28
- app_id: str,
29
- base_name: str,
30
- tar_file: core.File,
31
- request_options: typing.Optional[RequestOptions] = None,
32
- ) -> Image:
33
- """
34
- Builds a Docker image from a tar file containing the application code.
35
-
36
- Args:
37
- app_id (str): The ID of the application to build the image for.
38
- base_name (str): The base name of the image to build.
39
- tar_file (UploadFile): The tar file containing the application code.
40
-
41
- Returns:
42
- Image: The Docker image that was built.
43
-
44
- Parameters
45
- ----------
46
- app_id : str
47
-
48
- base_name : str
49
-
50
- tar_file : core.File
51
- See core.File for more documentation
52
-
53
- request_options : typing.Optional[RequestOptions]
54
- Request-specific configuration.
55
-
56
- Returns
57
- -------
58
- Image
59
- Successful Response
60
-
61
- Examples
62
- --------
63
- from agenta import AgentaApi
12
+ self._raw_client = RawContainersClient(client_wrapper=client_wrapper)
64
13
 
65
- client = AgentaApi(
66
- api_key="YOUR_API_KEY",
67
- base_url="https://yourhost.com/path/to/api",
68
- )
69
- client.containers.build_image(
70
- app_id="app_id",
71
- base_name="base_name",
72
- )
14
+ @property
15
+ def with_raw_response(self) -> RawContainersClient:
73
16
  """
74
- _response = self._client_wrapper.httpx_client.request(
75
- "containers/build_image",
76
- method="POST",
77
- params={
78
- "app_id": app_id,
79
- "base_name": base_name,
80
- },
81
- data={},
82
- files={
83
- "tar_file": tar_file,
84
- },
85
- request_options=request_options,
86
- omit=OMIT,
87
- )
88
- try:
89
- if 200 <= _response.status_code < 300:
90
- return typing.cast(
91
- Image,
92
- parse_obj_as(
93
- type_=Image, # type: ignore
94
- object_=_response.json(),
95
- ),
96
- )
97
- if _response.status_code == 422:
98
- raise UnprocessableEntityError(
99
- typing.cast(
100
- HttpValidationError,
101
- parse_obj_as(
102
- type_=HttpValidationError, # type: ignore
103
- object_=_response.json(),
104
- ),
105
- )
106
- )
107
- _response_json = _response.json()
108
- except JSONDecodeError:
109
- raise ApiError(status_code=_response.status_code, body=_response.text)
110
- raise ApiError(status_code=_response.status_code, body=_response_json)
111
-
112
- def restart_container(
113
- self,
114
- *,
115
- variant_id: str,
116
- request_options: typing.Optional[RequestOptions] = None,
117
- ) -> typing.Dict[str, typing.Optional[typing.Any]]:
118
- """
119
- Restart docker container.
120
-
121
- Args:
122
- payload (RestartAppContainer) -- the required data (app_name and variant_name)
123
-
124
- Parameters
125
- ----------
126
- variant_id : str
127
-
128
- request_options : typing.Optional[RequestOptions]
129
- Request-specific configuration.
17
+ Retrieves a raw implementation of this client that returns raw responses.
130
18
 
131
19
  Returns
132
20
  -------
133
- typing.Dict[str, typing.Optional[typing.Any]]
134
- Successful Response
135
-
136
- Examples
137
- --------
138
- from agenta import AgentaApi
139
-
140
- client = AgentaApi(
141
- api_key="YOUR_API_KEY",
142
- base_url="https://yourhost.com/path/to/api",
143
- )
144
- client.containers.restart_container(
145
- variant_id="variant_id",
146
- )
21
+ RawContainersClient
147
22
  """
148
- _response = self._client_wrapper.httpx_client.request(
149
- "containers/restart_container",
150
- method="POST",
151
- json={
152
- "variant_id": variant_id,
153
- },
154
- headers={
155
- "content-type": "application/json",
156
- },
157
- request_options=request_options,
158
- omit=OMIT,
159
- )
160
- try:
161
- if 200 <= _response.status_code < 300:
162
- return typing.cast(
163
- typing.Dict[str, typing.Optional[typing.Any]],
164
- parse_obj_as(
165
- type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
166
- object_=_response.json(),
167
- ),
168
- )
169
- if _response.status_code == 422:
170
- raise UnprocessableEntityError(
171
- typing.cast(
172
- HttpValidationError,
173
- parse_obj_as(
174
- type_=HttpValidationError, # type: ignore
175
- object_=_response.json(),
176
- ),
177
- )
178
- )
179
- _response_json = _response.json()
180
- except JSONDecodeError:
181
- raise ApiError(status_code=_response.status_code, body=_response.text)
182
- raise ApiError(status_code=_response.status_code, body=_response_json)
23
+ return self._raw_client
183
24
 
184
25
  def container_templates(
185
26
  self, *, request_options: typing.Optional[RequestOptions] = None
186
- ) -> ContainerTemplatesResponse:
27
+ ) -> typing.Optional[typing.Any]:
187
28
  """
188
29
  Returns a list of templates available for creating new containers.
189
30
 
190
- Returns:
191
- Union[List[Template], str]: A list of templates or an error message.
192
-
193
31
  Parameters
194
32
  ----------
195
33
  request_options : typing.Optional[RequestOptions]
@@ -197,7 +35,7 @@ class ContainersClient:
197
35
 
198
36
  Returns
199
37
  -------
200
- ContainerTemplatesResponse
38
+ typing.Optional[typing.Any]
201
39
  Successful Response
202
40
 
203
41
  Examples
@@ -206,296 +44,36 @@ class ContainersClient:
206
44
 
207
45
  client = AgentaApi(
208
46
  api_key="YOUR_API_KEY",
209
- base_url="https://yourhost.com/path/to/api",
210
47
  )
211
48
  client.containers.container_templates()
212
49
  """
213
- _response = self._client_wrapper.httpx_client.request(
214
- "containers/templates",
215
- method="GET",
216
- request_options=request_options,
217
- )
218
- try:
219
- if 200 <= _response.status_code < 300:
220
- return typing.cast(
221
- ContainerTemplatesResponse,
222
- parse_obj_as(
223
- type_=ContainerTemplatesResponse, # type: ignore
224
- object_=_response.json(),
225
- ),
226
- )
227
- _response_json = _response.json()
228
- except JSONDecodeError:
229
- raise ApiError(status_code=_response.status_code, body=_response.text)
230
- raise ApiError(status_code=_response.status_code, body=_response_json)
231
-
232
- def construct_app_container_url(
233
- self,
234
- *,
235
- base_id: typing.Optional[str] = None,
236
- variant_id: typing.Optional[str] = None,
237
- request_options: typing.Optional[RequestOptions] = None,
238
- ) -> Uri:
239
- """
240
- Constructs the URL for an app container based on the provided base_id or variant_id.
241
-
242
- Args:
243
- base_id (Optional[str]): The ID of the base to use for the app container.
244
- variant_id (Optional[str]): The ID of the variant to use for the app container.
245
- request (Request): The request object.
246
-
247
- Returns:
248
- URI: The URI for the app container.
249
-
250
- Raises:
251
- HTTPException: If the base or variant cannot be found or the user does not have access.
252
-
253
- Parameters
254
- ----------
255
- base_id : typing.Optional[str]
256
-
257
- variant_id : typing.Optional[str]
258
-
259
- request_options : typing.Optional[RequestOptions]
260
- Request-specific configuration.
261
-
262
- Returns
263
- -------
264
- Uri
265
- Successful Response
266
-
267
- Examples
268
- --------
269
- from agenta import AgentaApi
270
-
271
- client = AgentaApi(
272
- api_key="YOUR_API_KEY",
273
- base_url="https://yourhost.com/path/to/api",
274
- )
275
- client.containers.construct_app_container_url()
276
- """
277
- _response = self._client_wrapper.httpx_client.request(
278
- "containers/container_url",
279
- method="GET",
280
- params={
281
- "base_id": base_id,
282
- "variant_id": variant_id,
283
- },
284
- request_options=request_options,
50
+ _response = self._raw_client.container_templates(
51
+ request_options=request_options
285
52
  )
286
- try:
287
- if 200 <= _response.status_code < 300:
288
- return typing.cast(
289
- Uri,
290
- parse_obj_as(
291
- type_=Uri, # type: ignore
292
- object_=_response.json(),
293
- ),
294
- )
295
- if _response.status_code == 422:
296
- raise UnprocessableEntityError(
297
- typing.cast(
298
- HttpValidationError,
299
- parse_obj_as(
300
- type_=HttpValidationError, # type: ignore
301
- object_=_response.json(),
302
- ),
303
- )
304
- )
305
- _response_json = _response.json()
306
- except JSONDecodeError:
307
- raise ApiError(status_code=_response.status_code, body=_response.text)
308
- raise ApiError(status_code=_response.status_code, body=_response_json)
53
+ return _response.data
309
54
 
310
55
 
311
56
  class AsyncContainersClient:
312
57
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
313
- self._client_wrapper = client_wrapper
314
-
315
- async def build_image(
316
- self,
317
- *,
318
- app_id: str,
319
- base_name: str,
320
- tar_file: core.File,
321
- request_options: typing.Optional[RequestOptions] = None,
322
- ) -> Image:
323
- """
324
- Builds a Docker image from a tar file containing the application code.
325
-
326
- Args:
327
- app_id (str): The ID of the application to build the image for.
328
- base_name (str): The base name of the image to build.
329
- tar_file (UploadFile): The tar file containing the application code.
330
-
331
- Returns:
332
- Image: The Docker image that was built.
333
-
334
- Parameters
335
- ----------
336
- app_id : str
337
-
338
- base_name : str
339
-
340
- tar_file : core.File
341
- See core.File for more documentation
342
-
343
- request_options : typing.Optional[RequestOptions]
344
- Request-specific configuration.
345
-
346
- Returns
347
- -------
348
- Image
349
- Successful Response
350
-
351
- Examples
352
- --------
353
- import asyncio
354
-
355
- from agenta import AsyncAgentaApi
356
-
357
- client = AsyncAgentaApi(
358
- api_key="YOUR_API_KEY",
359
- base_url="https://yourhost.com/path/to/api",
360
- )
361
-
362
-
363
- async def main() -> None:
364
- await client.containers.build_image(
365
- app_id="app_id",
366
- base_name="base_name",
367
- )
368
-
369
-
370
- asyncio.run(main())
371
- """
372
- _response = await self._client_wrapper.httpx_client.request(
373
- "containers/build_image",
374
- method="POST",
375
- params={
376
- "app_id": app_id,
377
- "base_name": base_name,
378
- },
379
- data={},
380
- files={
381
- "tar_file": tar_file,
382
- },
383
- request_options=request_options,
384
- omit=OMIT,
385
- )
386
- try:
387
- if 200 <= _response.status_code < 300:
388
- return typing.cast(
389
- Image,
390
- parse_obj_as(
391
- type_=Image, # type: ignore
392
- object_=_response.json(),
393
- ),
394
- )
395
- if _response.status_code == 422:
396
- raise UnprocessableEntityError(
397
- typing.cast(
398
- HttpValidationError,
399
- parse_obj_as(
400
- type_=HttpValidationError, # type: ignore
401
- object_=_response.json(),
402
- ),
403
- )
404
- )
405
- _response_json = _response.json()
406
- except JSONDecodeError:
407
- raise ApiError(status_code=_response.status_code, body=_response.text)
408
- raise ApiError(status_code=_response.status_code, body=_response_json)
58
+ self._raw_client = AsyncRawContainersClient(client_wrapper=client_wrapper)
409
59
 
410
- async def restart_container(
411
- self,
412
- *,
413
- variant_id: str,
414
- request_options: typing.Optional[RequestOptions] = None,
415
- ) -> typing.Dict[str, typing.Optional[typing.Any]]:
60
+ @property
61
+ def with_raw_response(self) -> AsyncRawContainersClient:
416
62
  """
417
- Restart docker container.
418
-
419
- Args:
420
- payload (RestartAppContainer) -- the required data (app_name and variant_name)
421
-
422
- Parameters
423
- ----------
424
- variant_id : str
425
-
426
- request_options : typing.Optional[RequestOptions]
427
- Request-specific configuration.
63
+ Retrieves a raw implementation of this client that returns raw responses.
428
64
 
429
65
  Returns
430
66
  -------
431
- typing.Dict[str, typing.Optional[typing.Any]]
432
- Successful Response
433
-
434
- Examples
435
- --------
436
- import asyncio
437
-
438
- from agenta import AsyncAgentaApi
439
-
440
- client = AsyncAgentaApi(
441
- api_key="YOUR_API_KEY",
442
- base_url="https://yourhost.com/path/to/api",
443
- )
444
-
445
-
446
- async def main() -> None:
447
- await client.containers.restart_container(
448
- variant_id="variant_id",
449
- )
450
-
451
-
452
- asyncio.run(main())
67
+ AsyncRawContainersClient
453
68
  """
454
- _response = await self._client_wrapper.httpx_client.request(
455
- "containers/restart_container",
456
- method="POST",
457
- json={
458
- "variant_id": variant_id,
459
- },
460
- headers={
461
- "content-type": "application/json",
462
- },
463
- request_options=request_options,
464
- omit=OMIT,
465
- )
466
- try:
467
- if 200 <= _response.status_code < 300:
468
- return typing.cast(
469
- typing.Dict[str, typing.Optional[typing.Any]],
470
- parse_obj_as(
471
- type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
472
- object_=_response.json(),
473
- ),
474
- )
475
- if _response.status_code == 422:
476
- raise UnprocessableEntityError(
477
- typing.cast(
478
- HttpValidationError,
479
- parse_obj_as(
480
- type_=HttpValidationError, # type: ignore
481
- object_=_response.json(),
482
- ),
483
- )
484
- )
485
- _response_json = _response.json()
486
- except JSONDecodeError:
487
- raise ApiError(status_code=_response.status_code, body=_response.text)
488
- raise ApiError(status_code=_response.status_code, body=_response_json)
69
+ return self._raw_client
489
70
 
490
71
  async def container_templates(
491
72
  self, *, request_options: typing.Optional[RequestOptions] = None
492
- ) -> ContainerTemplatesResponse:
73
+ ) -> typing.Optional[typing.Any]:
493
74
  """
494
75
  Returns a list of templates available for creating new containers.
495
76
 
496
- Returns:
497
- Union[List[Template], str]: A list of templates or an error message.
498
-
499
77
  Parameters
500
78
  ----------
501
79
  request_options : typing.Optional[RequestOptions]
@@ -503,7 +81,7 @@ class AsyncContainersClient:
503
81
 
504
82
  Returns
505
83
  -------
506
- ContainerTemplatesResponse
84
+ typing.Optional[typing.Any]
507
85
  Successful Response
508
86
 
509
87
  Examples
@@ -514,7 +92,6 @@ class AsyncContainersClient:
514
92
 
515
93
  client = AsyncAgentaApi(
516
94
  api_key="YOUR_API_KEY",
517
- base_url="https://yourhost.com/path/to/api",
518
95
  )
519
96
 
520
97
 
@@ -524,107 +101,7 @@ class AsyncContainersClient:
524
101
 
525
102
  asyncio.run(main())
526
103
  """
527
- _response = await self._client_wrapper.httpx_client.request(
528
- "containers/templates",
529
- method="GET",
530
- request_options=request_options,
531
- )
532
- try:
533
- if 200 <= _response.status_code < 300:
534
- return typing.cast(
535
- ContainerTemplatesResponse,
536
- parse_obj_as(
537
- type_=ContainerTemplatesResponse, # type: ignore
538
- object_=_response.json(),
539
- ),
540
- )
541
- _response_json = _response.json()
542
- except JSONDecodeError:
543
- raise ApiError(status_code=_response.status_code, body=_response.text)
544
- raise ApiError(status_code=_response.status_code, body=_response_json)
545
-
546
- async def construct_app_container_url(
547
- self,
548
- *,
549
- base_id: typing.Optional[str] = None,
550
- variant_id: typing.Optional[str] = None,
551
- request_options: typing.Optional[RequestOptions] = None,
552
- ) -> Uri:
553
- """
554
- Constructs the URL for an app container based on the provided base_id or variant_id.
555
-
556
- Args:
557
- base_id (Optional[str]): The ID of the base to use for the app container.
558
- variant_id (Optional[str]): The ID of the variant to use for the app container.
559
- request (Request): The request object.
560
-
561
- Returns:
562
- URI: The URI for the app container.
563
-
564
- Raises:
565
- HTTPException: If the base or variant cannot be found or the user does not have access.
566
-
567
- Parameters
568
- ----------
569
- base_id : typing.Optional[str]
570
-
571
- variant_id : typing.Optional[str]
572
-
573
- request_options : typing.Optional[RequestOptions]
574
- Request-specific configuration.
575
-
576
- Returns
577
- -------
578
- Uri
579
- Successful Response
580
-
581
- Examples
582
- --------
583
- import asyncio
584
-
585
- from agenta import AsyncAgentaApi
586
-
587
- client = AsyncAgentaApi(
588
- api_key="YOUR_API_KEY",
589
- base_url="https://yourhost.com/path/to/api",
590
- )
591
-
592
-
593
- async def main() -> None:
594
- await client.containers.construct_app_container_url()
595
-
596
-
597
- asyncio.run(main())
598
- """
599
- _response = await self._client_wrapper.httpx_client.request(
600
- "containers/container_url",
601
- method="GET",
602
- params={
603
- "base_id": base_id,
604
- "variant_id": variant_id,
605
- },
606
- request_options=request_options,
104
+ _response = await self._raw_client.container_templates(
105
+ request_options=request_options
607
106
  )
608
- try:
609
- if 200 <= _response.status_code < 300:
610
- return typing.cast(
611
- Uri,
612
- parse_obj_as(
613
- type_=Uri, # type: ignore
614
- object_=_response.json(),
615
- ),
616
- )
617
- if _response.status_code == 422:
618
- raise UnprocessableEntityError(
619
- typing.cast(
620
- HttpValidationError,
621
- parse_obj_as(
622
- type_=HttpValidationError, # type: ignore
623
- object_=_response.json(),
624
- ),
625
- )
626
- )
627
- _response_json = _response.json()
628
- except JSONDecodeError:
629
- raise ApiError(status_code=_response.status_code, body=_response.text)
630
- raise ApiError(status_code=_response.status_code, body=_response_json)
107
+ return _response.data