agenta 0.48.8__py3-none-any.whl → 0.48.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/__init__.py +3 -2
- agenta/client/Readme.md +258 -80
- agenta/client/__init__.py +205 -29
- agenta/client/backend/__init__.py +461 -0
- agenta/client/backend/access_control/__init__.py +2 -0
- agenta/client/backend/access_control/client.py +53 -73
- agenta/client/backend/access_control/raw_client.py +180 -0
- agenta/client/backend/admin/__init__.py +2 -0
- agenta/client/backend/admin/client.py +473 -268
- agenta/client/backend/admin/raw_client.py +1017 -0
- agenta/client/backend/api_keys/__init__.py +2 -0
- agenta/client/backend/api_keys/client.py +43 -276
- agenta/client/backend/api_keys/raw_client.py +364 -0
- agenta/client/backend/apps/__init__.py +2 -0
- agenta/client/backend/apps/client.py +132 -895
- agenta/client/backend/apps/raw_client.py +1516 -0
- agenta/client/backend/bases/__init__.py +2 -0
- agenta/client/backend/bases/client.py +33 -73
- agenta/client/backend/bases/raw_client.py +179 -0
- agenta/client/backend/billing/__init__.py +3 -0
- agenta/client/backend/billing/client.py +564 -0
- agenta/client/backend/billing/raw_client.py +805 -0
- agenta/client/backend/client.py +1268 -0
- agenta/client/backend/configs/__init__.py +2 -0
- agenta/client/backend/configs/client.py +49 -361
- agenta/client/backend/configs/raw_client.py +402 -0
- agenta/client/backend/containers/__init__.py +1 -3
- agenta/client/backend/containers/client.py +25 -548
- agenta/client/backend/containers/raw_client.py +112 -0
- agenta/client/backend/core/__init__.py +5 -0
- agenta/client/backend/core/api_error.py +12 -6
- agenta/client/backend/core/client_wrapper.py +4 -4
- agenta/client/backend/core/file.py +1 -3
- agenta/client/backend/core/force_multipart.py +16 -0
- agenta/client/backend/core/http_client.py +78 -34
- agenta/client/backend/core/http_response.py +55 -0
- agenta/client/backend/core/jsonable_encoder.py +0 -1
- agenta/client/backend/core/pydantic_utilities.py +88 -113
- agenta/client/backend/core/serialization.py +9 -3
- agenta/client/backend/environment.py +7 -0
- agenta/client/backend/environments/__init__.py +2 -0
- agenta/client/backend/environments/client.py +43 -79
- agenta/client/backend/environments/raw_client.py +193 -0
- agenta/client/backend/errors/__init__.py +2 -0
- agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
- agenta/client/backend/evals/__init__.py +3 -0
- agenta/client/backend/evals/client.py +1042 -0
- agenta/client/backend/evals/raw_client.py +1549 -0
- agenta/client/backend/evaluations/__init__.py +2 -0
- agenta/client/backend/evaluations/client.py +106 -590
- agenta/client/backend/evaluations/raw_client.py +1344 -0
- agenta/client/backend/evaluators/__init__.py +2 -0
- agenta/client/backend/evaluators/client.py +99 -516
- agenta/client/backend/evaluators/raw_client.py +1182 -0
- agenta/client/backend/human_evaluations/__init__.py +2 -0
- agenta/client/backend/human_evaluations/client.py +120 -680
- agenta/client/backend/human_evaluations/raw_client.py +1577 -0
- agenta/client/backend/observability/__init__.py +14 -2
- agenta/client/backend/observability/client.py +185 -341
- agenta/client/backend/observability/raw_client.py +943 -0
- agenta/client/backend/observability/types/__init__.py +10 -2
- agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
- agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
- agenta/client/backend/observability/types/query_analytics_response.py +2 -1
- agenta/client/backend/observability/types/query_traces_response.py +7 -3
- agenta/client/backend/organization/__init__.py +2 -0
- agenta/client/backend/organization/client.py +105 -361
- agenta/client/backend/organization/raw_client.py +774 -0
- agenta/client/backend/raw_client.py +1432 -0
- agenta/client/backend/scopes/__init__.py +2 -0
- agenta/client/backend/scopes/client.py +31 -45
- agenta/client/backend/scopes/raw_client.py +105 -0
- agenta/client/backend/testsets/__init__.py +14 -0
- agenta/client/backend/testsets/client.py +1098 -653
- agenta/client/backend/testsets/raw_client.py +2348 -0
- agenta/client/backend/testsets/types/__init__.py +17 -0
- agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
- agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
- agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
- agenta/client/backend/tracing/__init__.py +7 -0
- agenta/client/backend/tracing/client.py +782 -0
- agenta/client/backend/tracing/raw_client.py +1223 -0
- agenta/client/backend/tracing/types/__init__.py +8 -0
- agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
- agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
- agenta/client/backend/types/__init__.py +153 -26
- agenta/client/backend/types/account_request.py +24 -0
- agenta/client/backend/types/account_response.py +5 -7
- agenta/client/backend/types/agenta_node_dto.py +13 -13
- agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
- agenta/client/backend/types/agenta_nodes_response.py +14 -8
- agenta/client/backend/types/agenta_root_dto.py +16 -8
- agenta/client/backend/types/agenta_roots_response.py +16 -8
- agenta/client/backend/types/agenta_tree_dto.py +16 -8
- agenta/client/backend/types/agenta_trees_response.py +16 -8
- agenta/client/backend/types/aggregated_result.py +5 -7
- agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
- agenta/client/backend/types/analytics_response.py +4 -6
- agenta/client/backend/types/annotation.py +50 -0
- agenta/client/backend/types/annotation_create.py +39 -0
- agenta/client/backend/types/annotation_edit.py +31 -0
- agenta/client/backend/types/annotation_kind.py +5 -0
- agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
- agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
- agenta/client/backend/types/annotation_query.py +40 -0
- agenta/client/backend/types/annotation_query_request.py +20 -0
- agenta/client/backend/types/annotation_reference.py +21 -0
- agenta/client/backend/types/annotation_references.py +22 -0
- agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
- agenta/client/backend/types/annotation_source.py +5 -0
- agenta/client/backend/types/annotations_response.py +24 -0
- agenta/client/backend/types/app.py +3 -5
- agenta/client/backend/types/app_variant_response.py +3 -6
- agenta/client/backend/types/app_variant_revision.py +5 -6
- agenta/client/backend/types/artifact.py +44 -0
- agenta/client/backend/types/base_output.py +3 -5
- agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
- agenta/client/backend/types/body_import_testset.py +3 -5
- agenta/client/backend/types/bucket_dto.py +4 -6
- agenta/client/backend/types/collect_status_response.py +3 -5
- agenta/client/backend/types/config_db.py +3 -5
- agenta/client/backend/types/config_dto.py +5 -7
- agenta/client/backend/types/config_response_model.py +5 -7
- agenta/client/backend/types/correct_answer.py +3 -5
- agenta/client/backend/types/create_app_output.py +3 -5
- agenta/client/backend/types/custom_model_settings_dto.py +3 -5
- agenta/client/backend/types/custom_provider_dto.py +6 -9
- agenta/client/backend/types/custom_provider_kind.py +5 -5
- agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
- agenta/client/backend/types/data.py +2 -1
- agenta/client/backend/types/delete_evaluation.py +3 -5
- agenta/client/backend/types/environment_output.py +3 -5
- agenta/client/backend/types/environment_output_extended.py +4 -6
- agenta/client/backend/types/environment_revision.py +5 -5
- agenta/client/backend/types/error.py +3 -5
- agenta/client/backend/types/evaluation.py +6 -8
- agenta/client/backend/types/evaluation_scenario.py +5 -7
- agenta/client/backend/types/evaluation_scenario_input.py +3 -5
- agenta/client/backend/types/evaluation_scenario_output.py +4 -6
- agenta/client/backend/types/evaluation_scenario_result.py +4 -6
- agenta/client/backend/types/evaluator.py +31 -12
- agenta/client/backend/types/evaluator_config.py +3 -5
- agenta/client/backend/types/evaluator_flags.py +21 -0
- agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
- agenta/client/backend/types/evaluator_output_interface.py +3 -5
- agenta/client/backend/types/evaluator_query.py +32 -0
- agenta/client/backend/types/evaluator_query_request.py +30 -0
- agenta/client/backend/types/evaluator_request.py +20 -0
- agenta/client/backend/types/evaluator_response.py +21 -0
- agenta/client/backend/types/evaluators_response.py +21 -0
- agenta/client/backend/types/exception_dto.py +3 -5
- agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
- agenta/client/backend/types/focus.py +5 -0
- agenta/client/backend/types/format.py +5 -0
- agenta/client/backend/types/full_json_input.py +34 -0
- agenta/client/backend/types/full_json_output.py +29 -0
- agenta/client/backend/types/get_config_response.py +3 -5
- agenta/client/backend/types/{header_dto.py → header.py} +4 -6
- agenta/client/backend/types/http_validation_error.py +4 -6
- agenta/client/backend/types/human_evaluation.py +3 -5
- agenta/client/backend/types/human_evaluation_scenario.py +4 -6
- agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
- agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
- agenta/client/backend/types/invite_request.py +4 -6
- agenta/client/backend/types/legacy_analytics_response.py +4 -6
- agenta/client/backend/types/legacy_data_point.py +3 -5
- agenta/client/backend/types/legacy_evaluator.py +26 -0
- agenta/client/backend/types/legacy_scope_request.py +4 -6
- agenta/client/backend/types/legacy_scopes_response.py +3 -5
- agenta/client/backend/types/legacy_subscription_request.py +19 -0
- agenta/client/backend/types/legacy_user_request.py +5 -7
- agenta/client/backend/types/legacy_user_response.py +3 -5
- agenta/client/backend/types/lifecycle_dto.py +3 -5
- agenta/client/backend/types/link_dto.py +4 -6
- agenta/client/backend/types/list_api_keys_response.py +3 -5
- agenta/client/backend/types/llm_run_rate_limit.py +3 -5
- agenta/client/backend/types/meta_request.py +30 -0
- agenta/client/backend/types/metrics_dto.py +3 -5
- agenta/client/backend/types/new_testset.py +3 -5
- agenta/client/backend/types/node_dto.py +4 -6
- agenta/client/backend/types/o_tel_context_dto.py +3 -5
- agenta/client/backend/types/o_tel_event.py +35 -0
- agenta/client/backend/types/o_tel_event_dto.py +3 -5
- agenta/client/backend/types/o_tel_extra_dto.py +4 -6
- agenta/client/backend/types/o_tel_flat_span.py +56 -0
- agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
- agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
- agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
- agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
- agenta/client/backend/types/o_tel_link.py +34 -0
- agenta/client/backend/types/o_tel_link_dto.py +4 -6
- agenta/client/backend/types/o_tel_links_response.py +22 -0
- agenta/client/backend/types/o_tel_span.py +58 -0
- agenta/client/backend/types/o_tel_span_dto.py +8 -10
- agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
- agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
- agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
- agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
- agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
- agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
- agenta/client/backend/types/o_tel_spans_tree.py +22 -0
- agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
- agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
- agenta/client/backend/types/o_tel_status_code.py +1 -1
- agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
- agenta/client/backend/types/o_tel_tracing_request.py +22 -0
- agenta/client/backend/types/o_tel_tracing_response.py +27 -0
- agenta/client/backend/types/organization.py +3 -5
- agenta/client/backend/types/organization_details.py +3 -5
- agenta/client/backend/types/organization_membership_request.py +5 -7
- agenta/client/backend/types/organization_output.py +3 -5
- agenta/client/backend/types/organization_request.py +3 -5
- agenta/client/backend/types/parent_dto.py +3 -5
- agenta/client/backend/types/permission.py +11 -0
- agenta/client/backend/types/plan.py +14 -0
- agenta/client/backend/types/project_membership_request.py +5 -7
- agenta/client/backend/types/project_request.py +4 -6
- agenta/client/backend/types/project_scope.py +5 -7
- agenta/client/backend/types/projects_response.py +3 -5
- agenta/client/backend/types/recursive_types.py +23 -0
- agenta/client/backend/types/reference.py +18 -5
- agenta/client/backend/types/reference_dto.py +4 -5
- agenta/client/backend/types/reference_request_model.py +4 -5
- agenta/client/backend/types/result.py +4 -6
- agenta/client/backend/types/root_dto.py +3 -5
- agenta/client/backend/types/scopes_response_model.py +4 -6
- agenta/client/backend/types/secret_dto.py +5 -7
- agenta/client/backend/types/secret_response_dto.py +11 -11
- agenta/client/backend/types/simple_evaluation_output.py +4 -6
- agenta/client/backend/types/span_dto.py +18 -14
- agenta/client/backend/types/span_dto_nodes_value.py +1 -1
- agenta/client/backend/types/standard_provider_dto.py +5 -7
- agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
- agenta/client/backend/types/status_dto.py +4 -6
- agenta/client/backend/types/tags_request.py +30 -0
- agenta/client/backend/types/test_set_output_response.py +5 -7
- agenta/client/backend/types/test_set_simple_response.py +3 -5
- agenta/client/backend/types/testcase_response.py +33 -0
- agenta/client/backend/types/testset.py +46 -0
- agenta/client/backend/types/testset_request.py +20 -0
- agenta/client/backend/types/testset_response.py +21 -0
- agenta/client/backend/types/testsets_response.py +21 -0
- agenta/client/backend/types/time_dto.py +3 -5
- agenta/client/backend/types/timestamp.py +6 -0
- agenta/client/backend/types/tree_dto.py +4 -6
- agenta/client/backend/types/update_app_output.py +3 -5
- agenta/client/backend/types/user_request.py +3 -5
- agenta/client/backend/types/validation_error.py +4 -6
- agenta/client/backend/types/workflow_artifact.py +45 -0
- agenta/client/backend/types/workflow_data.py +20 -0
- agenta/client/backend/types/workflow_flags.py +21 -0
- agenta/client/backend/types/workflow_request.py +20 -0
- agenta/client/backend/types/workflow_response.py +21 -0
- agenta/client/backend/types/workflow_revision.py +57 -0
- agenta/client/backend/types/workflow_revision_request.py +20 -0
- agenta/client/backend/types/workflow_revision_response.py +21 -0
- agenta/client/backend/types/workflow_revisions_response.py +21 -0
- agenta/client/backend/types/workflow_variant.py +48 -0
- agenta/client/backend/types/workflow_variant_request.py +20 -0
- agenta/client/backend/types/workflow_variant_response.py +21 -0
- agenta/client/backend/types/workflow_variants_response.py +21 -0
- agenta/client/backend/types/workflows_response.py +21 -0
- agenta/client/backend/types/workspace.py +3 -5
- agenta/client/backend/types/workspace_member_response.py +4 -6
- agenta/client/backend/types/workspace_membership_request.py +5 -7
- agenta/client/backend/types/workspace_permission.py +5 -7
- agenta/client/backend/types/workspace_request.py +4 -6
- agenta/client/backend/types/workspace_response.py +4 -6
- agenta/client/backend/variants/__init__.py +2 -0
- agenta/client/backend/variants/client.py +306 -1651
- agenta/client/backend/variants/raw_client.py +2482 -0
- agenta/client/backend/variants/types/__init__.py +2 -0
- agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
- agenta/client/backend/vault/__init__.py +2 -0
- agenta/client/backend/vault/client.py +69 -323
- agenta/client/backend/vault/raw_client.py +616 -0
- agenta/client/backend/workflows/__init__.py +3 -0
- agenta/client/backend/workflows/client.py +2398 -0
- agenta/client/backend/workflows/raw_client.py +3639 -0
- agenta/client/backend/workspace/__init__.py +2 -0
- agenta/client/backend/workspace/client.py +46 -147
- agenta/client/backend/workspace/raw_client.py +376 -0
- agenta/client/types.py +4 -0
- agenta/sdk/decorators/tracing.py +2 -4
- agenta/sdk/tracing/processors.py +26 -39
- agenta/sdk/types.py +28 -1
- {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
- agenta-0.48.10.dist-info/RECORD +362 -0
- agenta/client/backend/containers/types/__init__.py +0 -5
- agenta/client/backend/containers/types/container_templates_response.py +0 -6
- agenta/client/backend/types/image.py +0 -25
- agenta/client/backend/types/provider_kind.py +0 -21
- agenta/client/backend/types/template.py +0 -23
- agenta/client/backend/types/template_image_info.py +0 -29
- agenta/client/backend/types/variant_action.py +0 -22
- agenta-0.48.8.dist-info/RECORD +0 -255
- {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
|
@@ -2,93 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
# nopycln: file
|
|
4
4
|
import datetime as dt
|
|
5
|
-
import typing
|
|
6
5
|
from collections import defaultdict
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
from typing import (
|
|
7
|
+
Any,
|
|
8
|
+
Callable,
|
|
9
|
+
ClassVar,
|
|
10
|
+
Dict,
|
|
11
|
+
List,
|
|
12
|
+
Mapping,
|
|
13
|
+
Optional,
|
|
14
|
+
Set,
|
|
15
|
+
Tuple,
|
|
16
|
+
Type,
|
|
17
|
+
TypeVar,
|
|
18
|
+
Union,
|
|
19
|
+
cast,
|
|
20
|
+
)
|
|
9
21
|
|
|
10
22
|
import pydantic
|
|
11
23
|
|
|
12
|
-
from .datetime_utils import serialize_datetime
|
|
13
|
-
from .serialization import convert_and_respect_annotation_metadata
|
|
14
|
-
|
|
15
24
|
IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
|
|
16
25
|
|
|
17
26
|
if IS_PYDANTIC_V2:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
from pydantic.v1.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
from pydantic.v1.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
|
27
|
-
ENCODERS_BY_TYPE as encoders_by_type,
|
|
28
|
-
)
|
|
29
|
-
from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
|
30
|
-
get_args as get_args,
|
|
31
|
-
)
|
|
32
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
|
33
|
-
get_origin as get_origin,
|
|
34
|
-
)
|
|
35
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
|
36
|
-
is_literal_type as is_literal_type,
|
|
37
|
-
)
|
|
38
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
|
39
|
-
is_union as is_union,
|
|
40
|
-
)
|
|
41
|
-
from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
|
27
|
+
from pydantic.v1.datetime_parse import parse_date as parse_date
|
|
28
|
+
from pydantic.v1.datetime_parse import parse_datetime as parse_datetime
|
|
29
|
+
from pydantic.v1.fields import ModelField as ModelField
|
|
30
|
+
from pydantic.v1.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[attr-defined]
|
|
31
|
+
from pydantic.v1.typing import get_args as get_args
|
|
32
|
+
from pydantic.v1.typing import get_origin as get_origin
|
|
33
|
+
from pydantic.v1.typing import is_literal_type as is_literal_type
|
|
34
|
+
from pydantic.v1.typing import is_union as is_union
|
|
42
35
|
else:
|
|
43
|
-
from pydantic.datetime_parse import parse_date as parse_date # type: ignore
|
|
44
|
-
from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore
|
|
45
|
-
from pydantic.fields import ModelField as ModelField # type: ignore
|
|
46
|
-
from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore
|
|
47
|
-
from pydantic.typing import get_args as get_args # type: ignore
|
|
48
|
-
from pydantic.typing import get_origin as get_origin # type: ignore
|
|
49
|
-
from pydantic.typing import is_literal_type as is_literal_type # type: ignore
|
|
50
|
-
from pydantic.typing import is_union as is_union # type: ignore
|
|
51
|
-
|
|
52
|
-
# isort: on
|
|
36
|
+
from pydantic.datetime_parse import parse_date as parse_date # type: ignore[no-redef]
|
|
37
|
+
from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore[no-redef]
|
|
38
|
+
from pydantic.fields import ModelField as ModelField # type: ignore[attr-defined, no-redef]
|
|
39
|
+
from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[no-redef]
|
|
40
|
+
from pydantic.typing import get_args as get_args # type: ignore[no-redef]
|
|
41
|
+
from pydantic.typing import get_origin as get_origin # type: ignore[no-redef]
|
|
42
|
+
from pydantic.typing import is_literal_type as is_literal_type # type: ignore[no-redef]
|
|
43
|
+
from pydantic.typing import is_union as is_union # type: ignore[no-redef]
|
|
53
44
|
|
|
45
|
+
from .datetime_utils import serialize_datetime
|
|
46
|
+
from .serialization import convert_and_respect_annotation_metadata
|
|
47
|
+
from typing_extensions import TypeAlias
|
|
54
48
|
|
|
55
|
-
T =
|
|
56
|
-
Model =
|
|
49
|
+
T = TypeVar("T")
|
|
50
|
+
Model = TypeVar("Model", bound=pydantic.BaseModel)
|
|
57
51
|
|
|
58
52
|
|
|
59
|
-
def parse_obj_as(type_:
|
|
53
|
+
def parse_obj_as(type_: Type[T], object_: Any) -> T:
|
|
60
54
|
dealiased_object = convert_and_respect_annotation_metadata(
|
|
61
55
|
object_=object_, annotation=type_, direction="read"
|
|
62
56
|
)
|
|
63
57
|
if IS_PYDANTIC_V2:
|
|
64
|
-
adapter = pydantic.TypeAdapter(type_) # type: ignore
|
|
58
|
+
adapter = pydantic.TypeAdapter(type_) # type: ignore[attr-defined]
|
|
65
59
|
return adapter.validate_python(dealiased_object)
|
|
66
|
-
|
|
67
|
-
return pydantic.parse_obj_as(type_, dealiased_object)
|
|
60
|
+
return pydantic.parse_obj_as(type_, dealiased_object)
|
|
68
61
|
|
|
69
62
|
|
|
70
63
|
def to_jsonable_with_fallback(
|
|
71
|
-
obj:
|
|
72
|
-
) ->
|
|
64
|
+
obj: Any, fallback_serializer: Callable[[Any], Any]
|
|
65
|
+
) -> Any:
|
|
73
66
|
if IS_PYDANTIC_V2:
|
|
74
67
|
from pydantic_core import to_jsonable_python
|
|
75
68
|
|
|
76
69
|
return to_jsonable_python(obj, fallback=fallback_serializer)
|
|
77
|
-
|
|
78
|
-
return fallback_serializer(obj)
|
|
70
|
+
return fallback_serializer(obj)
|
|
79
71
|
|
|
80
72
|
|
|
81
73
|
class UniversalBaseModel(pydantic.BaseModel):
|
|
82
74
|
if IS_PYDANTIC_V2:
|
|
83
|
-
model_config:
|
|
75
|
+
model_config: ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( # type: ignore[typeddict-unknown-key]
|
|
84
76
|
# Allow fields beginning with `model_` to be used in the model
|
|
85
77
|
protected_namespaces=(),
|
|
86
|
-
)
|
|
78
|
+
)
|
|
87
79
|
|
|
88
|
-
@pydantic.model_serializer(mode="wrap", when_used="json") # type: ignore
|
|
89
|
-
def serialize_model(
|
|
90
|
-
self, handler: pydantic.SerializerFunctionWrapHandler
|
|
91
|
-
) -> typing.Any: # type: ignore # Pydantic v2
|
|
80
|
+
@pydantic.model_serializer(mode="wrap", when_used="json") # type: ignore[attr-defined]
|
|
81
|
+
def serialize_model(self, handler: pydantic.SerializerFunctionWrapHandler) -> Any: # type: ignore[name-defined]
|
|
92
82
|
serialized = handler(self)
|
|
93
83
|
data = {
|
|
94
84
|
k: serialize_datetime(v) if isinstance(v, dt.datetime) else v
|
|
@@ -104,9 +94,7 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
104
94
|
|
|
105
95
|
@classmethod
|
|
106
96
|
def model_construct(
|
|
107
|
-
cls:
|
|
108
|
-
_fields_set: typing.Optional[typing.Set[str]] = None,
|
|
109
|
-
**values: typing.Any,
|
|
97
|
+
cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any
|
|
110
98
|
) -> "Model":
|
|
111
99
|
dealiased_object = convert_and_respect_annotation_metadata(
|
|
112
100
|
object_=values, annotation=cls, direction="read"
|
|
@@ -115,30 +103,26 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
115
103
|
|
|
116
104
|
@classmethod
|
|
117
105
|
def construct(
|
|
118
|
-
cls:
|
|
119
|
-
_fields_set: typing.Optional[typing.Set[str]] = None,
|
|
120
|
-
**values: typing.Any,
|
|
106
|
+
cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any
|
|
121
107
|
) -> "Model":
|
|
122
108
|
dealiased_object = convert_and_respect_annotation_metadata(
|
|
123
109
|
object_=values, annotation=cls, direction="read"
|
|
124
110
|
)
|
|
125
111
|
if IS_PYDANTIC_V2:
|
|
126
|
-
return super().model_construct(_fields_set, **dealiased_object) # type: ignore
|
|
127
|
-
|
|
128
|
-
return super().construct(_fields_set, **dealiased_object)
|
|
112
|
+
return super().model_construct(_fields_set, **dealiased_object) # type: ignore[misc]
|
|
113
|
+
return super().construct(_fields_set, **dealiased_object)
|
|
129
114
|
|
|
130
|
-
def json(self, **kwargs:
|
|
131
|
-
kwargs_with_defaults
|
|
115
|
+
def json(self, **kwargs: Any) -> str:
|
|
116
|
+
kwargs_with_defaults = {
|
|
132
117
|
"by_alias": True,
|
|
133
118
|
"exclude_unset": True,
|
|
134
119
|
**kwargs,
|
|
135
120
|
}
|
|
136
121
|
if IS_PYDANTIC_V2:
|
|
137
|
-
return super().model_dump_json(**kwargs_with_defaults) # type: ignore
|
|
138
|
-
|
|
139
|
-
return super().json(**kwargs_with_defaults)
|
|
122
|
+
return super().model_dump_json(**kwargs_with_defaults) # type: ignore[misc]
|
|
123
|
+
return super().json(**kwargs_with_defaults)
|
|
140
124
|
|
|
141
|
-
def dict(self, **kwargs:
|
|
125
|
+
def dict(self, **kwargs: Any) -> Dict[str, Any]:
|
|
142
126
|
"""
|
|
143
127
|
Override the default dict method to `exclude_unset` by default. This function patches
|
|
144
128
|
`exclude_unset` to work include fields within non-None default values.
|
|
@@ -149,21 +133,21 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
149
133
|
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
|
|
150
134
|
# that we have less control over, and this is less intrusive than custom serializers for now.
|
|
151
135
|
if IS_PYDANTIC_V2:
|
|
152
|
-
kwargs_with_defaults_exclude_unset
|
|
136
|
+
kwargs_with_defaults_exclude_unset = {
|
|
153
137
|
**kwargs,
|
|
154
138
|
"by_alias": True,
|
|
155
139
|
"exclude_unset": True,
|
|
156
140
|
"exclude_none": False,
|
|
157
141
|
}
|
|
158
|
-
kwargs_with_defaults_exclude_none
|
|
142
|
+
kwargs_with_defaults_exclude_none = {
|
|
159
143
|
**kwargs,
|
|
160
144
|
"by_alias": True,
|
|
161
145
|
"exclude_none": True,
|
|
162
146
|
"exclude_unset": False,
|
|
163
147
|
}
|
|
164
148
|
dict_dump = deep_union_pydantic_dicts(
|
|
165
|
-
super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore
|
|
166
|
-
super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore
|
|
149
|
+
super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore[misc]
|
|
150
|
+
super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore[misc]
|
|
167
151
|
)
|
|
168
152
|
|
|
169
153
|
else:
|
|
@@ -185,7 +169,7 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
185
169
|
if default is not None:
|
|
186
170
|
self.__fields_set__.add(name)
|
|
187
171
|
|
|
188
|
-
kwargs_with_defaults_exclude_unset_include_fields
|
|
172
|
+
kwargs_with_defaults_exclude_unset_include_fields = {
|
|
189
173
|
"by_alias": True,
|
|
190
174
|
"exclude_unset": True,
|
|
191
175
|
"include": _fields_set,
|
|
@@ -202,11 +186,11 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
202
186
|
|
|
203
187
|
|
|
204
188
|
def _union_list_of_pydantic_dicts(
|
|
205
|
-
source:
|
|
206
|
-
) ->
|
|
207
|
-
converted_list:
|
|
189
|
+
source: List[Any], destination: List[Any]
|
|
190
|
+
) -> List[Any]:
|
|
191
|
+
converted_list: List[Any] = []
|
|
208
192
|
for i, item in enumerate(source):
|
|
209
|
-
destination_value = destination[i]
|
|
193
|
+
destination_value = destination[i]
|
|
210
194
|
if isinstance(item, dict):
|
|
211
195
|
converted_list.append(deep_union_pydantic_dicts(item, destination_value))
|
|
212
196
|
elif isinstance(item, list):
|
|
@@ -219,8 +203,8 @@ def _union_list_of_pydantic_dicts(
|
|
|
219
203
|
|
|
220
204
|
|
|
221
205
|
def deep_union_pydantic_dicts(
|
|
222
|
-
source:
|
|
223
|
-
) ->
|
|
206
|
+
source: Dict[str, Any], destination: Dict[str, Any]
|
|
207
|
+
) -> Dict[str, Any]:
|
|
224
208
|
for key, value in source.items():
|
|
225
209
|
node = destination.setdefault(key, {})
|
|
226
210
|
if isinstance(value, dict):
|
|
@@ -238,18 +222,18 @@ def deep_union_pydantic_dicts(
|
|
|
238
222
|
|
|
239
223
|
if IS_PYDANTIC_V2:
|
|
240
224
|
|
|
241
|
-
class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore
|
|
225
|
+
class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore[misc, name-defined, type-arg]
|
|
242
226
|
pass
|
|
243
227
|
|
|
244
|
-
UniversalRootModel:
|
|
228
|
+
UniversalRootModel: TypeAlias = V2RootModel # type: ignore[misc]
|
|
245
229
|
else:
|
|
246
|
-
UniversalRootModel:
|
|
230
|
+
UniversalRootModel: TypeAlias = UniversalBaseModel # type: ignore[misc, no-redef]
|
|
247
231
|
|
|
248
232
|
|
|
249
|
-
def encode_by_type(o:
|
|
250
|
-
encoders_by_class_tuples:
|
|
251
|
-
|
|
252
|
-
|
|
233
|
+
def encode_by_type(o: Any) -> Any:
|
|
234
|
+
encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(
|
|
235
|
+
tuple
|
|
236
|
+
)
|
|
253
237
|
for type_, encoder in encoders_by_type.items():
|
|
254
238
|
encoders_by_class_tuples[encoder] += (type_,)
|
|
255
239
|
|
|
@@ -260,60 +244,51 @@ def encode_by_type(o: typing.Any) -> typing.Any:
|
|
|
260
244
|
return encoder(o)
|
|
261
245
|
|
|
262
246
|
|
|
263
|
-
def update_forward_refs(model:
|
|
247
|
+
def update_forward_refs(model: Type["Model"], **localns: Any) -> None:
|
|
264
248
|
if IS_PYDANTIC_V2:
|
|
265
|
-
model.model_rebuild(raise_errors=False) # type: ignore
|
|
249
|
+
model.model_rebuild(raise_errors=False) # type: ignore[attr-defined]
|
|
266
250
|
else:
|
|
267
251
|
model.update_forward_refs(**localns)
|
|
268
252
|
|
|
269
253
|
|
|
270
254
|
# Mirrors Pydantic's internal typing
|
|
271
|
-
AnyCallable =
|
|
255
|
+
AnyCallable = Callable[..., Any]
|
|
272
256
|
|
|
273
257
|
|
|
274
258
|
def universal_root_validator(
|
|
275
259
|
pre: bool = False,
|
|
276
|
-
) ->
|
|
260
|
+
) -> Callable[[AnyCallable], AnyCallable]:
|
|
277
261
|
def decorator(func: AnyCallable) -> AnyCallable:
|
|
278
262
|
if IS_PYDANTIC_V2:
|
|
279
|
-
return pydantic.model_validator(mode="before" if pre else "after")(func) # type: ignore
|
|
280
|
-
|
|
281
|
-
return pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1
|
|
263
|
+
return cast(AnyCallable, pydantic.model_validator(mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
|
|
264
|
+
return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload]
|
|
282
265
|
|
|
283
266
|
return decorator
|
|
284
267
|
|
|
285
268
|
|
|
286
269
|
def universal_field_validator(
|
|
287
270
|
field_name: str, pre: bool = False
|
|
288
|
-
) ->
|
|
271
|
+
) -> Callable[[AnyCallable], AnyCallable]:
|
|
289
272
|
def decorator(func: AnyCallable) -> AnyCallable:
|
|
290
273
|
if IS_PYDANTIC_V2:
|
|
291
|
-
return pydantic.field_validator(
|
|
292
|
-
|
|
293
|
-
)(
|
|
294
|
-
func
|
|
295
|
-
) # type: ignore # Pydantic v2
|
|
296
|
-
else:
|
|
297
|
-
return pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1
|
|
274
|
+
return cast(AnyCallable, pydantic.field_validator(field_name, mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
|
|
275
|
+
return cast(AnyCallable, pydantic.validator(field_name, pre=pre)(func))
|
|
298
276
|
|
|
299
277
|
return decorator
|
|
300
278
|
|
|
301
279
|
|
|
302
|
-
PydanticField =
|
|
280
|
+
PydanticField = Union[ModelField, pydantic.fields.FieldInfo]
|
|
303
281
|
|
|
304
282
|
|
|
305
|
-
def _get_model_fields(
|
|
306
|
-
model: typing.Type["Model"],
|
|
307
|
-
) -> typing.Mapping[str, PydanticField]:
|
|
283
|
+
def _get_model_fields(model: Type["Model"]) -> Mapping[str, PydanticField]:
|
|
308
284
|
if IS_PYDANTIC_V2:
|
|
309
|
-
return model.model_fields # type: ignore
|
|
310
|
-
|
|
311
|
-
return model.__fields__ # type: ignore # Pydantic v1
|
|
285
|
+
return cast(Mapping[str, PydanticField], model.model_fields) # type: ignore[attr-defined]
|
|
286
|
+
return cast(Mapping[str, PydanticField], model.__fields__)
|
|
312
287
|
|
|
313
288
|
|
|
314
|
-
def _get_field_default(field: PydanticField) ->
|
|
289
|
+
def _get_field_default(field: PydanticField) -> Any:
|
|
315
290
|
try:
|
|
316
|
-
value = field.get_default() # type: ignore
|
|
291
|
+
value = field.get_default() # type: ignore[union-attr]
|
|
317
292
|
except:
|
|
318
293
|
value = field.default
|
|
319
294
|
if IS_PYDANTIC_V2:
|
|
@@ -4,9 +4,8 @@ import collections
|
|
|
4
4
|
import inspect
|
|
5
5
|
import typing
|
|
6
6
|
|
|
7
|
-
import typing_extensions
|
|
8
|
-
|
|
9
7
|
import pydantic
|
|
8
|
+
import typing_extensions
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
class FieldMetadata:
|
|
@@ -163,7 +162,14 @@ def _convert_mapping(
|
|
|
163
162
|
direction: typing.Literal["read", "write"],
|
|
164
163
|
) -> typing.Mapping[str, object]:
|
|
165
164
|
converted_object: typing.Dict[str, object] = {}
|
|
166
|
-
|
|
165
|
+
try:
|
|
166
|
+
annotations = typing_extensions.get_type_hints(
|
|
167
|
+
expected_type, include_extras=True
|
|
168
|
+
)
|
|
169
|
+
except NameError:
|
|
170
|
+
# The TypedDict contains a circular reference, so
|
|
171
|
+
# we use the __annotations__ attribute directly.
|
|
172
|
+
annotations = getattr(expected_type, "__annotations__", {})
|
|
167
173
|
aliases_to_field_names = _get_alias_to_field_name(annotations)
|
|
168
174
|
for key, value in object_.items():
|
|
169
175
|
if direction == "read" and key in aliases_to_field_names:
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
5
6
|
from ..core.request_options import RequestOptions
|
|
6
|
-
from
|
|
7
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
8
|
-
from ..types.http_validation_error import HttpValidationError
|
|
9
|
-
from json.decoder import JSONDecodeError
|
|
10
|
-
from ..core.api_error import ApiError
|
|
11
|
-
from ..core.client_wrapper import AsyncClientWrapper
|
|
7
|
+
from .raw_client import AsyncRawEnvironmentsClient, RawEnvironmentsClient
|
|
12
8
|
|
|
13
9
|
# this is used as the default value for optional parameters
|
|
14
10
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -16,13 +12,25 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
16
12
|
|
|
17
13
|
class EnvironmentsClient:
|
|
18
14
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
-
self.
|
|
15
|
+
self._raw_client = RawEnvironmentsClient(client_wrapper=client_wrapper)
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def with_raw_response(self) -> RawEnvironmentsClient:
|
|
19
|
+
"""
|
|
20
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
RawEnvironmentsClient
|
|
25
|
+
"""
|
|
26
|
+
return self._raw_client
|
|
20
27
|
|
|
21
28
|
def deploy_to_environment(
|
|
22
29
|
self,
|
|
23
30
|
*,
|
|
24
31
|
environment_name: str,
|
|
25
32
|
variant_id: str,
|
|
33
|
+
commit_message: typing.Optional[str] = OMIT,
|
|
26
34
|
request_options: typing.Optional[RequestOptions] = None,
|
|
27
35
|
) -> typing.Optional[typing.Any]:
|
|
28
36
|
"""
|
|
@@ -41,6 +49,8 @@ class EnvironmentsClient:
|
|
|
41
49
|
|
|
42
50
|
variant_id : str
|
|
43
51
|
|
|
52
|
+
commit_message : typing.Optional[str]
|
|
53
|
+
|
|
44
54
|
request_options : typing.Optional[RequestOptions]
|
|
45
55
|
Request-specific configuration.
|
|
46
56
|
|
|
@@ -55,60 +65,42 @@ class EnvironmentsClient:
|
|
|
55
65
|
|
|
56
66
|
client = AgentaApi(
|
|
57
67
|
api_key="YOUR_API_KEY",
|
|
58
|
-
base_url="https://yourhost.com/path/to/api",
|
|
59
68
|
)
|
|
60
69
|
client.environments.deploy_to_environment(
|
|
61
70
|
environment_name="environment_name",
|
|
62
71
|
variant_id="variant_id",
|
|
63
72
|
)
|
|
64
73
|
"""
|
|
65
|
-
_response = self.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"environment_name": environment_name,
|
|
70
|
-
"variant_id": variant_id,
|
|
71
|
-
},
|
|
72
|
-
headers={
|
|
73
|
-
"content-type": "application/json",
|
|
74
|
-
},
|
|
74
|
+
_response = self._raw_client.deploy_to_environment(
|
|
75
|
+
environment_name=environment_name,
|
|
76
|
+
variant_id=variant_id,
|
|
77
|
+
commit_message=commit_message,
|
|
75
78
|
request_options=request_options,
|
|
76
|
-
omit=OMIT,
|
|
77
79
|
)
|
|
78
|
-
|
|
79
|
-
if 200 <= _response.status_code < 300:
|
|
80
|
-
return typing.cast(
|
|
81
|
-
typing.Optional[typing.Any],
|
|
82
|
-
parse_obj_as(
|
|
83
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
84
|
-
object_=_response.json(),
|
|
85
|
-
),
|
|
86
|
-
)
|
|
87
|
-
if _response.status_code == 422:
|
|
88
|
-
raise UnprocessableEntityError(
|
|
89
|
-
typing.cast(
|
|
90
|
-
HttpValidationError,
|
|
91
|
-
parse_obj_as(
|
|
92
|
-
type_=HttpValidationError, # type: ignore
|
|
93
|
-
object_=_response.json(),
|
|
94
|
-
),
|
|
95
|
-
)
|
|
96
|
-
)
|
|
97
|
-
_response_json = _response.json()
|
|
98
|
-
except JSONDecodeError:
|
|
99
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
100
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
80
|
+
return _response.data
|
|
101
81
|
|
|
102
82
|
|
|
103
83
|
class AsyncEnvironmentsClient:
|
|
104
84
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
105
|
-
self.
|
|
85
|
+
self._raw_client = AsyncRawEnvironmentsClient(client_wrapper=client_wrapper)
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def with_raw_response(self) -> AsyncRawEnvironmentsClient:
|
|
89
|
+
"""
|
|
90
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
91
|
+
|
|
92
|
+
Returns
|
|
93
|
+
-------
|
|
94
|
+
AsyncRawEnvironmentsClient
|
|
95
|
+
"""
|
|
96
|
+
return self._raw_client
|
|
106
97
|
|
|
107
98
|
async def deploy_to_environment(
|
|
108
99
|
self,
|
|
109
100
|
*,
|
|
110
101
|
environment_name: str,
|
|
111
102
|
variant_id: str,
|
|
103
|
+
commit_message: typing.Optional[str] = OMIT,
|
|
112
104
|
request_options: typing.Optional[RequestOptions] = None,
|
|
113
105
|
) -> typing.Optional[typing.Any]:
|
|
114
106
|
"""
|
|
@@ -127,6 +119,8 @@ class AsyncEnvironmentsClient:
|
|
|
127
119
|
|
|
128
120
|
variant_id : str
|
|
129
121
|
|
|
122
|
+
commit_message : typing.Optional[str]
|
|
123
|
+
|
|
130
124
|
request_options : typing.Optional[RequestOptions]
|
|
131
125
|
Request-specific configuration.
|
|
132
126
|
|
|
@@ -143,7 +137,6 @@ class AsyncEnvironmentsClient:
|
|
|
143
137
|
|
|
144
138
|
client = AsyncAgentaApi(
|
|
145
139
|
api_key="YOUR_API_KEY",
|
|
146
|
-
base_url="https://yourhost.com/path/to/api",
|
|
147
140
|
)
|
|
148
141
|
|
|
149
142
|
|
|
@@ -156,39 +149,10 @@ class AsyncEnvironmentsClient:
|
|
|
156
149
|
|
|
157
150
|
asyncio.run(main())
|
|
158
151
|
"""
|
|
159
|
-
_response = await self.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"environment_name": environment_name,
|
|
164
|
-
"variant_id": variant_id,
|
|
165
|
-
},
|
|
166
|
-
headers={
|
|
167
|
-
"content-type": "application/json",
|
|
168
|
-
},
|
|
152
|
+
_response = await self._raw_client.deploy_to_environment(
|
|
153
|
+
environment_name=environment_name,
|
|
154
|
+
variant_id=variant_id,
|
|
155
|
+
commit_message=commit_message,
|
|
169
156
|
request_options=request_options,
|
|
170
|
-
omit=OMIT,
|
|
171
157
|
)
|
|
172
|
-
|
|
173
|
-
if 200 <= _response.status_code < 300:
|
|
174
|
-
return typing.cast(
|
|
175
|
-
typing.Optional[typing.Any],
|
|
176
|
-
parse_obj_as(
|
|
177
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
178
|
-
object_=_response.json(),
|
|
179
|
-
),
|
|
180
|
-
)
|
|
181
|
-
if _response.status_code == 422:
|
|
182
|
-
raise UnprocessableEntityError(
|
|
183
|
-
typing.cast(
|
|
184
|
-
HttpValidationError,
|
|
185
|
-
parse_obj_as(
|
|
186
|
-
type_=HttpValidationError, # type: ignore
|
|
187
|
-
object_=_response.json(),
|
|
188
|
-
),
|
|
189
|
-
)
|
|
190
|
-
)
|
|
191
|
-
_response_json = _response.json()
|
|
192
|
-
except JSONDecodeError:
|
|
193
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
194
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
158
|
+
return _response.data
|