agenta 0.12.3__py3-none-any.whl → 0.32.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/__init__.py +64 -7
- agenta/cli/helper.py +7 -3
- agenta/cli/main.py +15 -50
- agenta/cli/variant_commands.py +50 -29
- agenta/client/Readme.md +72 -64
- agenta/client/api.py +2 -2
- agenta/client/backend/__init__.py +193 -22
- agenta/client/backend/access_control/__init__.py +1 -0
- agenta/client/backend/access_control/client.py +167 -0
- agenta/client/backend/apps/__init__.py +1 -0
- agenta/client/backend/apps/client.py +1691 -0
- agenta/client/backend/bases/__init__.py +1 -0
- agenta/client/backend/bases/client.py +190 -0
- agenta/client/backend/client.py +2508 -5712
- agenta/client/backend/configs/__init__.py +1 -0
- agenta/client/backend/configs/client.py +604 -0
- agenta/client/backend/containers/__init__.py +5 -0
- agenta/client/backend/containers/client.py +648 -0
- agenta/client/backend/containers/types/__init__.py +5 -0
- agenta/client/backend/{types → containers/types}/container_templates_response.py +1 -2
- agenta/client/backend/core/__init__.py +30 -0
- agenta/client/backend/core/client_wrapper.py +42 -9
- agenta/client/backend/core/file.py +70 -0
- agenta/client/backend/core/http_client.py +575 -0
- agenta/client/backend/core/jsonable_encoder.py +33 -39
- agenta/client/backend/core/pydantic_utilities.py +325 -0
- agenta/client/backend/core/query_encoder.py +60 -0
- agenta/client/backend/core/remove_none_from_dict.py +2 -2
- agenta/client/backend/core/request_options.py +35 -0
- agenta/client/backend/core/serialization.py +276 -0
- agenta/client/backend/environments/__init__.py +1 -0
- agenta/client/backend/environments/client.py +196 -0
- agenta/client/backend/evaluations/__init__.py +1 -0
- agenta/client/backend/evaluations/client.py +1469 -0
- agenta/client/backend/evaluators/__init__.py +1 -0
- agenta/client/backend/evaluators/client.py +1283 -0
- agenta/client/backend/observability/__init__.py +1 -0
- agenta/client/backend/observability/client.py +1286 -0
- agenta/client/backend/observability_v_1/__init__.py +5 -0
- agenta/client/backend/observability_v_1/client.py +763 -0
- agenta/client/backend/observability_v_1/types/__init__.py +7 -0
- agenta/client/backend/observability_v_1/types/format.py +5 -0
- agenta/client/backend/observability_v_1/types/query_analytics_response.py +7 -0
- agenta/client/backend/observability_v_1/types/query_traces_response.py +11 -0
- agenta/client/backend/scopes/__init__.py +1 -0
- agenta/client/backend/scopes/client.py +114 -0
- agenta/client/backend/testsets/__init__.py +1 -0
- agenta/client/backend/testsets/client.py +1284 -0
- agenta/client/backend/types/__init__.py +154 -26
- agenta/client/backend/types/agenta_node_dto.py +48 -0
- agenta/client/backend/types/agenta_node_dto_nodes_value.py +6 -0
- agenta/client/backend/types/agenta_nodes_response.py +30 -0
- agenta/client/backend/types/agenta_root_dto.py +30 -0
- agenta/client/backend/types/agenta_roots_response.py +30 -0
- agenta/client/backend/types/agenta_tree_dto.py +30 -0
- agenta/client/backend/types/agenta_trees_response.py +30 -0
- agenta/client/backend/types/aggregated_result.py +16 -31
- agenta/client/backend/types/aggregated_result_evaluator_config.py +8 -0
- agenta/client/backend/types/analytics_response.py +24 -0
- agenta/client/backend/types/app.py +17 -30
- agenta/client/backend/types/app_variant_response.py +36 -0
- agenta/client/backend/types/app_variant_revision.py +17 -32
- agenta/client/backend/types/base_output.py +13 -28
- agenta/client/backend/types/body_import_testset.py +15 -31
- agenta/client/backend/types/bucket_dto.py +26 -0
- agenta/client/backend/types/collect_status_response.py +22 -0
- agenta/client/backend/types/config_db.py +16 -31
- agenta/client/backend/types/config_dto.py +32 -0
- agenta/client/backend/types/config_response_model.py +32 -0
- agenta/client/backend/types/correct_answer.py +22 -0
- agenta/client/backend/types/create_app_output.py +13 -28
- agenta/client/backend/types/create_span.py +45 -0
- agenta/client/backend/types/create_trace_response.py +22 -0
- agenta/client/backend/types/docker_env_vars.py +13 -28
- agenta/client/backend/types/environment_output.py +22 -34
- agenta/client/backend/types/environment_output_extended.py +31 -0
- agenta/client/backend/types/environment_revision.py +26 -0
- agenta/client/backend/types/error.py +22 -0
- agenta/client/backend/types/evaluation.py +22 -33
- agenta/client/backend/types/evaluation_scenario.py +18 -33
- agenta/client/backend/types/evaluation_scenario_input.py +16 -31
- agenta/client/backend/types/evaluation_scenario_output.py +17 -30
- agenta/client/backend/types/evaluation_scenario_result.py +14 -29
- agenta/client/backend/types/evaluation_scenario_score_update.py +21 -0
- agenta/client/backend/types/evaluation_status_enum.py +11 -29
- agenta/client/backend/types/evaluation_type.py +3 -21
- agenta/client/backend/types/evaluator.py +20 -31
- agenta/client/backend/types/evaluator_config.py +21 -33
- agenta/client/backend/types/evaluator_mapping_output_interface.py +21 -0
- agenta/client/backend/types/evaluator_output_interface.py +21 -0
- agenta/client/backend/types/exception_dto.py +26 -0
- agenta/client/backend/types/get_config_response.py +23 -0
- agenta/client/backend/types/header_dto.py +22 -0
- agenta/client/backend/types/http_validation_error.py +14 -29
- agenta/client/backend/types/human_evaluation.py +18 -34
- agenta/client/backend/types/human_evaluation_scenario.py +22 -38
- agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
- agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
- agenta/client/backend/types/human_evaluation_scenario_update.py +30 -0
- agenta/client/backend/types/human_evaluation_update.py +22 -0
- agenta/client/backend/types/image.py +18 -32
- agenta/client/backend/types/invite_request.py +16 -30
- agenta/client/backend/types/legacy_analytics_response.py +29 -0
- agenta/client/backend/types/legacy_data_point.py +27 -0
- agenta/client/backend/types/lifecycle_dto.py +24 -0
- agenta/client/backend/types/link_dto.py +24 -0
- agenta/client/backend/types/list_api_keys_response.py +24 -0
- agenta/client/backend/types/llm_run_rate_limit.py +13 -28
- agenta/client/backend/types/llm_tokens.py +23 -0
- agenta/client/backend/types/metrics_dto.py +24 -0
- agenta/client/backend/types/new_human_evaluation.py +27 -0
- agenta/client/backend/types/new_testset.py +16 -31
- agenta/client/backend/types/node_dto.py +24 -0
- agenta/client/backend/types/node_type.py +19 -0
- agenta/client/backend/types/o_tel_context_dto.py +22 -0
- agenta/client/backend/types/o_tel_event_dto.py +23 -0
- agenta/client/backend/types/o_tel_extra_dto.py +26 -0
- agenta/client/backend/types/o_tel_link_dto.py +23 -0
- agenta/client/backend/types/o_tel_span_dto.py +37 -0
- agenta/client/backend/types/o_tel_span_kind.py +15 -0
- agenta/client/backend/types/o_tel_spans_response.py +24 -0
- agenta/client/backend/types/o_tel_status_code.py +8 -0
- agenta/client/backend/types/organization.py +22 -35
- agenta/client/backend/types/organization_output.py +13 -28
- agenta/client/backend/types/outputs.py +5 -0
- agenta/client/backend/types/parent_dto.py +21 -0
- agenta/client/backend/types/permission.py +41 -0
- agenta/client/backend/types/projects_response.py +28 -0
- agenta/client/backend/types/provider_key_dto.py +23 -0
- agenta/client/backend/types/provider_kind.py +21 -0
- agenta/client/backend/types/reference_dto.py +23 -0
- agenta/client/backend/types/reference_request_model.py +23 -0
- agenta/client/backend/types/result.py +18 -31
- agenta/client/backend/types/root_dto.py +21 -0
- agenta/client/backend/types/{human_evaluation_scenario_score.py → score.py} +1 -1
- agenta/client/backend/types/secret_dto.py +24 -0
- agenta/client/backend/types/{human_evaluation_scenario_update_score.py → secret_kind.py} +1 -1
- agenta/client/backend/types/secret_response_dto.py +27 -0
- agenta/client/backend/types/simple_evaluation_output.py +13 -28
- agenta/client/backend/types/span.py +39 -49
- agenta/client/backend/types/span_detail.py +44 -0
- agenta/client/backend/types/span_dto.py +54 -0
- agenta/client/backend/types/span_dto_nodes_value.py +9 -0
- agenta/client/backend/types/span_status_code.py +5 -0
- agenta/client/backend/types/span_variant.py +23 -0
- agenta/client/backend/types/status_code.py +5 -0
- agenta/client/backend/types/status_dto.py +23 -0
- agenta/client/backend/types/template.py +14 -29
- agenta/client/backend/types/template_image_info.py +21 -35
- agenta/client/backend/types/test_set_output_response.py +20 -33
- agenta/client/backend/types/test_set_simple_response.py +13 -28
- agenta/client/backend/types/time_dto.py +23 -0
- agenta/client/backend/types/trace_detail.py +44 -0
- agenta/client/backend/types/tree_dto.py +23 -0
- agenta/client/backend/types/tree_type.py +5 -0
- agenta/client/backend/types/update_app_output.py +22 -0
- agenta/client/backend/types/uri.py +13 -28
- agenta/client/backend/types/validation_error.py +13 -28
- agenta/client/backend/types/variant_action.py +14 -29
- agenta/client/backend/types/variant_action_enum.py +1 -19
- agenta/client/backend/types/with_pagination.py +26 -0
- agenta/client/backend/types/workspace_member_response.py +23 -0
- agenta/client/backend/types/workspace_permission.py +25 -0
- agenta/client/backend/types/workspace_response.py +29 -0
- agenta/client/backend/types/workspace_role.py +15 -0
- agenta/client/backend/types/workspace_role_response.py +23 -0
- agenta/client/backend/variants/__init__.py +5 -0
- agenta/client/backend/variants/client.py +2814 -0
- agenta/client/backend/variants/types/__init__.py +7 -0
- agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
- agenta/client/backend/vault/__init__.py +1 -0
- agenta/client/backend/vault/client.py +685 -0
- agenta/client/client.py +1 -1
- agenta/config.py +0 -2
- agenta/config.toml +0 -1
- agenta/docker/docker-assets/Dockerfile.cloud.template +2 -1
- agenta/docker/docker-assets/Dockerfile.template +2 -1
- agenta/docker/docker_utils.py +11 -12
- agenta/sdk/__init__.py +58 -7
- agenta/sdk/agenta_init.py +182 -164
- agenta/sdk/assets.py +95 -0
- agenta/sdk/client.py +56 -0
- agenta/sdk/context/__init__.py +0 -0
- agenta/sdk/context/exporting.py +25 -0
- agenta/sdk/context/routing.py +27 -0
- agenta/sdk/context/tracing.py +28 -0
- agenta/sdk/decorators/__init__.py +0 -0
- agenta/sdk/decorators/routing.py +576 -0
- agenta/sdk/decorators/tracing.py +296 -0
- agenta/sdk/litellm/__init__.py +1 -0
- agenta/sdk/litellm/litellm.py +314 -0
- agenta/sdk/litellm/mockllm.py +27 -0
- agenta/sdk/litellm/mocks/__init__.py +26 -0
- agenta/sdk/managers/__init__.py +6 -0
- agenta/sdk/managers/config.py +208 -0
- agenta/sdk/managers/deployment.py +45 -0
- agenta/sdk/managers/secrets.py +38 -0
- agenta/sdk/managers/shared.py +639 -0
- agenta/sdk/managers/variant.py +182 -0
- agenta/sdk/managers/vault.py +16 -0
- agenta/sdk/middleware/__init__.py +0 -0
- agenta/sdk/middleware/auth.py +180 -0
- agenta/sdk/middleware/cache.py +47 -0
- agenta/sdk/middleware/config.py +255 -0
- agenta/sdk/middleware/cors.py +29 -0
- agenta/sdk/middleware/inline.py +38 -0
- agenta/sdk/middleware/mock.py +33 -0
- agenta/sdk/middleware/otel.py +40 -0
- agenta/sdk/middleware/vault.py +145 -0
- agenta/sdk/router.py +0 -7
- agenta/sdk/tracing/__init__.py +1 -0
- agenta/sdk/tracing/attributes.py +141 -0
- agenta/sdk/tracing/conventions.py +49 -0
- agenta/sdk/tracing/exporters.py +103 -0
- agenta/sdk/tracing/inline.py +1146 -0
- agenta/sdk/tracing/processors.py +121 -0
- agenta/sdk/tracing/spans.py +136 -0
- agenta/sdk/tracing/tracing.py +237 -0
- agenta/sdk/types.py +478 -74
- agenta/sdk/utils/__init__.py +0 -0
- agenta/sdk/utils/constants.py +1 -0
- agenta/sdk/utils/{helper/openai_cost.py → costs.py} +3 -0
- agenta/sdk/utils/exceptions.py +59 -0
- agenta/sdk/utils/globals.py +6 -10
- agenta/sdk/utils/helpers.py +8 -0
- agenta/sdk/utils/logging.py +21 -0
- agenta/sdk/utils/singleton.py +13 -0
- agenta/sdk/utils/timing.py +58 -0
- {agenta-0.12.3.dist-info → agenta-0.32.0a1.dist-info}/METADATA +98 -151
- agenta-0.32.0a1.dist-info/RECORD +263 -0
- {agenta-0.12.3.dist-info → agenta-0.32.0a1.dist-info}/WHEEL +1 -1
- agenta/client/backend/types/add_variant_from_base_and_config_response.py +0 -7
- agenta/client/backend/types/app_variant_output.py +0 -47
- agenta/client/backend/types/app_variant_output_extended.py +0 -50
- agenta/client/backend/types/delete_evaluation.py +0 -36
- agenta/client/backend/types/evaluation_webhook.py +0 -36
- agenta/client/backend/types/feedback.py +0 -40
- agenta/client/backend/types/get_config_reponse.py +0 -39
- agenta/client/backend/types/list_api_keys_output.py +0 -39
- agenta/client/backend/types/trace.py +0 -48
- agenta/sdk/agenta_decorator.py +0 -443
- agenta/sdk/context.py +0 -41
- agenta-0.12.3.dist-info/RECORD +0 -114
- {agenta-0.12.3.dist-info → agenta-0.32.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,2814 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from .types.add_variant_from_base_and_config_response import (
|
|
7
|
+
AddVariantFromBaseAndConfigResponse,
|
|
8
|
+
)
|
|
9
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
11
|
+
from ..types.http_validation_error import HttpValidationError
|
|
12
|
+
from json.decoder import JSONDecodeError
|
|
13
|
+
from ..core.api_error import ApiError
|
|
14
|
+
from ..types.app_variant_response import AppVariantResponse
|
|
15
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
16
|
+
from ..types.variant_action import VariantAction
|
|
17
|
+
from ..types.docker_env_vars import DockerEnvVars
|
|
18
|
+
from ..types.uri import Uri
|
|
19
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
20
|
+
from ..types.app_variant_revision import AppVariantRevision
|
|
21
|
+
from ..types.reference_request_model import ReferenceRequestModel
|
|
22
|
+
from ..types.config_response_model import ConfigResponseModel
|
|
23
|
+
from ..types.config_dto import ConfigDto
|
|
24
|
+
from ..types.reference_dto import ReferenceDto
|
|
25
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
26
|
+
|
|
27
|
+
# this is used as the default value for optional parameters
|
|
28
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class VariantsClient:
|
|
32
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
33
|
+
self._client_wrapper = client_wrapper
|
|
34
|
+
|
|
35
|
+
def add_variant_from_base_and_config(
|
|
36
|
+
self,
|
|
37
|
+
*,
|
|
38
|
+
base_id: str,
|
|
39
|
+
new_variant_name: str,
|
|
40
|
+
new_config_name: str,
|
|
41
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]],
|
|
42
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
43
|
+
) -> AddVariantFromBaseAndConfigResponse:
|
|
44
|
+
"""
|
|
45
|
+
Add a new variant based on an existing one.
|
|
46
|
+
Same as POST /config
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
|
|
50
|
+
stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
HTTPException: Raised if the variant could not be added or accessed.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Union[AppVariantResponse, Any]: New variant details or exception.
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
base_id : str
|
|
61
|
+
|
|
62
|
+
new_variant_name : str
|
|
63
|
+
|
|
64
|
+
new_config_name : str
|
|
65
|
+
|
|
66
|
+
parameters : typing.Dict[str, typing.Optional[typing.Any]]
|
|
67
|
+
|
|
68
|
+
request_options : typing.Optional[RequestOptions]
|
|
69
|
+
Request-specific configuration.
|
|
70
|
+
|
|
71
|
+
Returns
|
|
72
|
+
-------
|
|
73
|
+
AddVariantFromBaseAndConfigResponse
|
|
74
|
+
Successful Response
|
|
75
|
+
|
|
76
|
+
Examples
|
|
77
|
+
--------
|
|
78
|
+
from agenta import AgentaApi
|
|
79
|
+
|
|
80
|
+
client = AgentaApi(
|
|
81
|
+
api_key="YOUR_API_KEY",
|
|
82
|
+
base_url="https://yourhost.com/path/to/api",
|
|
83
|
+
)
|
|
84
|
+
client.variants.add_variant_from_base_and_config(
|
|
85
|
+
base_id="base_id",
|
|
86
|
+
new_variant_name="new_variant_name",
|
|
87
|
+
new_config_name="new_config_name",
|
|
88
|
+
parameters={"key": "value"},
|
|
89
|
+
)
|
|
90
|
+
"""
|
|
91
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
92
|
+
"variants/from-base",
|
|
93
|
+
method="POST",
|
|
94
|
+
json={
|
|
95
|
+
"base_id": base_id,
|
|
96
|
+
"new_variant_name": new_variant_name,
|
|
97
|
+
"new_config_name": new_config_name,
|
|
98
|
+
"parameters": parameters,
|
|
99
|
+
},
|
|
100
|
+
headers={
|
|
101
|
+
"content-type": "application/json",
|
|
102
|
+
},
|
|
103
|
+
request_options=request_options,
|
|
104
|
+
omit=OMIT,
|
|
105
|
+
)
|
|
106
|
+
try:
|
|
107
|
+
if 200 <= _response.status_code < 300:
|
|
108
|
+
return typing.cast(
|
|
109
|
+
AddVariantFromBaseAndConfigResponse,
|
|
110
|
+
parse_obj_as(
|
|
111
|
+
type_=AddVariantFromBaseAndConfigResponse, # type: ignore
|
|
112
|
+
object_=_response.json(),
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
if _response.status_code == 422:
|
|
116
|
+
raise UnprocessableEntityError(
|
|
117
|
+
typing.cast(
|
|
118
|
+
HttpValidationError,
|
|
119
|
+
parse_obj_as(
|
|
120
|
+
type_=HttpValidationError, # type: ignore
|
|
121
|
+
object_=_response.json(),
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
_response_json = _response.json()
|
|
126
|
+
except JSONDecodeError:
|
|
127
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
128
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
129
|
+
|
|
130
|
+
def get_variant(
|
|
131
|
+
self,
|
|
132
|
+
variant_id: str,
|
|
133
|
+
*,
|
|
134
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
135
|
+
) -> AppVariantResponse:
|
|
136
|
+
"""
|
|
137
|
+
Parameters
|
|
138
|
+
----------
|
|
139
|
+
variant_id : str
|
|
140
|
+
|
|
141
|
+
request_options : typing.Optional[RequestOptions]
|
|
142
|
+
Request-specific configuration.
|
|
143
|
+
|
|
144
|
+
Returns
|
|
145
|
+
-------
|
|
146
|
+
AppVariantResponse
|
|
147
|
+
Successful Response
|
|
148
|
+
|
|
149
|
+
Examples
|
|
150
|
+
--------
|
|
151
|
+
from agenta import AgentaApi
|
|
152
|
+
|
|
153
|
+
client = AgentaApi(
|
|
154
|
+
api_key="YOUR_API_KEY",
|
|
155
|
+
base_url="https://yourhost.com/path/to/api",
|
|
156
|
+
)
|
|
157
|
+
client.variants.get_variant(
|
|
158
|
+
variant_id="variant_id",
|
|
159
|
+
)
|
|
160
|
+
"""
|
|
161
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
162
|
+
f"variants/{jsonable_encoder(variant_id)}",
|
|
163
|
+
method="GET",
|
|
164
|
+
request_options=request_options,
|
|
165
|
+
)
|
|
166
|
+
try:
|
|
167
|
+
if 200 <= _response.status_code < 300:
|
|
168
|
+
return typing.cast(
|
|
169
|
+
AppVariantResponse,
|
|
170
|
+
parse_obj_as(
|
|
171
|
+
type_=AppVariantResponse, # type: ignore
|
|
172
|
+
object_=_response.json(),
|
|
173
|
+
),
|
|
174
|
+
)
|
|
175
|
+
if _response.status_code == 422:
|
|
176
|
+
raise UnprocessableEntityError(
|
|
177
|
+
typing.cast(
|
|
178
|
+
HttpValidationError,
|
|
179
|
+
parse_obj_as(
|
|
180
|
+
type_=HttpValidationError, # type: ignore
|
|
181
|
+
object_=_response.json(),
|
|
182
|
+
),
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
_response_json = _response.json()
|
|
186
|
+
except JSONDecodeError:
|
|
187
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
188
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
189
|
+
|
|
190
|
+
def start_variant(
|
|
191
|
+
self,
|
|
192
|
+
variant_id: str,
|
|
193
|
+
*,
|
|
194
|
+
action: VariantAction,
|
|
195
|
+
env_vars: typing.Optional[DockerEnvVars] = OMIT,
|
|
196
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
197
|
+
) -> Uri:
|
|
198
|
+
"""
|
|
199
|
+
Start a variant of an app.
|
|
200
|
+
|
|
201
|
+
Args:
|
|
202
|
+
variant_id (str): The ID of the variant to start.
|
|
203
|
+
action (VariantAction): The action to perform on the variant (start).
|
|
204
|
+
env_vars (Optional[DockerEnvVars], optional): The environment variables to inject to the Docker container. Defaults to None.
|
|
205
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
URI: The URL of the started variant.
|
|
209
|
+
|
|
210
|
+
Raises:
|
|
211
|
+
HTTPException: If the app container cannot be started.
|
|
212
|
+
|
|
213
|
+
Parameters
|
|
214
|
+
----------
|
|
215
|
+
variant_id : str
|
|
216
|
+
|
|
217
|
+
action : VariantAction
|
|
218
|
+
|
|
219
|
+
env_vars : typing.Optional[DockerEnvVars]
|
|
220
|
+
|
|
221
|
+
request_options : typing.Optional[RequestOptions]
|
|
222
|
+
Request-specific configuration.
|
|
223
|
+
|
|
224
|
+
Returns
|
|
225
|
+
-------
|
|
226
|
+
Uri
|
|
227
|
+
Successful Response
|
|
228
|
+
|
|
229
|
+
Examples
|
|
230
|
+
--------
|
|
231
|
+
from agenta import AgentaApi, VariantAction
|
|
232
|
+
|
|
233
|
+
client = AgentaApi(
|
|
234
|
+
api_key="YOUR_API_KEY",
|
|
235
|
+
base_url="https://yourhost.com/path/to/api",
|
|
236
|
+
)
|
|
237
|
+
client.variants.start_variant(
|
|
238
|
+
variant_id="variant_id",
|
|
239
|
+
action=VariantAction(
|
|
240
|
+
action="START",
|
|
241
|
+
),
|
|
242
|
+
)
|
|
243
|
+
"""
|
|
244
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
245
|
+
f"variants/{jsonable_encoder(variant_id)}",
|
|
246
|
+
method="PUT",
|
|
247
|
+
json={
|
|
248
|
+
"action": convert_and_respect_annotation_metadata(
|
|
249
|
+
object_=action, annotation=VariantAction, direction="write"
|
|
250
|
+
),
|
|
251
|
+
"env_vars": convert_and_respect_annotation_metadata(
|
|
252
|
+
object_=env_vars, annotation=DockerEnvVars, direction="write"
|
|
253
|
+
),
|
|
254
|
+
},
|
|
255
|
+
headers={
|
|
256
|
+
"content-type": "application/json",
|
|
257
|
+
},
|
|
258
|
+
request_options=request_options,
|
|
259
|
+
omit=OMIT,
|
|
260
|
+
)
|
|
261
|
+
try:
|
|
262
|
+
if 200 <= _response.status_code < 300:
|
|
263
|
+
return typing.cast(
|
|
264
|
+
Uri,
|
|
265
|
+
parse_obj_as(
|
|
266
|
+
type_=Uri, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
if _response.status_code == 422:
|
|
271
|
+
raise UnprocessableEntityError(
|
|
272
|
+
typing.cast(
|
|
273
|
+
HttpValidationError,
|
|
274
|
+
parse_obj_as(
|
|
275
|
+
type_=HttpValidationError, # type: ignore
|
|
276
|
+
object_=_response.json(),
|
|
277
|
+
),
|
|
278
|
+
)
|
|
279
|
+
)
|
|
280
|
+
_response_json = _response.json()
|
|
281
|
+
except JSONDecodeError:
|
|
282
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
283
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
284
|
+
|
|
285
|
+
def remove_variant(
|
|
286
|
+
self,
|
|
287
|
+
variant_id: str,
|
|
288
|
+
*,
|
|
289
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
290
|
+
) -> typing.Optional[typing.Any]:
|
|
291
|
+
"""
|
|
292
|
+
Remove a variant from the server.
|
|
293
|
+
In the case it's the last variant using the image, stop the container and remove the image.
|
|
294
|
+
|
|
295
|
+
Arguments:
|
|
296
|
+
app_variant -- AppVariant to remove
|
|
297
|
+
|
|
298
|
+
Raises:
|
|
299
|
+
HTTPException: If there is a problem removing the app variant
|
|
300
|
+
|
|
301
|
+
Parameters
|
|
302
|
+
----------
|
|
303
|
+
variant_id : str
|
|
304
|
+
|
|
305
|
+
request_options : typing.Optional[RequestOptions]
|
|
306
|
+
Request-specific configuration.
|
|
307
|
+
|
|
308
|
+
Returns
|
|
309
|
+
-------
|
|
310
|
+
typing.Optional[typing.Any]
|
|
311
|
+
Successful Response
|
|
312
|
+
|
|
313
|
+
Examples
|
|
314
|
+
--------
|
|
315
|
+
from agenta import AgentaApi
|
|
316
|
+
|
|
317
|
+
client = AgentaApi(
|
|
318
|
+
api_key="YOUR_API_KEY",
|
|
319
|
+
base_url="https://yourhost.com/path/to/api",
|
|
320
|
+
)
|
|
321
|
+
client.variants.remove_variant(
|
|
322
|
+
variant_id="variant_id",
|
|
323
|
+
)
|
|
324
|
+
"""
|
|
325
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
326
|
+
f"variants/{jsonable_encoder(variant_id)}",
|
|
327
|
+
method="DELETE",
|
|
328
|
+
request_options=request_options,
|
|
329
|
+
)
|
|
330
|
+
try:
|
|
331
|
+
if 200 <= _response.status_code < 300:
|
|
332
|
+
return typing.cast(
|
|
333
|
+
typing.Optional[typing.Any],
|
|
334
|
+
parse_obj_as(
|
|
335
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
336
|
+
object_=_response.json(),
|
|
337
|
+
),
|
|
338
|
+
)
|
|
339
|
+
if _response.status_code == 422:
|
|
340
|
+
raise UnprocessableEntityError(
|
|
341
|
+
typing.cast(
|
|
342
|
+
HttpValidationError,
|
|
343
|
+
parse_obj_as(
|
|
344
|
+
type_=HttpValidationError, # type: ignore
|
|
345
|
+
object_=_response.json(),
|
|
346
|
+
),
|
|
347
|
+
)
|
|
348
|
+
)
|
|
349
|
+
_response_json = _response.json()
|
|
350
|
+
except JSONDecodeError:
|
|
351
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
352
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
353
|
+
|
|
354
|
+
def update_variant_parameters(
|
|
355
|
+
self,
|
|
356
|
+
variant_id: str,
|
|
357
|
+
*,
|
|
358
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]],
|
|
359
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
360
|
+
) -> typing.Optional[typing.Any]:
|
|
361
|
+
"""
|
|
362
|
+
Updates the parameters for an app variant.
|
|
363
|
+
|
|
364
|
+
Args:
|
|
365
|
+
variant_id (str): The ID of the app variant to update.
|
|
366
|
+
payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
|
|
367
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
368
|
+
|
|
369
|
+
Raises:
|
|
370
|
+
HTTPException: If there is an error while trying to update the app variant.
|
|
371
|
+
|
|
372
|
+
Returns:
|
|
373
|
+
JSONResponse: A JSON response containing the updated app variant parameters.
|
|
374
|
+
|
|
375
|
+
Parameters
|
|
376
|
+
----------
|
|
377
|
+
variant_id : str
|
|
378
|
+
|
|
379
|
+
parameters : typing.Dict[str, typing.Optional[typing.Any]]
|
|
380
|
+
|
|
381
|
+
request_options : typing.Optional[RequestOptions]
|
|
382
|
+
Request-specific configuration.
|
|
383
|
+
|
|
384
|
+
Returns
|
|
385
|
+
-------
|
|
386
|
+
typing.Optional[typing.Any]
|
|
387
|
+
Successful Response
|
|
388
|
+
|
|
389
|
+
Examples
|
|
390
|
+
--------
|
|
391
|
+
from agenta import AgentaApi
|
|
392
|
+
|
|
393
|
+
client = AgentaApi(
|
|
394
|
+
api_key="YOUR_API_KEY",
|
|
395
|
+
base_url="https://yourhost.com/path/to/api",
|
|
396
|
+
)
|
|
397
|
+
client.variants.update_variant_parameters(
|
|
398
|
+
variant_id="variant_id",
|
|
399
|
+
parameters={"key": "value"},
|
|
400
|
+
)
|
|
401
|
+
"""
|
|
402
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
403
|
+
f"variants/{jsonable_encoder(variant_id)}/parameters",
|
|
404
|
+
method="PUT",
|
|
405
|
+
json={
|
|
406
|
+
"parameters": parameters,
|
|
407
|
+
},
|
|
408
|
+
headers={
|
|
409
|
+
"content-type": "application/json",
|
|
410
|
+
},
|
|
411
|
+
request_options=request_options,
|
|
412
|
+
omit=OMIT,
|
|
413
|
+
)
|
|
414
|
+
try:
|
|
415
|
+
if 200 <= _response.status_code < 300:
|
|
416
|
+
return typing.cast(
|
|
417
|
+
typing.Optional[typing.Any],
|
|
418
|
+
parse_obj_as(
|
|
419
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
420
|
+
object_=_response.json(),
|
|
421
|
+
),
|
|
422
|
+
)
|
|
423
|
+
if _response.status_code == 422:
|
|
424
|
+
raise UnprocessableEntityError(
|
|
425
|
+
typing.cast(
|
|
426
|
+
HttpValidationError,
|
|
427
|
+
parse_obj_as(
|
|
428
|
+
type_=HttpValidationError, # type: ignore
|
|
429
|
+
object_=_response.json(),
|
|
430
|
+
),
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
_response_json = _response.json()
|
|
434
|
+
except JSONDecodeError:
|
|
435
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
436
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
437
|
+
|
|
438
|
+
def update_variant_image(
|
|
439
|
+
self,
|
|
440
|
+
variant_id: str,
|
|
441
|
+
*,
|
|
442
|
+
docker_id: str,
|
|
443
|
+
tags: str,
|
|
444
|
+
type: typing.Optional[str] = OMIT,
|
|
445
|
+
organization_id: typing.Optional[str] = OMIT,
|
|
446
|
+
workspace_id: typing.Optional[str] = OMIT,
|
|
447
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
448
|
+
) -> typing.Optional[typing.Any]:
|
|
449
|
+
"""
|
|
450
|
+
Updates the image used in an app variant.
|
|
451
|
+
|
|
452
|
+
Args:
|
|
453
|
+
variant_id (str): The ID of the app variant to update.
|
|
454
|
+
image (Image): The image information to update.
|
|
455
|
+
|
|
456
|
+
Raises:
|
|
457
|
+
HTTPException: If an error occurs while trying to update the app variant.
|
|
458
|
+
|
|
459
|
+
Returns:
|
|
460
|
+
JSONResponse: A JSON response indicating whether the update was successful or not.
|
|
461
|
+
|
|
462
|
+
Parameters
|
|
463
|
+
----------
|
|
464
|
+
variant_id : str
|
|
465
|
+
|
|
466
|
+
docker_id : str
|
|
467
|
+
|
|
468
|
+
tags : str
|
|
469
|
+
|
|
470
|
+
type : typing.Optional[str]
|
|
471
|
+
|
|
472
|
+
organization_id : typing.Optional[str]
|
|
473
|
+
|
|
474
|
+
workspace_id : typing.Optional[str]
|
|
475
|
+
|
|
476
|
+
request_options : typing.Optional[RequestOptions]
|
|
477
|
+
Request-specific configuration.
|
|
478
|
+
|
|
479
|
+
Returns
|
|
480
|
+
-------
|
|
481
|
+
typing.Optional[typing.Any]
|
|
482
|
+
Successful Response
|
|
483
|
+
|
|
484
|
+
Examples
|
|
485
|
+
--------
|
|
486
|
+
from agenta import AgentaApi
|
|
487
|
+
|
|
488
|
+
client = AgentaApi(
|
|
489
|
+
api_key="YOUR_API_KEY",
|
|
490
|
+
base_url="https://yourhost.com/path/to/api",
|
|
491
|
+
)
|
|
492
|
+
client.variants.update_variant_image(
|
|
493
|
+
variant_id="variant_id",
|
|
494
|
+
docker_id="docker_id",
|
|
495
|
+
tags="tags",
|
|
496
|
+
)
|
|
497
|
+
"""
|
|
498
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
499
|
+
f"variants/{jsonable_encoder(variant_id)}/image",
|
|
500
|
+
method="PUT",
|
|
501
|
+
json={
|
|
502
|
+
"type": type,
|
|
503
|
+
"docker_id": docker_id,
|
|
504
|
+
"tags": tags,
|
|
505
|
+
"organization_id": organization_id,
|
|
506
|
+
"workspace_id": workspace_id,
|
|
507
|
+
},
|
|
508
|
+
request_options=request_options,
|
|
509
|
+
omit=OMIT,
|
|
510
|
+
)
|
|
511
|
+
try:
|
|
512
|
+
if 200 <= _response.status_code < 300:
|
|
513
|
+
return typing.cast(
|
|
514
|
+
typing.Optional[typing.Any],
|
|
515
|
+
parse_obj_as(
|
|
516
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
517
|
+
object_=_response.json(),
|
|
518
|
+
),
|
|
519
|
+
)
|
|
520
|
+
if _response.status_code == 422:
|
|
521
|
+
raise UnprocessableEntityError(
|
|
522
|
+
typing.cast(
|
|
523
|
+
HttpValidationError,
|
|
524
|
+
parse_obj_as(
|
|
525
|
+
type_=HttpValidationError, # type: ignore
|
|
526
|
+
object_=_response.json(),
|
|
527
|
+
),
|
|
528
|
+
)
|
|
529
|
+
)
|
|
530
|
+
_response_json = _response.json()
|
|
531
|
+
except JSONDecodeError:
|
|
532
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
533
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
534
|
+
|
|
535
|
+
def retrieve_variant_logs(
|
|
536
|
+
self,
|
|
537
|
+
variant_id: str,
|
|
538
|
+
*,
|
|
539
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
540
|
+
) -> typing.Optional[typing.Any]:
|
|
541
|
+
"""
|
|
542
|
+
Parameters
|
|
543
|
+
----------
|
|
544
|
+
variant_id : str
|
|
545
|
+
|
|
546
|
+
request_options : typing.Optional[RequestOptions]
|
|
547
|
+
Request-specific configuration.
|
|
548
|
+
|
|
549
|
+
Returns
|
|
550
|
+
-------
|
|
551
|
+
typing.Optional[typing.Any]
|
|
552
|
+
Successful Response
|
|
553
|
+
|
|
554
|
+
Examples
|
|
555
|
+
--------
|
|
556
|
+
from agenta import AgentaApi
|
|
557
|
+
|
|
558
|
+
client = AgentaApi(
|
|
559
|
+
api_key="YOUR_API_KEY",
|
|
560
|
+
base_url="https://yourhost.com/path/to/api",
|
|
561
|
+
)
|
|
562
|
+
client.variants.retrieve_variant_logs(
|
|
563
|
+
variant_id="variant_id",
|
|
564
|
+
)
|
|
565
|
+
"""
|
|
566
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
567
|
+
f"variants/{jsonable_encoder(variant_id)}/logs",
|
|
568
|
+
method="GET",
|
|
569
|
+
request_options=request_options,
|
|
570
|
+
)
|
|
571
|
+
try:
|
|
572
|
+
if 200 <= _response.status_code < 300:
|
|
573
|
+
return typing.cast(
|
|
574
|
+
typing.Optional[typing.Any],
|
|
575
|
+
parse_obj_as(
|
|
576
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
577
|
+
object_=_response.json(),
|
|
578
|
+
),
|
|
579
|
+
)
|
|
580
|
+
if _response.status_code == 422:
|
|
581
|
+
raise UnprocessableEntityError(
|
|
582
|
+
typing.cast(
|
|
583
|
+
HttpValidationError,
|
|
584
|
+
parse_obj_as(
|
|
585
|
+
type_=HttpValidationError, # type: ignore
|
|
586
|
+
object_=_response.json(),
|
|
587
|
+
),
|
|
588
|
+
)
|
|
589
|
+
)
|
|
590
|
+
_response_json = _response.json()
|
|
591
|
+
except JSONDecodeError:
|
|
592
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
593
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
594
|
+
|
|
595
|
+
def get_variant_revisions(
|
|
596
|
+
self,
|
|
597
|
+
variant_id: str,
|
|
598
|
+
*,
|
|
599
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
600
|
+
) -> typing.List[AppVariantRevision]:
|
|
601
|
+
"""
|
|
602
|
+
Parameters
|
|
603
|
+
----------
|
|
604
|
+
variant_id : str
|
|
605
|
+
|
|
606
|
+
request_options : typing.Optional[RequestOptions]
|
|
607
|
+
Request-specific configuration.
|
|
608
|
+
|
|
609
|
+
Returns
|
|
610
|
+
-------
|
|
611
|
+
typing.List[AppVariantRevision]
|
|
612
|
+
Successful Response
|
|
613
|
+
|
|
614
|
+
Examples
|
|
615
|
+
--------
|
|
616
|
+
from agenta import AgentaApi
|
|
617
|
+
|
|
618
|
+
client = AgentaApi(
|
|
619
|
+
api_key="YOUR_API_KEY",
|
|
620
|
+
base_url="https://yourhost.com/path/to/api",
|
|
621
|
+
)
|
|
622
|
+
client.variants.get_variant_revisions(
|
|
623
|
+
variant_id="variant_id",
|
|
624
|
+
)
|
|
625
|
+
"""
|
|
626
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
627
|
+
f"variants/{jsonable_encoder(variant_id)}/revisions",
|
|
628
|
+
method="GET",
|
|
629
|
+
request_options=request_options,
|
|
630
|
+
)
|
|
631
|
+
try:
|
|
632
|
+
if 200 <= _response.status_code < 300:
|
|
633
|
+
return typing.cast(
|
|
634
|
+
typing.List[AppVariantRevision],
|
|
635
|
+
parse_obj_as(
|
|
636
|
+
type_=typing.List[AppVariantRevision], # type: ignore
|
|
637
|
+
object_=_response.json(),
|
|
638
|
+
),
|
|
639
|
+
)
|
|
640
|
+
if _response.status_code == 422:
|
|
641
|
+
raise UnprocessableEntityError(
|
|
642
|
+
typing.cast(
|
|
643
|
+
HttpValidationError,
|
|
644
|
+
parse_obj_as(
|
|
645
|
+
type_=HttpValidationError, # type: ignore
|
|
646
|
+
object_=_response.json(),
|
|
647
|
+
),
|
|
648
|
+
)
|
|
649
|
+
)
|
|
650
|
+
_response_json = _response.json()
|
|
651
|
+
except JSONDecodeError:
|
|
652
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
653
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
654
|
+
|
|
655
|
+
def get_variant_revision(
|
|
656
|
+
self,
|
|
657
|
+
variant_id: str,
|
|
658
|
+
revision_number: int,
|
|
659
|
+
*,
|
|
660
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
661
|
+
) -> AppVariantRevision:
|
|
662
|
+
"""
|
|
663
|
+
Parameters
|
|
664
|
+
----------
|
|
665
|
+
variant_id : str
|
|
666
|
+
|
|
667
|
+
revision_number : int
|
|
668
|
+
|
|
669
|
+
request_options : typing.Optional[RequestOptions]
|
|
670
|
+
Request-specific configuration.
|
|
671
|
+
|
|
672
|
+
Returns
|
|
673
|
+
-------
|
|
674
|
+
AppVariantRevision
|
|
675
|
+
Successful Response
|
|
676
|
+
|
|
677
|
+
Examples
|
|
678
|
+
--------
|
|
679
|
+
from agenta import AgentaApi
|
|
680
|
+
|
|
681
|
+
client = AgentaApi(
|
|
682
|
+
api_key="YOUR_API_KEY",
|
|
683
|
+
base_url="https://yourhost.com/path/to/api",
|
|
684
|
+
)
|
|
685
|
+
client.variants.get_variant_revision(
|
|
686
|
+
variant_id="variant_id",
|
|
687
|
+
revision_number=1,
|
|
688
|
+
)
|
|
689
|
+
"""
|
|
690
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
691
|
+
f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_number)}",
|
|
692
|
+
method="GET",
|
|
693
|
+
request_options=request_options,
|
|
694
|
+
)
|
|
695
|
+
try:
|
|
696
|
+
if 200 <= _response.status_code < 300:
|
|
697
|
+
return typing.cast(
|
|
698
|
+
AppVariantRevision,
|
|
699
|
+
parse_obj_as(
|
|
700
|
+
type_=AppVariantRevision, # type: ignore
|
|
701
|
+
object_=_response.json(),
|
|
702
|
+
),
|
|
703
|
+
)
|
|
704
|
+
if _response.status_code == 422:
|
|
705
|
+
raise UnprocessableEntityError(
|
|
706
|
+
typing.cast(
|
|
707
|
+
HttpValidationError,
|
|
708
|
+
parse_obj_as(
|
|
709
|
+
type_=HttpValidationError, # type: ignore
|
|
710
|
+
object_=_response.json(),
|
|
711
|
+
),
|
|
712
|
+
)
|
|
713
|
+
)
|
|
714
|
+
_response_json = _response.json()
|
|
715
|
+
except JSONDecodeError:
|
|
716
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
717
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
718
|
+
|
|
719
|
+
def configs_add(
|
|
720
|
+
self,
|
|
721
|
+
*,
|
|
722
|
+
variant_ref: ReferenceRequestModel,
|
|
723
|
+
application_ref: ReferenceRequestModel,
|
|
724
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
725
|
+
) -> ConfigResponseModel:
|
|
726
|
+
"""
|
|
727
|
+
Parameters
|
|
728
|
+
----------
|
|
729
|
+
variant_ref : ReferenceRequestModel
|
|
730
|
+
|
|
731
|
+
application_ref : ReferenceRequestModel
|
|
732
|
+
|
|
733
|
+
request_options : typing.Optional[RequestOptions]
|
|
734
|
+
Request-specific configuration.
|
|
735
|
+
|
|
736
|
+
Returns
|
|
737
|
+
-------
|
|
738
|
+
ConfigResponseModel
|
|
739
|
+
Successful Response
|
|
740
|
+
|
|
741
|
+
Examples
|
|
742
|
+
--------
|
|
743
|
+
from agenta import AgentaApi, ReferenceRequestModel
|
|
744
|
+
|
|
745
|
+
client = AgentaApi(
|
|
746
|
+
api_key="YOUR_API_KEY",
|
|
747
|
+
base_url="https://yourhost.com/path/to/api",
|
|
748
|
+
)
|
|
749
|
+
client.variants.configs_add(
|
|
750
|
+
variant_ref=ReferenceRequestModel(),
|
|
751
|
+
application_ref=ReferenceRequestModel(),
|
|
752
|
+
)
|
|
753
|
+
"""
|
|
754
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
755
|
+
"variants/configs/add",
|
|
756
|
+
method="POST",
|
|
757
|
+
json={
|
|
758
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
759
|
+
object_=variant_ref,
|
|
760
|
+
annotation=ReferenceRequestModel,
|
|
761
|
+
direction="write",
|
|
762
|
+
),
|
|
763
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
764
|
+
object_=application_ref,
|
|
765
|
+
annotation=ReferenceRequestModel,
|
|
766
|
+
direction="write",
|
|
767
|
+
),
|
|
768
|
+
},
|
|
769
|
+
headers={
|
|
770
|
+
"content-type": "application/json",
|
|
771
|
+
},
|
|
772
|
+
request_options=request_options,
|
|
773
|
+
omit=OMIT,
|
|
774
|
+
)
|
|
775
|
+
try:
|
|
776
|
+
if 200 <= _response.status_code < 300:
|
|
777
|
+
return typing.cast(
|
|
778
|
+
ConfigResponseModel,
|
|
779
|
+
parse_obj_as(
|
|
780
|
+
type_=ConfigResponseModel, # type: ignore
|
|
781
|
+
object_=_response.json(),
|
|
782
|
+
),
|
|
783
|
+
)
|
|
784
|
+
if _response.status_code == 422:
|
|
785
|
+
raise UnprocessableEntityError(
|
|
786
|
+
typing.cast(
|
|
787
|
+
HttpValidationError,
|
|
788
|
+
parse_obj_as(
|
|
789
|
+
type_=HttpValidationError, # type: ignore
|
|
790
|
+
object_=_response.json(),
|
|
791
|
+
),
|
|
792
|
+
)
|
|
793
|
+
)
|
|
794
|
+
_response_json = _response.json()
|
|
795
|
+
except JSONDecodeError:
|
|
796
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
797
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
798
|
+
|
|
799
|
+
def configs_fetch(
|
|
800
|
+
self,
|
|
801
|
+
*,
|
|
802
|
+
variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
803
|
+
environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
804
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
805
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
806
|
+
) -> ConfigResponseModel:
|
|
807
|
+
"""
|
|
808
|
+
Parameters
|
|
809
|
+
----------
|
|
810
|
+
variant_ref : typing.Optional[ReferenceRequestModel]
|
|
811
|
+
|
|
812
|
+
environment_ref : typing.Optional[ReferenceRequestModel]
|
|
813
|
+
|
|
814
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
815
|
+
|
|
816
|
+
request_options : typing.Optional[RequestOptions]
|
|
817
|
+
Request-specific configuration.
|
|
818
|
+
|
|
819
|
+
Returns
|
|
820
|
+
-------
|
|
821
|
+
ConfigResponseModel
|
|
822
|
+
Successful Response
|
|
823
|
+
|
|
824
|
+
Examples
|
|
825
|
+
--------
|
|
826
|
+
from agenta import AgentaApi
|
|
827
|
+
|
|
828
|
+
client = AgentaApi(
|
|
829
|
+
api_key="YOUR_API_KEY",
|
|
830
|
+
base_url="https://yourhost.com/path/to/api",
|
|
831
|
+
)
|
|
832
|
+
client.variants.configs_fetch()
|
|
833
|
+
"""
|
|
834
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
835
|
+
"variants/configs/fetch",
|
|
836
|
+
method="POST",
|
|
837
|
+
json={
|
|
838
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
839
|
+
object_=variant_ref,
|
|
840
|
+
annotation=ReferenceRequestModel,
|
|
841
|
+
direction="write",
|
|
842
|
+
),
|
|
843
|
+
"environment_ref": convert_and_respect_annotation_metadata(
|
|
844
|
+
object_=environment_ref,
|
|
845
|
+
annotation=ReferenceRequestModel,
|
|
846
|
+
direction="write",
|
|
847
|
+
),
|
|
848
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
849
|
+
object_=application_ref,
|
|
850
|
+
annotation=ReferenceRequestModel,
|
|
851
|
+
direction="write",
|
|
852
|
+
),
|
|
853
|
+
},
|
|
854
|
+
headers={
|
|
855
|
+
"content-type": "application/json",
|
|
856
|
+
},
|
|
857
|
+
request_options=request_options,
|
|
858
|
+
omit=OMIT,
|
|
859
|
+
)
|
|
860
|
+
try:
|
|
861
|
+
if 200 <= _response.status_code < 300:
|
|
862
|
+
return typing.cast(
|
|
863
|
+
ConfigResponseModel,
|
|
864
|
+
parse_obj_as(
|
|
865
|
+
type_=ConfigResponseModel, # type: ignore
|
|
866
|
+
object_=_response.json(),
|
|
867
|
+
),
|
|
868
|
+
)
|
|
869
|
+
if _response.status_code == 422:
|
|
870
|
+
raise UnprocessableEntityError(
|
|
871
|
+
typing.cast(
|
|
872
|
+
HttpValidationError,
|
|
873
|
+
parse_obj_as(
|
|
874
|
+
type_=HttpValidationError, # type: ignore
|
|
875
|
+
object_=_response.json(),
|
|
876
|
+
),
|
|
877
|
+
)
|
|
878
|
+
)
|
|
879
|
+
_response_json = _response.json()
|
|
880
|
+
except JSONDecodeError:
|
|
881
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
882
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
883
|
+
|
|
884
|
+
def configs_fork(
|
|
885
|
+
self,
|
|
886
|
+
*,
|
|
887
|
+
variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
888
|
+
environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
889
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
890
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
891
|
+
) -> ConfigResponseModel:
|
|
892
|
+
"""
|
|
893
|
+
Parameters
|
|
894
|
+
----------
|
|
895
|
+
variant_ref : typing.Optional[ReferenceRequestModel]
|
|
896
|
+
|
|
897
|
+
environment_ref : typing.Optional[ReferenceRequestModel]
|
|
898
|
+
|
|
899
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
900
|
+
|
|
901
|
+
request_options : typing.Optional[RequestOptions]
|
|
902
|
+
Request-specific configuration.
|
|
903
|
+
|
|
904
|
+
Returns
|
|
905
|
+
-------
|
|
906
|
+
ConfigResponseModel
|
|
907
|
+
Successful Response
|
|
908
|
+
|
|
909
|
+
Examples
|
|
910
|
+
--------
|
|
911
|
+
from agenta import AgentaApi
|
|
912
|
+
|
|
913
|
+
client = AgentaApi(
|
|
914
|
+
api_key="YOUR_API_KEY",
|
|
915
|
+
base_url="https://yourhost.com/path/to/api",
|
|
916
|
+
)
|
|
917
|
+
client.variants.configs_fork()
|
|
918
|
+
"""
|
|
919
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
920
|
+
"variants/configs/fork",
|
|
921
|
+
method="POST",
|
|
922
|
+
json={
|
|
923
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
924
|
+
object_=variant_ref,
|
|
925
|
+
annotation=ReferenceRequestModel,
|
|
926
|
+
direction="write",
|
|
927
|
+
),
|
|
928
|
+
"environment_ref": convert_and_respect_annotation_metadata(
|
|
929
|
+
object_=environment_ref,
|
|
930
|
+
annotation=ReferenceRequestModel,
|
|
931
|
+
direction="write",
|
|
932
|
+
),
|
|
933
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
934
|
+
object_=application_ref,
|
|
935
|
+
annotation=ReferenceRequestModel,
|
|
936
|
+
direction="write",
|
|
937
|
+
),
|
|
938
|
+
},
|
|
939
|
+
headers={
|
|
940
|
+
"content-type": "application/json",
|
|
941
|
+
},
|
|
942
|
+
request_options=request_options,
|
|
943
|
+
omit=OMIT,
|
|
944
|
+
)
|
|
945
|
+
try:
|
|
946
|
+
if 200 <= _response.status_code < 300:
|
|
947
|
+
return typing.cast(
|
|
948
|
+
ConfigResponseModel,
|
|
949
|
+
parse_obj_as(
|
|
950
|
+
type_=ConfigResponseModel, # type: ignore
|
|
951
|
+
object_=_response.json(),
|
|
952
|
+
),
|
|
953
|
+
)
|
|
954
|
+
if _response.status_code == 422:
|
|
955
|
+
raise UnprocessableEntityError(
|
|
956
|
+
typing.cast(
|
|
957
|
+
HttpValidationError,
|
|
958
|
+
parse_obj_as(
|
|
959
|
+
type_=HttpValidationError, # type: ignore
|
|
960
|
+
object_=_response.json(),
|
|
961
|
+
),
|
|
962
|
+
)
|
|
963
|
+
)
|
|
964
|
+
_response_json = _response.json()
|
|
965
|
+
except JSONDecodeError:
|
|
966
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
967
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
968
|
+
|
|
969
|
+
def configs_commit(
|
|
970
|
+
self,
|
|
971
|
+
*,
|
|
972
|
+
config: ConfigDto,
|
|
973
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
974
|
+
) -> ConfigResponseModel:
|
|
975
|
+
"""
|
|
976
|
+
Parameters
|
|
977
|
+
----------
|
|
978
|
+
config : ConfigDto
|
|
979
|
+
|
|
980
|
+
request_options : typing.Optional[RequestOptions]
|
|
981
|
+
Request-specific configuration.
|
|
982
|
+
|
|
983
|
+
Returns
|
|
984
|
+
-------
|
|
985
|
+
ConfigResponseModel
|
|
986
|
+
Successful Response
|
|
987
|
+
|
|
988
|
+
Examples
|
|
989
|
+
--------
|
|
990
|
+
from agenta import AgentaApi, ConfigDto
|
|
991
|
+
|
|
992
|
+
client = AgentaApi(
|
|
993
|
+
api_key="YOUR_API_KEY",
|
|
994
|
+
base_url="https://yourhost.com/path/to/api",
|
|
995
|
+
)
|
|
996
|
+
client.variants.configs_commit(
|
|
997
|
+
config=ConfigDto(
|
|
998
|
+
params={"key": "value"},
|
|
999
|
+
),
|
|
1000
|
+
)
|
|
1001
|
+
"""
|
|
1002
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1003
|
+
"variants/configs/commit",
|
|
1004
|
+
method="POST",
|
|
1005
|
+
json={
|
|
1006
|
+
"config": convert_and_respect_annotation_metadata(
|
|
1007
|
+
object_=config, annotation=ConfigDto, direction="write"
|
|
1008
|
+
),
|
|
1009
|
+
},
|
|
1010
|
+
headers={
|
|
1011
|
+
"content-type": "application/json",
|
|
1012
|
+
},
|
|
1013
|
+
request_options=request_options,
|
|
1014
|
+
omit=OMIT,
|
|
1015
|
+
)
|
|
1016
|
+
try:
|
|
1017
|
+
if 200 <= _response.status_code < 300:
|
|
1018
|
+
return typing.cast(
|
|
1019
|
+
ConfigResponseModel,
|
|
1020
|
+
parse_obj_as(
|
|
1021
|
+
type_=ConfigResponseModel, # type: ignore
|
|
1022
|
+
object_=_response.json(),
|
|
1023
|
+
),
|
|
1024
|
+
)
|
|
1025
|
+
if _response.status_code == 422:
|
|
1026
|
+
raise UnprocessableEntityError(
|
|
1027
|
+
typing.cast(
|
|
1028
|
+
HttpValidationError,
|
|
1029
|
+
parse_obj_as(
|
|
1030
|
+
type_=HttpValidationError, # type: ignore
|
|
1031
|
+
object_=_response.json(),
|
|
1032
|
+
),
|
|
1033
|
+
)
|
|
1034
|
+
)
|
|
1035
|
+
_response_json = _response.json()
|
|
1036
|
+
except JSONDecodeError:
|
|
1037
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1038
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1039
|
+
|
|
1040
|
+
def configs_deploy(
|
|
1041
|
+
self,
|
|
1042
|
+
*,
|
|
1043
|
+
variant_ref: ReferenceRequestModel,
|
|
1044
|
+
environment_ref: ReferenceRequestModel,
|
|
1045
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
1046
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1047
|
+
) -> ConfigResponseModel:
|
|
1048
|
+
"""
|
|
1049
|
+
Parameters
|
|
1050
|
+
----------
|
|
1051
|
+
variant_ref : ReferenceRequestModel
|
|
1052
|
+
|
|
1053
|
+
environment_ref : ReferenceRequestModel
|
|
1054
|
+
|
|
1055
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
1056
|
+
|
|
1057
|
+
request_options : typing.Optional[RequestOptions]
|
|
1058
|
+
Request-specific configuration.
|
|
1059
|
+
|
|
1060
|
+
Returns
|
|
1061
|
+
-------
|
|
1062
|
+
ConfigResponseModel
|
|
1063
|
+
Successful Response
|
|
1064
|
+
|
|
1065
|
+
Examples
|
|
1066
|
+
--------
|
|
1067
|
+
from agenta import AgentaApi, ReferenceRequestModel
|
|
1068
|
+
|
|
1069
|
+
client = AgentaApi(
|
|
1070
|
+
api_key="YOUR_API_KEY",
|
|
1071
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1072
|
+
)
|
|
1073
|
+
client.variants.configs_deploy(
|
|
1074
|
+
variant_ref=ReferenceRequestModel(),
|
|
1075
|
+
environment_ref=ReferenceRequestModel(),
|
|
1076
|
+
)
|
|
1077
|
+
"""
|
|
1078
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1079
|
+
"variants/configs/deploy",
|
|
1080
|
+
method="POST",
|
|
1081
|
+
json={
|
|
1082
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
1083
|
+
object_=variant_ref,
|
|
1084
|
+
annotation=ReferenceRequestModel,
|
|
1085
|
+
direction="write",
|
|
1086
|
+
),
|
|
1087
|
+
"environment_ref": convert_and_respect_annotation_metadata(
|
|
1088
|
+
object_=environment_ref,
|
|
1089
|
+
annotation=ReferenceRequestModel,
|
|
1090
|
+
direction="write",
|
|
1091
|
+
),
|
|
1092
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
1093
|
+
object_=application_ref,
|
|
1094
|
+
annotation=ReferenceRequestModel,
|
|
1095
|
+
direction="write",
|
|
1096
|
+
),
|
|
1097
|
+
},
|
|
1098
|
+
headers={
|
|
1099
|
+
"content-type": "application/json",
|
|
1100
|
+
},
|
|
1101
|
+
request_options=request_options,
|
|
1102
|
+
omit=OMIT,
|
|
1103
|
+
)
|
|
1104
|
+
try:
|
|
1105
|
+
if 200 <= _response.status_code < 300:
|
|
1106
|
+
return typing.cast(
|
|
1107
|
+
ConfigResponseModel,
|
|
1108
|
+
parse_obj_as(
|
|
1109
|
+
type_=ConfigResponseModel, # type: ignore
|
|
1110
|
+
object_=_response.json(),
|
|
1111
|
+
),
|
|
1112
|
+
)
|
|
1113
|
+
if _response.status_code == 422:
|
|
1114
|
+
raise UnprocessableEntityError(
|
|
1115
|
+
typing.cast(
|
|
1116
|
+
HttpValidationError,
|
|
1117
|
+
parse_obj_as(
|
|
1118
|
+
type_=HttpValidationError, # type: ignore
|
|
1119
|
+
object_=_response.json(),
|
|
1120
|
+
),
|
|
1121
|
+
)
|
|
1122
|
+
)
|
|
1123
|
+
_response_json = _response.json()
|
|
1124
|
+
except JSONDecodeError:
|
|
1125
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1126
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1127
|
+
|
|
1128
|
+
def configs_delete(
|
|
1129
|
+
self,
|
|
1130
|
+
*,
|
|
1131
|
+
variant_ref: ReferenceRequestModel,
|
|
1132
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
1133
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1134
|
+
) -> int:
|
|
1135
|
+
"""
|
|
1136
|
+
Parameters
|
|
1137
|
+
----------
|
|
1138
|
+
variant_ref : ReferenceRequestModel
|
|
1139
|
+
|
|
1140
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
1141
|
+
|
|
1142
|
+
request_options : typing.Optional[RequestOptions]
|
|
1143
|
+
Request-specific configuration.
|
|
1144
|
+
|
|
1145
|
+
Returns
|
|
1146
|
+
-------
|
|
1147
|
+
int
|
|
1148
|
+
Successful Response
|
|
1149
|
+
|
|
1150
|
+
Examples
|
|
1151
|
+
--------
|
|
1152
|
+
from agenta import AgentaApi, ReferenceRequestModel
|
|
1153
|
+
|
|
1154
|
+
client = AgentaApi(
|
|
1155
|
+
api_key="YOUR_API_KEY",
|
|
1156
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1157
|
+
)
|
|
1158
|
+
client.variants.configs_delete(
|
|
1159
|
+
variant_ref=ReferenceRequestModel(),
|
|
1160
|
+
)
|
|
1161
|
+
"""
|
|
1162
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1163
|
+
"variants/configs/delete",
|
|
1164
|
+
method="POST",
|
|
1165
|
+
json={
|
|
1166
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
1167
|
+
object_=variant_ref,
|
|
1168
|
+
annotation=ReferenceRequestModel,
|
|
1169
|
+
direction="write",
|
|
1170
|
+
),
|
|
1171
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
1172
|
+
object_=application_ref,
|
|
1173
|
+
annotation=ReferenceRequestModel,
|
|
1174
|
+
direction="write",
|
|
1175
|
+
),
|
|
1176
|
+
},
|
|
1177
|
+
headers={
|
|
1178
|
+
"content-type": "application/json",
|
|
1179
|
+
},
|
|
1180
|
+
request_options=request_options,
|
|
1181
|
+
omit=OMIT,
|
|
1182
|
+
)
|
|
1183
|
+
try:
|
|
1184
|
+
if 200 <= _response.status_code < 300:
|
|
1185
|
+
return typing.cast(
|
|
1186
|
+
int,
|
|
1187
|
+
parse_obj_as(
|
|
1188
|
+
type_=int, # type: ignore
|
|
1189
|
+
object_=_response.json(),
|
|
1190
|
+
),
|
|
1191
|
+
)
|
|
1192
|
+
if _response.status_code == 422:
|
|
1193
|
+
raise UnprocessableEntityError(
|
|
1194
|
+
typing.cast(
|
|
1195
|
+
HttpValidationError,
|
|
1196
|
+
parse_obj_as(
|
|
1197
|
+
type_=HttpValidationError, # type: ignore
|
|
1198
|
+
object_=_response.json(),
|
|
1199
|
+
),
|
|
1200
|
+
)
|
|
1201
|
+
)
|
|
1202
|
+
_response_json = _response.json()
|
|
1203
|
+
except JSONDecodeError:
|
|
1204
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1205
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1206
|
+
|
|
1207
|
+
def configs_list(
|
|
1208
|
+
self,
|
|
1209
|
+
*,
|
|
1210
|
+
application_ref: ReferenceDto,
|
|
1211
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1212
|
+
) -> typing.List[ConfigResponseModel]:
|
|
1213
|
+
"""
|
|
1214
|
+
Parameters
|
|
1215
|
+
----------
|
|
1216
|
+
application_ref : ReferenceDto
|
|
1217
|
+
|
|
1218
|
+
request_options : typing.Optional[RequestOptions]
|
|
1219
|
+
Request-specific configuration.
|
|
1220
|
+
|
|
1221
|
+
Returns
|
|
1222
|
+
-------
|
|
1223
|
+
typing.List[ConfigResponseModel]
|
|
1224
|
+
Successful Response
|
|
1225
|
+
|
|
1226
|
+
Examples
|
|
1227
|
+
--------
|
|
1228
|
+
from agenta import AgentaApi, ReferenceDto
|
|
1229
|
+
|
|
1230
|
+
client = AgentaApi(
|
|
1231
|
+
api_key="YOUR_API_KEY",
|
|
1232
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1233
|
+
)
|
|
1234
|
+
client.variants.configs_list(
|
|
1235
|
+
application_ref=ReferenceDto(),
|
|
1236
|
+
)
|
|
1237
|
+
"""
|
|
1238
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1239
|
+
"variants/configs/list",
|
|
1240
|
+
method="POST",
|
|
1241
|
+
json={
|
|
1242
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
1243
|
+
object_=application_ref, annotation=ReferenceDto, direction="write"
|
|
1244
|
+
),
|
|
1245
|
+
},
|
|
1246
|
+
headers={
|
|
1247
|
+
"content-type": "application/json",
|
|
1248
|
+
},
|
|
1249
|
+
request_options=request_options,
|
|
1250
|
+
omit=OMIT,
|
|
1251
|
+
)
|
|
1252
|
+
try:
|
|
1253
|
+
if 200 <= _response.status_code < 300:
|
|
1254
|
+
return typing.cast(
|
|
1255
|
+
typing.List[ConfigResponseModel],
|
|
1256
|
+
parse_obj_as(
|
|
1257
|
+
type_=typing.List[ConfigResponseModel], # type: ignore
|
|
1258
|
+
object_=_response.json(),
|
|
1259
|
+
),
|
|
1260
|
+
)
|
|
1261
|
+
if _response.status_code == 422:
|
|
1262
|
+
raise UnprocessableEntityError(
|
|
1263
|
+
typing.cast(
|
|
1264
|
+
HttpValidationError,
|
|
1265
|
+
parse_obj_as(
|
|
1266
|
+
type_=HttpValidationError, # type: ignore
|
|
1267
|
+
object_=_response.json(),
|
|
1268
|
+
),
|
|
1269
|
+
)
|
|
1270
|
+
)
|
|
1271
|
+
_response_json = _response.json()
|
|
1272
|
+
except JSONDecodeError:
|
|
1273
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1274
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1275
|
+
|
|
1276
|
+
def configs_history(
|
|
1277
|
+
self,
|
|
1278
|
+
*,
|
|
1279
|
+
variant_ref: ReferenceRequestModel,
|
|
1280
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
1281
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1282
|
+
) -> typing.List[ConfigResponseModel]:
|
|
1283
|
+
"""
|
|
1284
|
+
Parameters
|
|
1285
|
+
----------
|
|
1286
|
+
variant_ref : ReferenceRequestModel
|
|
1287
|
+
|
|
1288
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
1289
|
+
|
|
1290
|
+
request_options : typing.Optional[RequestOptions]
|
|
1291
|
+
Request-specific configuration.
|
|
1292
|
+
|
|
1293
|
+
Returns
|
|
1294
|
+
-------
|
|
1295
|
+
typing.List[ConfigResponseModel]
|
|
1296
|
+
Successful Response
|
|
1297
|
+
|
|
1298
|
+
Examples
|
|
1299
|
+
--------
|
|
1300
|
+
from agenta import AgentaApi, ReferenceRequestModel
|
|
1301
|
+
|
|
1302
|
+
client = AgentaApi(
|
|
1303
|
+
api_key="YOUR_API_KEY",
|
|
1304
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1305
|
+
)
|
|
1306
|
+
client.variants.configs_history(
|
|
1307
|
+
variant_ref=ReferenceRequestModel(),
|
|
1308
|
+
)
|
|
1309
|
+
"""
|
|
1310
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1311
|
+
"variants/configs/history",
|
|
1312
|
+
method="POST",
|
|
1313
|
+
json={
|
|
1314
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
1315
|
+
object_=variant_ref,
|
|
1316
|
+
annotation=ReferenceRequestModel,
|
|
1317
|
+
direction="write",
|
|
1318
|
+
),
|
|
1319
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
1320
|
+
object_=application_ref,
|
|
1321
|
+
annotation=ReferenceRequestModel,
|
|
1322
|
+
direction="write",
|
|
1323
|
+
),
|
|
1324
|
+
},
|
|
1325
|
+
headers={
|
|
1326
|
+
"content-type": "application/json",
|
|
1327
|
+
},
|
|
1328
|
+
request_options=request_options,
|
|
1329
|
+
omit=OMIT,
|
|
1330
|
+
)
|
|
1331
|
+
try:
|
|
1332
|
+
if 200 <= _response.status_code < 300:
|
|
1333
|
+
return typing.cast(
|
|
1334
|
+
typing.List[ConfigResponseModel],
|
|
1335
|
+
parse_obj_as(
|
|
1336
|
+
type_=typing.List[ConfigResponseModel], # type: ignore
|
|
1337
|
+
object_=_response.json(),
|
|
1338
|
+
),
|
|
1339
|
+
)
|
|
1340
|
+
if _response.status_code == 422:
|
|
1341
|
+
raise UnprocessableEntityError(
|
|
1342
|
+
typing.cast(
|
|
1343
|
+
HttpValidationError,
|
|
1344
|
+
parse_obj_as(
|
|
1345
|
+
type_=HttpValidationError, # type: ignore
|
|
1346
|
+
object_=_response.json(),
|
|
1347
|
+
),
|
|
1348
|
+
)
|
|
1349
|
+
)
|
|
1350
|
+
_response_json = _response.json()
|
|
1351
|
+
except JSONDecodeError:
|
|
1352
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1353
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
class AsyncVariantsClient:
|
|
1357
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1358
|
+
self._client_wrapper = client_wrapper
|
|
1359
|
+
|
|
1360
|
+
async def add_variant_from_base_and_config(
|
|
1361
|
+
self,
|
|
1362
|
+
*,
|
|
1363
|
+
base_id: str,
|
|
1364
|
+
new_variant_name: str,
|
|
1365
|
+
new_config_name: str,
|
|
1366
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]],
|
|
1367
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1368
|
+
) -> AddVariantFromBaseAndConfigResponse:
|
|
1369
|
+
"""
|
|
1370
|
+
Add a new variant based on an existing one.
|
|
1371
|
+
Same as POST /config
|
|
1372
|
+
|
|
1373
|
+
Args:
|
|
1374
|
+
payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
|
|
1375
|
+
stoken_session (SessionContainer, optional): Session container. Defaults to result of verify_session().
|
|
1376
|
+
|
|
1377
|
+
Raises:
|
|
1378
|
+
HTTPException: Raised if the variant could not be added or accessed.
|
|
1379
|
+
|
|
1380
|
+
Returns:
|
|
1381
|
+
Union[AppVariantResponse, Any]: New variant details or exception.
|
|
1382
|
+
|
|
1383
|
+
Parameters
|
|
1384
|
+
----------
|
|
1385
|
+
base_id : str
|
|
1386
|
+
|
|
1387
|
+
new_variant_name : str
|
|
1388
|
+
|
|
1389
|
+
new_config_name : str
|
|
1390
|
+
|
|
1391
|
+
parameters : typing.Dict[str, typing.Optional[typing.Any]]
|
|
1392
|
+
|
|
1393
|
+
request_options : typing.Optional[RequestOptions]
|
|
1394
|
+
Request-specific configuration.
|
|
1395
|
+
|
|
1396
|
+
Returns
|
|
1397
|
+
-------
|
|
1398
|
+
AddVariantFromBaseAndConfigResponse
|
|
1399
|
+
Successful Response
|
|
1400
|
+
|
|
1401
|
+
Examples
|
|
1402
|
+
--------
|
|
1403
|
+
import asyncio
|
|
1404
|
+
|
|
1405
|
+
from agenta import AsyncAgentaApi
|
|
1406
|
+
|
|
1407
|
+
client = AsyncAgentaApi(
|
|
1408
|
+
api_key="YOUR_API_KEY",
|
|
1409
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1410
|
+
)
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
async def main() -> None:
|
|
1414
|
+
await client.variants.add_variant_from_base_and_config(
|
|
1415
|
+
base_id="base_id",
|
|
1416
|
+
new_variant_name="new_variant_name",
|
|
1417
|
+
new_config_name="new_config_name",
|
|
1418
|
+
parameters={"key": "value"},
|
|
1419
|
+
)
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
asyncio.run(main())
|
|
1423
|
+
"""
|
|
1424
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1425
|
+
"variants/from-base",
|
|
1426
|
+
method="POST",
|
|
1427
|
+
json={
|
|
1428
|
+
"base_id": base_id,
|
|
1429
|
+
"new_variant_name": new_variant_name,
|
|
1430
|
+
"new_config_name": new_config_name,
|
|
1431
|
+
"parameters": parameters,
|
|
1432
|
+
},
|
|
1433
|
+
headers={
|
|
1434
|
+
"content-type": "application/json",
|
|
1435
|
+
},
|
|
1436
|
+
request_options=request_options,
|
|
1437
|
+
omit=OMIT,
|
|
1438
|
+
)
|
|
1439
|
+
try:
|
|
1440
|
+
if 200 <= _response.status_code < 300:
|
|
1441
|
+
return typing.cast(
|
|
1442
|
+
AddVariantFromBaseAndConfigResponse,
|
|
1443
|
+
parse_obj_as(
|
|
1444
|
+
type_=AddVariantFromBaseAndConfigResponse, # type: ignore
|
|
1445
|
+
object_=_response.json(),
|
|
1446
|
+
),
|
|
1447
|
+
)
|
|
1448
|
+
if _response.status_code == 422:
|
|
1449
|
+
raise UnprocessableEntityError(
|
|
1450
|
+
typing.cast(
|
|
1451
|
+
HttpValidationError,
|
|
1452
|
+
parse_obj_as(
|
|
1453
|
+
type_=HttpValidationError, # type: ignore
|
|
1454
|
+
object_=_response.json(),
|
|
1455
|
+
),
|
|
1456
|
+
)
|
|
1457
|
+
)
|
|
1458
|
+
_response_json = _response.json()
|
|
1459
|
+
except JSONDecodeError:
|
|
1460
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1461
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1462
|
+
|
|
1463
|
+
async def get_variant(
|
|
1464
|
+
self,
|
|
1465
|
+
variant_id: str,
|
|
1466
|
+
*,
|
|
1467
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1468
|
+
) -> AppVariantResponse:
|
|
1469
|
+
"""
|
|
1470
|
+
Parameters
|
|
1471
|
+
----------
|
|
1472
|
+
variant_id : str
|
|
1473
|
+
|
|
1474
|
+
request_options : typing.Optional[RequestOptions]
|
|
1475
|
+
Request-specific configuration.
|
|
1476
|
+
|
|
1477
|
+
Returns
|
|
1478
|
+
-------
|
|
1479
|
+
AppVariantResponse
|
|
1480
|
+
Successful Response
|
|
1481
|
+
|
|
1482
|
+
Examples
|
|
1483
|
+
--------
|
|
1484
|
+
import asyncio
|
|
1485
|
+
|
|
1486
|
+
from agenta import AsyncAgentaApi
|
|
1487
|
+
|
|
1488
|
+
client = AsyncAgentaApi(
|
|
1489
|
+
api_key="YOUR_API_KEY",
|
|
1490
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1491
|
+
)
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
async def main() -> None:
|
|
1495
|
+
await client.variants.get_variant(
|
|
1496
|
+
variant_id="variant_id",
|
|
1497
|
+
)
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
asyncio.run(main())
|
|
1501
|
+
"""
|
|
1502
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1503
|
+
f"variants/{jsonable_encoder(variant_id)}",
|
|
1504
|
+
method="GET",
|
|
1505
|
+
request_options=request_options,
|
|
1506
|
+
)
|
|
1507
|
+
try:
|
|
1508
|
+
if 200 <= _response.status_code < 300:
|
|
1509
|
+
return typing.cast(
|
|
1510
|
+
AppVariantResponse,
|
|
1511
|
+
parse_obj_as(
|
|
1512
|
+
type_=AppVariantResponse, # type: ignore
|
|
1513
|
+
object_=_response.json(),
|
|
1514
|
+
),
|
|
1515
|
+
)
|
|
1516
|
+
if _response.status_code == 422:
|
|
1517
|
+
raise UnprocessableEntityError(
|
|
1518
|
+
typing.cast(
|
|
1519
|
+
HttpValidationError,
|
|
1520
|
+
parse_obj_as(
|
|
1521
|
+
type_=HttpValidationError, # type: ignore
|
|
1522
|
+
object_=_response.json(),
|
|
1523
|
+
),
|
|
1524
|
+
)
|
|
1525
|
+
)
|
|
1526
|
+
_response_json = _response.json()
|
|
1527
|
+
except JSONDecodeError:
|
|
1528
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1529
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1530
|
+
|
|
1531
|
+
async def start_variant(
|
|
1532
|
+
self,
|
|
1533
|
+
variant_id: str,
|
|
1534
|
+
*,
|
|
1535
|
+
action: VariantAction,
|
|
1536
|
+
env_vars: typing.Optional[DockerEnvVars] = OMIT,
|
|
1537
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1538
|
+
) -> Uri:
|
|
1539
|
+
"""
|
|
1540
|
+
Start a variant of an app.
|
|
1541
|
+
|
|
1542
|
+
Args:
|
|
1543
|
+
variant_id (str): The ID of the variant to start.
|
|
1544
|
+
action (VariantAction): The action to perform on the variant (start).
|
|
1545
|
+
env_vars (Optional[DockerEnvVars], optional): The environment variables to inject to the Docker container. Defaults to None.
|
|
1546
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1547
|
+
|
|
1548
|
+
Returns:
|
|
1549
|
+
URI: The URL of the started variant.
|
|
1550
|
+
|
|
1551
|
+
Raises:
|
|
1552
|
+
HTTPException: If the app container cannot be started.
|
|
1553
|
+
|
|
1554
|
+
Parameters
|
|
1555
|
+
----------
|
|
1556
|
+
variant_id : str
|
|
1557
|
+
|
|
1558
|
+
action : VariantAction
|
|
1559
|
+
|
|
1560
|
+
env_vars : typing.Optional[DockerEnvVars]
|
|
1561
|
+
|
|
1562
|
+
request_options : typing.Optional[RequestOptions]
|
|
1563
|
+
Request-specific configuration.
|
|
1564
|
+
|
|
1565
|
+
Returns
|
|
1566
|
+
-------
|
|
1567
|
+
Uri
|
|
1568
|
+
Successful Response
|
|
1569
|
+
|
|
1570
|
+
Examples
|
|
1571
|
+
--------
|
|
1572
|
+
import asyncio
|
|
1573
|
+
|
|
1574
|
+
from agenta import AsyncAgentaApi, VariantAction
|
|
1575
|
+
|
|
1576
|
+
client = AsyncAgentaApi(
|
|
1577
|
+
api_key="YOUR_API_KEY",
|
|
1578
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1579
|
+
)
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
async def main() -> None:
|
|
1583
|
+
await client.variants.start_variant(
|
|
1584
|
+
variant_id="variant_id",
|
|
1585
|
+
action=VariantAction(
|
|
1586
|
+
action="START",
|
|
1587
|
+
),
|
|
1588
|
+
)
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
asyncio.run(main())
|
|
1592
|
+
"""
|
|
1593
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1594
|
+
f"variants/{jsonable_encoder(variant_id)}",
|
|
1595
|
+
method="PUT",
|
|
1596
|
+
json={
|
|
1597
|
+
"action": convert_and_respect_annotation_metadata(
|
|
1598
|
+
object_=action, annotation=VariantAction, direction="write"
|
|
1599
|
+
),
|
|
1600
|
+
"env_vars": convert_and_respect_annotation_metadata(
|
|
1601
|
+
object_=env_vars, annotation=DockerEnvVars, direction="write"
|
|
1602
|
+
),
|
|
1603
|
+
},
|
|
1604
|
+
headers={
|
|
1605
|
+
"content-type": "application/json",
|
|
1606
|
+
},
|
|
1607
|
+
request_options=request_options,
|
|
1608
|
+
omit=OMIT,
|
|
1609
|
+
)
|
|
1610
|
+
try:
|
|
1611
|
+
if 200 <= _response.status_code < 300:
|
|
1612
|
+
return typing.cast(
|
|
1613
|
+
Uri,
|
|
1614
|
+
parse_obj_as(
|
|
1615
|
+
type_=Uri, # type: ignore
|
|
1616
|
+
object_=_response.json(),
|
|
1617
|
+
),
|
|
1618
|
+
)
|
|
1619
|
+
if _response.status_code == 422:
|
|
1620
|
+
raise UnprocessableEntityError(
|
|
1621
|
+
typing.cast(
|
|
1622
|
+
HttpValidationError,
|
|
1623
|
+
parse_obj_as(
|
|
1624
|
+
type_=HttpValidationError, # type: ignore
|
|
1625
|
+
object_=_response.json(),
|
|
1626
|
+
),
|
|
1627
|
+
)
|
|
1628
|
+
)
|
|
1629
|
+
_response_json = _response.json()
|
|
1630
|
+
except JSONDecodeError:
|
|
1631
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1632
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1633
|
+
|
|
1634
|
+
async def remove_variant(
|
|
1635
|
+
self,
|
|
1636
|
+
variant_id: str,
|
|
1637
|
+
*,
|
|
1638
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1639
|
+
) -> typing.Optional[typing.Any]:
|
|
1640
|
+
"""
|
|
1641
|
+
Remove a variant from the server.
|
|
1642
|
+
In the case it's the last variant using the image, stop the container and remove the image.
|
|
1643
|
+
|
|
1644
|
+
Arguments:
|
|
1645
|
+
app_variant -- AppVariant to remove
|
|
1646
|
+
|
|
1647
|
+
Raises:
|
|
1648
|
+
HTTPException: If there is a problem removing the app variant
|
|
1649
|
+
|
|
1650
|
+
Parameters
|
|
1651
|
+
----------
|
|
1652
|
+
variant_id : str
|
|
1653
|
+
|
|
1654
|
+
request_options : typing.Optional[RequestOptions]
|
|
1655
|
+
Request-specific configuration.
|
|
1656
|
+
|
|
1657
|
+
Returns
|
|
1658
|
+
-------
|
|
1659
|
+
typing.Optional[typing.Any]
|
|
1660
|
+
Successful Response
|
|
1661
|
+
|
|
1662
|
+
Examples
|
|
1663
|
+
--------
|
|
1664
|
+
import asyncio
|
|
1665
|
+
|
|
1666
|
+
from agenta import AsyncAgentaApi
|
|
1667
|
+
|
|
1668
|
+
client = AsyncAgentaApi(
|
|
1669
|
+
api_key="YOUR_API_KEY",
|
|
1670
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1671
|
+
)
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
async def main() -> None:
|
|
1675
|
+
await client.variants.remove_variant(
|
|
1676
|
+
variant_id="variant_id",
|
|
1677
|
+
)
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
asyncio.run(main())
|
|
1681
|
+
"""
|
|
1682
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1683
|
+
f"variants/{jsonable_encoder(variant_id)}",
|
|
1684
|
+
method="DELETE",
|
|
1685
|
+
request_options=request_options,
|
|
1686
|
+
)
|
|
1687
|
+
try:
|
|
1688
|
+
if 200 <= _response.status_code < 300:
|
|
1689
|
+
return typing.cast(
|
|
1690
|
+
typing.Optional[typing.Any],
|
|
1691
|
+
parse_obj_as(
|
|
1692
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1693
|
+
object_=_response.json(),
|
|
1694
|
+
),
|
|
1695
|
+
)
|
|
1696
|
+
if _response.status_code == 422:
|
|
1697
|
+
raise UnprocessableEntityError(
|
|
1698
|
+
typing.cast(
|
|
1699
|
+
HttpValidationError,
|
|
1700
|
+
parse_obj_as(
|
|
1701
|
+
type_=HttpValidationError, # type: ignore
|
|
1702
|
+
object_=_response.json(),
|
|
1703
|
+
),
|
|
1704
|
+
)
|
|
1705
|
+
)
|
|
1706
|
+
_response_json = _response.json()
|
|
1707
|
+
except JSONDecodeError:
|
|
1708
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1709
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1710
|
+
|
|
1711
|
+
async def update_variant_parameters(
|
|
1712
|
+
self,
|
|
1713
|
+
variant_id: str,
|
|
1714
|
+
*,
|
|
1715
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]],
|
|
1716
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1717
|
+
) -> typing.Optional[typing.Any]:
|
|
1718
|
+
"""
|
|
1719
|
+
Updates the parameters for an app variant.
|
|
1720
|
+
|
|
1721
|
+
Args:
|
|
1722
|
+
variant_id (str): The ID of the app variant to update.
|
|
1723
|
+
payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
|
|
1724
|
+
stoken_session (SessionContainer, optional): The session container. Defaults to Depends(verify_session()).
|
|
1725
|
+
|
|
1726
|
+
Raises:
|
|
1727
|
+
HTTPException: If there is an error while trying to update the app variant.
|
|
1728
|
+
|
|
1729
|
+
Returns:
|
|
1730
|
+
JSONResponse: A JSON response containing the updated app variant parameters.
|
|
1731
|
+
|
|
1732
|
+
Parameters
|
|
1733
|
+
----------
|
|
1734
|
+
variant_id : str
|
|
1735
|
+
|
|
1736
|
+
parameters : typing.Dict[str, typing.Optional[typing.Any]]
|
|
1737
|
+
|
|
1738
|
+
request_options : typing.Optional[RequestOptions]
|
|
1739
|
+
Request-specific configuration.
|
|
1740
|
+
|
|
1741
|
+
Returns
|
|
1742
|
+
-------
|
|
1743
|
+
typing.Optional[typing.Any]
|
|
1744
|
+
Successful Response
|
|
1745
|
+
|
|
1746
|
+
Examples
|
|
1747
|
+
--------
|
|
1748
|
+
import asyncio
|
|
1749
|
+
|
|
1750
|
+
from agenta import AsyncAgentaApi
|
|
1751
|
+
|
|
1752
|
+
client = AsyncAgentaApi(
|
|
1753
|
+
api_key="YOUR_API_KEY",
|
|
1754
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1755
|
+
)
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
async def main() -> None:
|
|
1759
|
+
await client.variants.update_variant_parameters(
|
|
1760
|
+
variant_id="variant_id",
|
|
1761
|
+
parameters={"key": "value"},
|
|
1762
|
+
)
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
asyncio.run(main())
|
|
1766
|
+
"""
|
|
1767
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1768
|
+
f"variants/{jsonable_encoder(variant_id)}/parameters",
|
|
1769
|
+
method="PUT",
|
|
1770
|
+
json={
|
|
1771
|
+
"parameters": parameters,
|
|
1772
|
+
},
|
|
1773
|
+
headers={
|
|
1774
|
+
"content-type": "application/json",
|
|
1775
|
+
},
|
|
1776
|
+
request_options=request_options,
|
|
1777
|
+
omit=OMIT,
|
|
1778
|
+
)
|
|
1779
|
+
try:
|
|
1780
|
+
if 200 <= _response.status_code < 300:
|
|
1781
|
+
return typing.cast(
|
|
1782
|
+
typing.Optional[typing.Any],
|
|
1783
|
+
parse_obj_as(
|
|
1784
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1785
|
+
object_=_response.json(),
|
|
1786
|
+
),
|
|
1787
|
+
)
|
|
1788
|
+
if _response.status_code == 422:
|
|
1789
|
+
raise UnprocessableEntityError(
|
|
1790
|
+
typing.cast(
|
|
1791
|
+
HttpValidationError,
|
|
1792
|
+
parse_obj_as(
|
|
1793
|
+
type_=HttpValidationError, # type: ignore
|
|
1794
|
+
object_=_response.json(),
|
|
1795
|
+
),
|
|
1796
|
+
)
|
|
1797
|
+
)
|
|
1798
|
+
_response_json = _response.json()
|
|
1799
|
+
except JSONDecodeError:
|
|
1800
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1801
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1802
|
+
|
|
1803
|
+
async def update_variant_image(
|
|
1804
|
+
self,
|
|
1805
|
+
variant_id: str,
|
|
1806
|
+
*,
|
|
1807
|
+
docker_id: str,
|
|
1808
|
+
tags: str,
|
|
1809
|
+
type: typing.Optional[str] = OMIT,
|
|
1810
|
+
organization_id: typing.Optional[str] = OMIT,
|
|
1811
|
+
workspace_id: typing.Optional[str] = OMIT,
|
|
1812
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1813
|
+
) -> typing.Optional[typing.Any]:
|
|
1814
|
+
"""
|
|
1815
|
+
Updates the image used in an app variant.
|
|
1816
|
+
|
|
1817
|
+
Args:
|
|
1818
|
+
variant_id (str): The ID of the app variant to update.
|
|
1819
|
+
image (Image): The image information to update.
|
|
1820
|
+
|
|
1821
|
+
Raises:
|
|
1822
|
+
HTTPException: If an error occurs while trying to update the app variant.
|
|
1823
|
+
|
|
1824
|
+
Returns:
|
|
1825
|
+
JSONResponse: A JSON response indicating whether the update was successful or not.
|
|
1826
|
+
|
|
1827
|
+
Parameters
|
|
1828
|
+
----------
|
|
1829
|
+
variant_id : str
|
|
1830
|
+
|
|
1831
|
+
docker_id : str
|
|
1832
|
+
|
|
1833
|
+
tags : str
|
|
1834
|
+
|
|
1835
|
+
type : typing.Optional[str]
|
|
1836
|
+
|
|
1837
|
+
organization_id : typing.Optional[str]
|
|
1838
|
+
|
|
1839
|
+
workspace_id : typing.Optional[str]
|
|
1840
|
+
|
|
1841
|
+
request_options : typing.Optional[RequestOptions]
|
|
1842
|
+
Request-specific configuration.
|
|
1843
|
+
|
|
1844
|
+
Returns
|
|
1845
|
+
-------
|
|
1846
|
+
typing.Optional[typing.Any]
|
|
1847
|
+
Successful Response
|
|
1848
|
+
|
|
1849
|
+
Examples
|
|
1850
|
+
--------
|
|
1851
|
+
import asyncio
|
|
1852
|
+
|
|
1853
|
+
from agenta import AsyncAgentaApi
|
|
1854
|
+
|
|
1855
|
+
client = AsyncAgentaApi(
|
|
1856
|
+
api_key="YOUR_API_KEY",
|
|
1857
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1858
|
+
)
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
async def main() -> None:
|
|
1862
|
+
await client.variants.update_variant_image(
|
|
1863
|
+
variant_id="variant_id",
|
|
1864
|
+
docker_id="docker_id",
|
|
1865
|
+
tags="tags",
|
|
1866
|
+
)
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
asyncio.run(main())
|
|
1870
|
+
"""
|
|
1871
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1872
|
+
f"variants/{jsonable_encoder(variant_id)}/image",
|
|
1873
|
+
method="PUT",
|
|
1874
|
+
json={
|
|
1875
|
+
"type": type,
|
|
1876
|
+
"docker_id": docker_id,
|
|
1877
|
+
"tags": tags,
|
|
1878
|
+
"organization_id": organization_id,
|
|
1879
|
+
"workspace_id": workspace_id,
|
|
1880
|
+
},
|
|
1881
|
+
request_options=request_options,
|
|
1882
|
+
omit=OMIT,
|
|
1883
|
+
)
|
|
1884
|
+
try:
|
|
1885
|
+
if 200 <= _response.status_code < 300:
|
|
1886
|
+
return typing.cast(
|
|
1887
|
+
typing.Optional[typing.Any],
|
|
1888
|
+
parse_obj_as(
|
|
1889
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1890
|
+
object_=_response.json(),
|
|
1891
|
+
),
|
|
1892
|
+
)
|
|
1893
|
+
if _response.status_code == 422:
|
|
1894
|
+
raise UnprocessableEntityError(
|
|
1895
|
+
typing.cast(
|
|
1896
|
+
HttpValidationError,
|
|
1897
|
+
parse_obj_as(
|
|
1898
|
+
type_=HttpValidationError, # type: ignore
|
|
1899
|
+
object_=_response.json(),
|
|
1900
|
+
),
|
|
1901
|
+
)
|
|
1902
|
+
)
|
|
1903
|
+
_response_json = _response.json()
|
|
1904
|
+
except JSONDecodeError:
|
|
1905
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1906
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1907
|
+
|
|
1908
|
+
async def retrieve_variant_logs(
|
|
1909
|
+
self,
|
|
1910
|
+
variant_id: str,
|
|
1911
|
+
*,
|
|
1912
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1913
|
+
) -> typing.Optional[typing.Any]:
|
|
1914
|
+
"""
|
|
1915
|
+
Parameters
|
|
1916
|
+
----------
|
|
1917
|
+
variant_id : str
|
|
1918
|
+
|
|
1919
|
+
request_options : typing.Optional[RequestOptions]
|
|
1920
|
+
Request-specific configuration.
|
|
1921
|
+
|
|
1922
|
+
Returns
|
|
1923
|
+
-------
|
|
1924
|
+
typing.Optional[typing.Any]
|
|
1925
|
+
Successful Response
|
|
1926
|
+
|
|
1927
|
+
Examples
|
|
1928
|
+
--------
|
|
1929
|
+
import asyncio
|
|
1930
|
+
|
|
1931
|
+
from agenta import AsyncAgentaApi
|
|
1932
|
+
|
|
1933
|
+
client = AsyncAgentaApi(
|
|
1934
|
+
api_key="YOUR_API_KEY",
|
|
1935
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1936
|
+
)
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
async def main() -> None:
|
|
1940
|
+
await client.variants.retrieve_variant_logs(
|
|
1941
|
+
variant_id="variant_id",
|
|
1942
|
+
)
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
asyncio.run(main())
|
|
1946
|
+
"""
|
|
1947
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1948
|
+
f"variants/{jsonable_encoder(variant_id)}/logs",
|
|
1949
|
+
method="GET",
|
|
1950
|
+
request_options=request_options,
|
|
1951
|
+
)
|
|
1952
|
+
try:
|
|
1953
|
+
if 200 <= _response.status_code < 300:
|
|
1954
|
+
return typing.cast(
|
|
1955
|
+
typing.Optional[typing.Any],
|
|
1956
|
+
parse_obj_as(
|
|
1957
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1958
|
+
object_=_response.json(),
|
|
1959
|
+
),
|
|
1960
|
+
)
|
|
1961
|
+
if _response.status_code == 422:
|
|
1962
|
+
raise UnprocessableEntityError(
|
|
1963
|
+
typing.cast(
|
|
1964
|
+
HttpValidationError,
|
|
1965
|
+
parse_obj_as(
|
|
1966
|
+
type_=HttpValidationError, # type: ignore
|
|
1967
|
+
object_=_response.json(),
|
|
1968
|
+
),
|
|
1969
|
+
)
|
|
1970
|
+
)
|
|
1971
|
+
_response_json = _response.json()
|
|
1972
|
+
except JSONDecodeError:
|
|
1973
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1974
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1975
|
+
|
|
1976
|
+
async def get_variant_revisions(
|
|
1977
|
+
self,
|
|
1978
|
+
variant_id: str,
|
|
1979
|
+
*,
|
|
1980
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1981
|
+
) -> typing.List[AppVariantRevision]:
|
|
1982
|
+
"""
|
|
1983
|
+
Parameters
|
|
1984
|
+
----------
|
|
1985
|
+
variant_id : str
|
|
1986
|
+
|
|
1987
|
+
request_options : typing.Optional[RequestOptions]
|
|
1988
|
+
Request-specific configuration.
|
|
1989
|
+
|
|
1990
|
+
Returns
|
|
1991
|
+
-------
|
|
1992
|
+
typing.List[AppVariantRevision]
|
|
1993
|
+
Successful Response
|
|
1994
|
+
|
|
1995
|
+
Examples
|
|
1996
|
+
--------
|
|
1997
|
+
import asyncio
|
|
1998
|
+
|
|
1999
|
+
from agenta import AsyncAgentaApi
|
|
2000
|
+
|
|
2001
|
+
client = AsyncAgentaApi(
|
|
2002
|
+
api_key="YOUR_API_KEY",
|
|
2003
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2004
|
+
)
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
async def main() -> None:
|
|
2008
|
+
await client.variants.get_variant_revisions(
|
|
2009
|
+
variant_id="variant_id",
|
|
2010
|
+
)
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
asyncio.run(main())
|
|
2014
|
+
"""
|
|
2015
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2016
|
+
f"variants/{jsonable_encoder(variant_id)}/revisions",
|
|
2017
|
+
method="GET",
|
|
2018
|
+
request_options=request_options,
|
|
2019
|
+
)
|
|
2020
|
+
try:
|
|
2021
|
+
if 200 <= _response.status_code < 300:
|
|
2022
|
+
return typing.cast(
|
|
2023
|
+
typing.List[AppVariantRevision],
|
|
2024
|
+
parse_obj_as(
|
|
2025
|
+
type_=typing.List[AppVariantRevision], # type: ignore
|
|
2026
|
+
object_=_response.json(),
|
|
2027
|
+
),
|
|
2028
|
+
)
|
|
2029
|
+
if _response.status_code == 422:
|
|
2030
|
+
raise UnprocessableEntityError(
|
|
2031
|
+
typing.cast(
|
|
2032
|
+
HttpValidationError,
|
|
2033
|
+
parse_obj_as(
|
|
2034
|
+
type_=HttpValidationError, # type: ignore
|
|
2035
|
+
object_=_response.json(),
|
|
2036
|
+
),
|
|
2037
|
+
)
|
|
2038
|
+
)
|
|
2039
|
+
_response_json = _response.json()
|
|
2040
|
+
except JSONDecodeError:
|
|
2041
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2042
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2043
|
+
|
|
2044
|
+
async def get_variant_revision(
|
|
2045
|
+
self,
|
|
2046
|
+
variant_id: str,
|
|
2047
|
+
revision_number: int,
|
|
2048
|
+
*,
|
|
2049
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2050
|
+
) -> AppVariantRevision:
|
|
2051
|
+
"""
|
|
2052
|
+
Parameters
|
|
2053
|
+
----------
|
|
2054
|
+
variant_id : str
|
|
2055
|
+
|
|
2056
|
+
revision_number : int
|
|
2057
|
+
|
|
2058
|
+
request_options : typing.Optional[RequestOptions]
|
|
2059
|
+
Request-specific configuration.
|
|
2060
|
+
|
|
2061
|
+
Returns
|
|
2062
|
+
-------
|
|
2063
|
+
AppVariantRevision
|
|
2064
|
+
Successful Response
|
|
2065
|
+
|
|
2066
|
+
Examples
|
|
2067
|
+
--------
|
|
2068
|
+
import asyncio
|
|
2069
|
+
|
|
2070
|
+
from agenta import AsyncAgentaApi
|
|
2071
|
+
|
|
2072
|
+
client = AsyncAgentaApi(
|
|
2073
|
+
api_key="YOUR_API_KEY",
|
|
2074
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2075
|
+
)
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
async def main() -> None:
|
|
2079
|
+
await client.variants.get_variant_revision(
|
|
2080
|
+
variant_id="variant_id",
|
|
2081
|
+
revision_number=1,
|
|
2082
|
+
)
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
asyncio.run(main())
|
|
2086
|
+
"""
|
|
2087
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2088
|
+
f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_number)}",
|
|
2089
|
+
method="GET",
|
|
2090
|
+
request_options=request_options,
|
|
2091
|
+
)
|
|
2092
|
+
try:
|
|
2093
|
+
if 200 <= _response.status_code < 300:
|
|
2094
|
+
return typing.cast(
|
|
2095
|
+
AppVariantRevision,
|
|
2096
|
+
parse_obj_as(
|
|
2097
|
+
type_=AppVariantRevision, # type: ignore
|
|
2098
|
+
object_=_response.json(),
|
|
2099
|
+
),
|
|
2100
|
+
)
|
|
2101
|
+
if _response.status_code == 422:
|
|
2102
|
+
raise UnprocessableEntityError(
|
|
2103
|
+
typing.cast(
|
|
2104
|
+
HttpValidationError,
|
|
2105
|
+
parse_obj_as(
|
|
2106
|
+
type_=HttpValidationError, # type: ignore
|
|
2107
|
+
object_=_response.json(),
|
|
2108
|
+
),
|
|
2109
|
+
)
|
|
2110
|
+
)
|
|
2111
|
+
_response_json = _response.json()
|
|
2112
|
+
except JSONDecodeError:
|
|
2113
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2114
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2115
|
+
|
|
2116
|
+
async def configs_add(
|
|
2117
|
+
self,
|
|
2118
|
+
*,
|
|
2119
|
+
variant_ref: ReferenceRequestModel,
|
|
2120
|
+
application_ref: ReferenceRequestModel,
|
|
2121
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2122
|
+
) -> ConfigResponseModel:
|
|
2123
|
+
"""
|
|
2124
|
+
Parameters
|
|
2125
|
+
----------
|
|
2126
|
+
variant_ref : ReferenceRequestModel
|
|
2127
|
+
|
|
2128
|
+
application_ref : ReferenceRequestModel
|
|
2129
|
+
|
|
2130
|
+
request_options : typing.Optional[RequestOptions]
|
|
2131
|
+
Request-specific configuration.
|
|
2132
|
+
|
|
2133
|
+
Returns
|
|
2134
|
+
-------
|
|
2135
|
+
ConfigResponseModel
|
|
2136
|
+
Successful Response
|
|
2137
|
+
|
|
2138
|
+
Examples
|
|
2139
|
+
--------
|
|
2140
|
+
import asyncio
|
|
2141
|
+
|
|
2142
|
+
from agenta import AsyncAgentaApi, ReferenceRequestModel
|
|
2143
|
+
|
|
2144
|
+
client = AsyncAgentaApi(
|
|
2145
|
+
api_key="YOUR_API_KEY",
|
|
2146
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2147
|
+
)
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
async def main() -> None:
|
|
2151
|
+
await client.variants.configs_add(
|
|
2152
|
+
variant_ref=ReferenceRequestModel(),
|
|
2153
|
+
application_ref=ReferenceRequestModel(),
|
|
2154
|
+
)
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
asyncio.run(main())
|
|
2158
|
+
"""
|
|
2159
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2160
|
+
"variants/configs/add",
|
|
2161
|
+
method="POST",
|
|
2162
|
+
json={
|
|
2163
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
2164
|
+
object_=variant_ref,
|
|
2165
|
+
annotation=ReferenceRequestModel,
|
|
2166
|
+
direction="write",
|
|
2167
|
+
),
|
|
2168
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2169
|
+
object_=application_ref,
|
|
2170
|
+
annotation=ReferenceRequestModel,
|
|
2171
|
+
direction="write",
|
|
2172
|
+
),
|
|
2173
|
+
},
|
|
2174
|
+
headers={
|
|
2175
|
+
"content-type": "application/json",
|
|
2176
|
+
},
|
|
2177
|
+
request_options=request_options,
|
|
2178
|
+
omit=OMIT,
|
|
2179
|
+
)
|
|
2180
|
+
try:
|
|
2181
|
+
if 200 <= _response.status_code < 300:
|
|
2182
|
+
return typing.cast(
|
|
2183
|
+
ConfigResponseModel,
|
|
2184
|
+
parse_obj_as(
|
|
2185
|
+
type_=ConfigResponseModel, # type: ignore
|
|
2186
|
+
object_=_response.json(),
|
|
2187
|
+
),
|
|
2188
|
+
)
|
|
2189
|
+
if _response.status_code == 422:
|
|
2190
|
+
raise UnprocessableEntityError(
|
|
2191
|
+
typing.cast(
|
|
2192
|
+
HttpValidationError,
|
|
2193
|
+
parse_obj_as(
|
|
2194
|
+
type_=HttpValidationError, # type: ignore
|
|
2195
|
+
object_=_response.json(),
|
|
2196
|
+
),
|
|
2197
|
+
)
|
|
2198
|
+
)
|
|
2199
|
+
_response_json = _response.json()
|
|
2200
|
+
except JSONDecodeError:
|
|
2201
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2202
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2203
|
+
|
|
2204
|
+
async def configs_fetch(
|
|
2205
|
+
self,
|
|
2206
|
+
*,
|
|
2207
|
+
variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2208
|
+
environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2209
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2210
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2211
|
+
) -> ConfigResponseModel:
|
|
2212
|
+
"""
|
|
2213
|
+
Parameters
|
|
2214
|
+
----------
|
|
2215
|
+
variant_ref : typing.Optional[ReferenceRequestModel]
|
|
2216
|
+
|
|
2217
|
+
environment_ref : typing.Optional[ReferenceRequestModel]
|
|
2218
|
+
|
|
2219
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
2220
|
+
|
|
2221
|
+
request_options : typing.Optional[RequestOptions]
|
|
2222
|
+
Request-specific configuration.
|
|
2223
|
+
|
|
2224
|
+
Returns
|
|
2225
|
+
-------
|
|
2226
|
+
ConfigResponseModel
|
|
2227
|
+
Successful Response
|
|
2228
|
+
|
|
2229
|
+
Examples
|
|
2230
|
+
--------
|
|
2231
|
+
import asyncio
|
|
2232
|
+
|
|
2233
|
+
from agenta import AsyncAgentaApi
|
|
2234
|
+
|
|
2235
|
+
client = AsyncAgentaApi(
|
|
2236
|
+
api_key="YOUR_API_KEY",
|
|
2237
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2238
|
+
)
|
|
2239
|
+
|
|
2240
|
+
|
|
2241
|
+
async def main() -> None:
|
|
2242
|
+
await client.variants.configs_fetch()
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
asyncio.run(main())
|
|
2246
|
+
"""
|
|
2247
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2248
|
+
"variants/configs/fetch",
|
|
2249
|
+
method="POST",
|
|
2250
|
+
json={
|
|
2251
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
2252
|
+
object_=variant_ref,
|
|
2253
|
+
annotation=ReferenceRequestModel,
|
|
2254
|
+
direction="write",
|
|
2255
|
+
),
|
|
2256
|
+
"environment_ref": convert_and_respect_annotation_metadata(
|
|
2257
|
+
object_=environment_ref,
|
|
2258
|
+
annotation=ReferenceRequestModel,
|
|
2259
|
+
direction="write",
|
|
2260
|
+
),
|
|
2261
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2262
|
+
object_=application_ref,
|
|
2263
|
+
annotation=ReferenceRequestModel,
|
|
2264
|
+
direction="write",
|
|
2265
|
+
),
|
|
2266
|
+
},
|
|
2267
|
+
headers={
|
|
2268
|
+
"content-type": "application/json",
|
|
2269
|
+
},
|
|
2270
|
+
request_options=request_options,
|
|
2271
|
+
omit=OMIT,
|
|
2272
|
+
)
|
|
2273
|
+
try:
|
|
2274
|
+
if 200 <= _response.status_code < 300:
|
|
2275
|
+
return typing.cast(
|
|
2276
|
+
ConfigResponseModel,
|
|
2277
|
+
parse_obj_as(
|
|
2278
|
+
type_=ConfigResponseModel, # type: ignore
|
|
2279
|
+
object_=_response.json(),
|
|
2280
|
+
),
|
|
2281
|
+
)
|
|
2282
|
+
if _response.status_code == 422:
|
|
2283
|
+
raise UnprocessableEntityError(
|
|
2284
|
+
typing.cast(
|
|
2285
|
+
HttpValidationError,
|
|
2286
|
+
parse_obj_as(
|
|
2287
|
+
type_=HttpValidationError, # type: ignore
|
|
2288
|
+
object_=_response.json(),
|
|
2289
|
+
),
|
|
2290
|
+
)
|
|
2291
|
+
)
|
|
2292
|
+
_response_json = _response.json()
|
|
2293
|
+
except JSONDecodeError:
|
|
2294
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2295
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2296
|
+
|
|
2297
|
+
async def configs_fork(
|
|
2298
|
+
self,
|
|
2299
|
+
*,
|
|
2300
|
+
variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2301
|
+
environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2302
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2303
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2304
|
+
) -> ConfigResponseModel:
|
|
2305
|
+
"""
|
|
2306
|
+
Parameters
|
|
2307
|
+
----------
|
|
2308
|
+
variant_ref : typing.Optional[ReferenceRequestModel]
|
|
2309
|
+
|
|
2310
|
+
environment_ref : typing.Optional[ReferenceRequestModel]
|
|
2311
|
+
|
|
2312
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
2313
|
+
|
|
2314
|
+
request_options : typing.Optional[RequestOptions]
|
|
2315
|
+
Request-specific configuration.
|
|
2316
|
+
|
|
2317
|
+
Returns
|
|
2318
|
+
-------
|
|
2319
|
+
ConfigResponseModel
|
|
2320
|
+
Successful Response
|
|
2321
|
+
|
|
2322
|
+
Examples
|
|
2323
|
+
--------
|
|
2324
|
+
import asyncio
|
|
2325
|
+
|
|
2326
|
+
from agenta import AsyncAgentaApi
|
|
2327
|
+
|
|
2328
|
+
client = AsyncAgentaApi(
|
|
2329
|
+
api_key="YOUR_API_KEY",
|
|
2330
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2331
|
+
)
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
async def main() -> None:
|
|
2335
|
+
await client.variants.configs_fork()
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
asyncio.run(main())
|
|
2339
|
+
"""
|
|
2340
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2341
|
+
"variants/configs/fork",
|
|
2342
|
+
method="POST",
|
|
2343
|
+
json={
|
|
2344
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
2345
|
+
object_=variant_ref,
|
|
2346
|
+
annotation=ReferenceRequestModel,
|
|
2347
|
+
direction="write",
|
|
2348
|
+
),
|
|
2349
|
+
"environment_ref": convert_and_respect_annotation_metadata(
|
|
2350
|
+
object_=environment_ref,
|
|
2351
|
+
annotation=ReferenceRequestModel,
|
|
2352
|
+
direction="write",
|
|
2353
|
+
),
|
|
2354
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2355
|
+
object_=application_ref,
|
|
2356
|
+
annotation=ReferenceRequestModel,
|
|
2357
|
+
direction="write",
|
|
2358
|
+
),
|
|
2359
|
+
},
|
|
2360
|
+
headers={
|
|
2361
|
+
"content-type": "application/json",
|
|
2362
|
+
},
|
|
2363
|
+
request_options=request_options,
|
|
2364
|
+
omit=OMIT,
|
|
2365
|
+
)
|
|
2366
|
+
try:
|
|
2367
|
+
if 200 <= _response.status_code < 300:
|
|
2368
|
+
return typing.cast(
|
|
2369
|
+
ConfigResponseModel,
|
|
2370
|
+
parse_obj_as(
|
|
2371
|
+
type_=ConfigResponseModel, # type: ignore
|
|
2372
|
+
object_=_response.json(),
|
|
2373
|
+
),
|
|
2374
|
+
)
|
|
2375
|
+
if _response.status_code == 422:
|
|
2376
|
+
raise UnprocessableEntityError(
|
|
2377
|
+
typing.cast(
|
|
2378
|
+
HttpValidationError,
|
|
2379
|
+
parse_obj_as(
|
|
2380
|
+
type_=HttpValidationError, # type: ignore
|
|
2381
|
+
object_=_response.json(),
|
|
2382
|
+
),
|
|
2383
|
+
)
|
|
2384
|
+
)
|
|
2385
|
+
_response_json = _response.json()
|
|
2386
|
+
except JSONDecodeError:
|
|
2387
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2388
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2389
|
+
|
|
2390
|
+
async def configs_commit(
|
|
2391
|
+
self,
|
|
2392
|
+
*,
|
|
2393
|
+
config: ConfigDto,
|
|
2394
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2395
|
+
) -> ConfigResponseModel:
|
|
2396
|
+
"""
|
|
2397
|
+
Parameters
|
|
2398
|
+
----------
|
|
2399
|
+
config : ConfigDto
|
|
2400
|
+
|
|
2401
|
+
request_options : typing.Optional[RequestOptions]
|
|
2402
|
+
Request-specific configuration.
|
|
2403
|
+
|
|
2404
|
+
Returns
|
|
2405
|
+
-------
|
|
2406
|
+
ConfigResponseModel
|
|
2407
|
+
Successful Response
|
|
2408
|
+
|
|
2409
|
+
Examples
|
|
2410
|
+
--------
|
|
2411
|
+
import asyncio
|
|
2412
|
+
|
|
2413
|
+
from agenta import AsyncAgentaApi, ConfigDto
|
|
2414
|
+
|
|
2415
|
+
client = AsyncAgentaApi(
|
|
2416
|
+
api_key="YOUR_API_KEY",
|
|
2417
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2418
|
+
)
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
async def main() -> None:
|
|
2422
|
+
await client.variants.configs_commit(
|
|
2423
|
+
config=ConfigDto(
|
|
2424
|
+
params={"key": "value"},
|
|
2425
|
+
),
|
|
2426
|
+
)
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
asyncio.run(main())
|
|
2430
|
+
"""
|
|
2431
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2432
|
+
"variants/configs/commit",
|
|
2433
|
+
method="POST",
|
|
2434
|
+
json={
|
|
2435
|
+
"config": convert_and_respect_annotation_metadata(
|
|
2436
|
+
object_=config, annotation=ConfigDto, direction="write"
|
|
2437
|
+
),
|
|
2438
|
+
},
|
|
2439
|
+
headers={
|
|
2440
|
+
"content-type": "application/json",
|
|
2441
|
+
},
|
|
2442
|
+
request_options=request_options,
|
|
2443
|
+
omit=OMIT,
|
|
2444
|
+
)
|
|
2445
|
+
try:
|
|
2446
|
+
if 200 <= _response.status_code < 300:
|
|
2447
|
+
return typing.cast(
|
|
2448
|
+
ConfigResponseModel,
|
|
2449
|
+
parse_obj_as(
|
|
2450
|
+
type_=ConfigResponseModel, # type: ignore
|
|
2451
|
+
object_=_response.json(),
|
|
2452
|
+
),
|
|
2453
|
+
)
|
|
2454
|
+
if _response.status_code == 422:
|
|
2455
|
+
raise UnprocessableEntityError(
|
|
2456
|
+
typing.cast(
|
|
2457
|
+
HttpValidationError,
|
|
2458
|
+
parse_obj_as(
|
|
2459
|
+
type_=HttpValidationError, # type: ignore
|
|
2460
|
+
object_=_response.json(),
|
|
2461
|
+
),
|
|
2462
|
+
)
|
|
2463
|
+
)
|
|
2464
|
+
_response_json = _response.json()
|
|
2465
|
+
except JSONDecodeError:
|
|
2466
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2467
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2468
|
+
|
|
2469
|
+
async def configs_deploy(
|
|
2470
|
+
self,
|
|
2471
|
+
*,
|
|
2472
|
+
variant_ref: ReferenceRequestModel,
|
|
2473
|
+
environment_ref: ReferenceRequestModel,
|
|
2474
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2475
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2476
|
+
) -> ConfigResponseModel:
|
|
2477
|
+
"""
|
|
2478
|
+
Parameters
|
|
2479
|
+
----------
|
|
2480
|
+
variant_ref : ReferenceRequestModel
|
|
2481
|
+
|
|
2482
|
+
environment_ref : ReferenceRequestModel
|
|
2483
|
+
|
|
2484
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
2485
|
+
|
|
2486
|
+
request_options : typing.Optional[RequestOptions]
|
|
2487
|
+
Request-specific configuration.
|
|
2488
|
+
|
|
2489
|
+
Returns
|
|
2490
|
+
-------
|
|
2491
|
+
ConfigResponseModel
|
|
2492
|
+
Successful Response
|
|
2493
|
+
|
|
2494
|
+
Examples
|
|
2495
|
+
--------
|
|
2496
|
+
import asyncio
|
|
2497
|
+
|
|
2498
|
+
from agenta import AsyncAgentaApi, ReferenceRequestModel
|
|
2499
|
+
|
|
2500
|
+
client = AsyncAgentaApi(
|
|
2501
|
+
api_key="YOUR_API_KEY",
|
|
2502
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2503
|
+
)
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
async def main() -> None:
|
|
2507
|
+
await client.variants.configs_deploy(
|
|
2508
|
+
variant_ref=ReferenceRequestModel(),
|
|
2509
|
+
environment_ref=ReferenceRequestModel(),
|
|
2510
|
+
)
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
asyncio.run(main())
|
|
2514
|
+
"""
|
|
2515
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2516
|
+
"variants/configs/deploy",
|
|
2517
|
+
method="POST",
|
|
2518
|
+
json={
|
|
2519
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
2520
|
+
object_=variant_ref,
|
|
2521
|
+
annotation=ReferenceRequestModel,
|
|
2522
|
+
direction="write",
|
|
2523
|
+
),
|
|
2524
|
+
"environment_ref": convert_and_respect_annotation_metadata(
|
|
2525
|
+
object_=environment_ref,
|
|
2526
|
+
annotation=ReferenceRequestModel,
|
|
2527
|
+
direction="write",
|
|
2528
|
+
),
|
|
2529
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2530
|
+
object_=application_ref,
|
|
2531
|
+
annotation=ReferenceRequestModel,
|
|
2532
|
+
direction="write",
|
|
2533
|
+
),
|
|
2534
|
+
},
|
|
2535
|
+
headers={
|
|
2536
|
+
"content-type": "application/json",
|
|
2537
|
+
},
|
|
2538
|
+
request_options=request_options,
|
|
2539
|
+
omit=OMIT,
|
|
2540
|
+
)
|
|
2541
|
+
try:
|
|
2542
|
+
if 200 <= _response.status_code < 300:
|
|
2543
|
+
return typing.cast(
|
|
2544
|
+
ConfigResponseModel,
|
|
2545
|
+
parse_obj_as(
|
|
2546
|
+
type_=ConfigResponseModel, # type: ignore
|
|
2547
|
+
object_=_response.json(),
|
|
2548
|
+
),
|
|
2549
|
+
)
|
|
2550
|
+
if _response.status_code == 422:
|
|
2551
|
+
raise UnprocessableEntityError(
|
|
2552
|
+
typing.cast(
|
|
2553
|
+
HttpValidationError,
|
|
2554
|
+
parse_obj_as(
|
|
2555
|
+
type_=HttpValidationError, # type: ignore
|
|
2556
|
+
object_=_response.json(),
|
|
2557
|
+
),
|
|
2558
|
+
)
|
|
2559
|
+
)
|
|
2560
|
+
_response_json = _response.json()
|
|
2561
|
+
except JSONDecodeError:
|
|
2562
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2563
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2564
|
+
|
|
2565
|
+
async def configs_delete(
|
|
2566
|
+
self,
|
|
2567
|
+
*,
|
|
2568
|
+
variant_ref: ReferenceRequestModel,
|
|
2569
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2570
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2571
|
+
) -> int:
|
|
2572
|
+
"""
|
|
2573
|
+
Parameters
|
|
2574
|
+
----------
|
|
2575
|
+
variant_ref : ReferenceRequestModel
|
|
2576
|
+
|
|
2577
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
2578
|
+
|
|
2579
|
+
request_options : typing.Optional[RequestOptions]
|
|
2580
|
+
Request-specific configuration.
|
|
2581
|
+
|
|
2582
|
+
Returns
|
|
2583
|
+
-------
|
|
2584
|
+
int
|
|
2585
|
+
Successful Response
|
|
2586
|
+
|
|
2587
|
+
Examples
|
|
2588
|
+
--------
|
|
2589
|
+
import asyncio
|
|
2590
|
+
|
|
2591
|
+
from agenta import AsyncAgentaApi, ReferenceRequestModel
|
|
2592
|
+
|
|
2593
|
+
client = AsyncAgentaApi(
|
|
2594
|
+
api_key="YOUR_API_KEY",
|
|
2595
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2596
|
+
)
|
|
2597
|
+
|
|
2598
|
+
|
|
2599
|
+
async def main() -> None:
|
|
2600
|
+
await client.variants.configs_delete(
|
|
2601
|
+
variant_ref=ReferenceRequestModel(),
|
|
2602
|
+
)
|
|
2603
|
+
|
|
2604
|
+
|
|
2605
|
+
asyncio.run(main())
|
|
2606
|
+
"""
|
|
2607
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2608
|
+
"variants/configs/delete",
|
|
2609
|
+
method="POST",
|
|
2610
|
+
json={
|
|
2611
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
2612
|
+
object_=variant_ref,
|
|
2613
|
+
annotation=ReferenceRequestModel,
|
|
2614
|
+
direction="write",
|
|
2615
|
+
),
|
|
2616
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2617
|
+
object_=application_ref,
|
|
2618
|
+
annotation=ReferenceRequestModel,
|
|
2619
|
+
direction="write",
|
|
2620
|
+
),
|
|
2621
|
+
},
|
|
2622
|
+
headers={
|
|
2623
|
+
"content-type": "application/json",
|
|
2624
|
+
},
|
|
2625
|
+
request_options=request_options,
|
|
2626
|
+
omit=OMIT,
|
|
2627
|
+
)
|
|
2628
|
+
try:
|
|
2629
|
+
if 200 <= _response.status_code < 300:
|
|
2630
|
+
return typing.cast(
|
|
2631
|
+
int,
|
|
2632
|
+
parse_obj_as(
|
|
2633
|
+
type_=int, # type: ignore
|
|
2634
|
+
object_=_response.json(),
|
|
2635
|
+
),
|
|
2636
|
+
)
|
|
2637
|
+
if _response.status_code == 422:
|
|
2638
|
+
raise UnprocessableEntityError(
|
|
2639
|
+
typing.cast(
|
|
2640
|
+
HttpValidationError,
|
|
2641
|
+
parse_obj_as(
|
|
2642
|
+
type_=HttpValidationError, # type: ignore
|
|
2643
|
+
object_=_response.json(),
|
|
2644
|
+
),
|
|
2645
|
+
)
|
|
2646
|
+
)
|
|
2647
|
+
_response_json = _response.json()
|
|
2648
|
+
except JSONDecodeError:
|
|
2649
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2650
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2651
|
+
|
|
2652
|
+
async def configs_list(
|
|
2653
|
+
self,
|
|
2654
|
+
*,
|
|
2655
|
+
application_ref: ReferenceDto,
|
|
2656
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2657
|
+
) -> typing.List[ConfigResponseModel]:
|
|
2658
|
+
"""
|
|
2659
|
+
Parameters
|
|
2660
|
+
----------
|
|
2661
|
+
application_ref : ReferenceDto
|
|
2662
|
+
|
|
2663
|
+
request_options : typing.Optional[RequestOptions]
|
|
2664
|
+
Request-specific configuration.
|
|
2665
|
+
|
|
2666
|
+
Returns
|
|
2667
|
+
-------
|
|
2668
|
+
typing.List[ConfigResponseModel]
|
|
2669
|
+
Successful Response
|
|
2670
|
+
|
|
2671
|
+
Examples
|
|
2672
|
+
--------
|
|
2673
|
+
import asyncio
|
|
2674
|
+
|
|
2675
|
+
from agenta import AsyncAgentaApi, ReferenceDto
|
|
2676
|
+
|
|
2677
|
+
client = AsyncAgentaApi(
|
|
2678
|
+
api_key="YOUR_API_KEY",
|
|
2679
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2680
|
+
)
|
|
2681
|
+
|
|
2682
|
+
|
|
2683
|
+
async def main() -> None:
|
|
2684
|
+
await client.variants.configs_list(
|
|
2685
|
+
application_ref=ReferenceDto(),
|
|
2686
|
+
)
|
|
2687
|
+
|
|
2688
|
+
|
|
2689
|
+
asyncio.run(main())
|
|
2690
|
+
"""
|
|
2691
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2692
|
+
"variants/configs/list",
|
|
2693
|
+
method="POST",
|
|
2694
|
+
json={
|
|
2695
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2696
|
+
object_=application_ref, annotation=ReferenceDto, direction="write"
|
|
2697
|
+
),
|
|
2698
|
+
},
|
|
2699
|
+
headers={
|
|
2700
|
+
"content-type": "application/json",
|
|
2701
|
+
},
|
|
2702
|
+
request_options=request_options,
|
|
2703
|
+
omit=OMIT,
|
|
2704
|
+
)
|
|
2705
|
+
try:
|
|
2706
|
+
if 200 <= _response.status_code < 300:
|
|
2707
|
+
return typing.cast(
|
|
2708
|
+
typing.List[ConfigResponseModel],
|
|
2709
|
+
parse_obj_as(
|
|
2710
|
+
type_=typing.List[ConfigResponseModel], # type: ignore
|
|
2711
|
+
object_=_response.json(),
|
|
2712
|
+
),
|
|
2713
|
+
)
|
|
2714
|
+
if _response.status_code == 422:
|
|
2715
|
+
raise UnprocessableEntityError(
|
|
2716
|
+
typing.cast(
|
|
2717
|
+
HttpValidationError,
|
|
2718
|
+
parse_obj_as(
|
|
2719
|
+
type_=HttpValidationError, # type: ignore
|
|
2720
|
+
object_=_response.json(),
|
|
2721
|
+
),
|
|
2722
|
+
)
|
|
2723
|
+
)
|
|
2724
|
+
_response_json = _response.json()
|
|
2725
|
+
except JSONDecodeError:
|
|
2726
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2727
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2728
|
+
|
|
2729
|
+
async def configs_history(
|
|
2730
|
+
self,
|
|
2731
|
+
*,
|
|
2732
|
+
variant_ref: ReferenceRequestModel,
|
|
2733
|
+
application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
|
|
2734
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2735
|
+
) -> typing.List[ConfigResponseModel]:
|
|
2736
|
+
"""
|
|
2737
|
+
Parameters
|
|
2738
|
+
----------
|
|
2739
|
+
variant_ref : ReferenceRequestModel
|
|
2740
|
+
|
|
2741
|
+
application_ref : typing.Optional[ReferenceRequestModel]
|
|
2742
|
+
|
|
2743
|
+
request_options : typing.Optional[RequestOptions]
|
|
2744
|
+
Request-specific configuration.
|
|
2745
|
+
|
|
2746
|
+
Returns
|
|
2747
|
+
-------
|
|
2748
|
+
typing.List[ConfigResponseModel]
|
|
2749
|
+
Successful Response
|
|
2750
|
+
|
|
2751
|
+
Examples
|
|
2752
|
+
--------
|
|
2753
|
+
import asyncio
|
|
2754
|
+
|
|
2755
|
+
from agenta import AsyncAgentaApi, ReferenceRequestModel
|
|
2756
|
+
|
|
2757
|
+
client = AsyncAgentaApi(
|
|
2758
|
+
api_key="YOUR_API_KEY",
|
|
2759
|
+
base_url="https://yourhost.com/path/to/api",
|
|
2760
|
+
)
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
async def main() -> None:
|
|
2764
|
+
await client.variants.configs_history(
|
|
2765
|
+
variant_ref=ReferenceRequestModel(),
|
|
2766
|
+
)
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
asyncio.run(main())
|
|
2770
|
+
"""
|
|
2771
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2772
|
+
"variants/configs/history",
|
|
2773
|
+
method="POST",
|
|
2774
|
+
json={
|
|
2775
|
+
"variant_ref": convert_and_respect_annotation_metadata(
|
|
2776
|
+
object_=variant_ref,
|
|
2777
|
+
annotation=ReferenceRequestModel,
|
|
2778
|
+
direction="write",
|
|
2779
|
+
),
|
|
2780
|
+
"application_ref": convert_and_respect_annotation_metadata(
|
|
2781
|
+
object_=application_ref,
|
|
2782
|
+
annotation=ReferenceRequestModel,
|
|
2783
|
+
direction="write",
|
|
2784
|
+
),
|
|
2785
|
+
},
|
|
2786
|
+
headers={
|
|
2787
|
+
"content-type": "application/json",
|
|
2788
|
+
},
|
|
2789
|
+
request_options=request_options,
|
|
2790
|
+
omit=OMIT,
|
|
2791
|
+
)
|
|
2792
|
+
try:
|
|
2793
|
+
if 200 <= _response.status_code < 300:
|
|
2794
|
+
return typing.cast(
|
|
2795
|
+
typing.List[ConfigResponseModel],
|
|
2796
|
+
parse_obj_as(
|
|
2797
|
+
type_=typing.List[ConfigResponseModel], # type: ignore
|
|
2798
|
+
object_=_response.json(),
|
|
2799
|
+
),
|
|
2800
|
+
)
|
|
2801
|
+
if _response.status_code == 422:
|
|
2802
|
+
raise UnprocessableEntityError(
|
|
2803
|
+
typing.cast(
|
|
2804
|
+
HttpValidationError,
|
|
2805
|
+
parse_obj_as(
|
|
2806
|
+
type_=HttpValidationError, # type: ignore
|
|
2807
|
+
object_=_response.json(),
|
|
2808
|
+
),
|
|
2809
|
+
)
|
|
2810
|
+
)
|
|
2811
|
+
_response_json = _response.json()
|
|
2812
|
+
except JSONDecodeError:
|
|
2813
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2814
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|