agenta 0.24.1a0__py3-none-any.whl → 0.24.2a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

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