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,1284 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from .. import core
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.test_set_simple_response import TestSetSimpleResponse
|
|
8
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
9
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
10
|
+
from ..types.http_validation_error import HttpValidationError
|
|
11
|
+
from json.decoder import JSONDecodeError
|
|
12
|
+
from ..core.api_error import ApiError
|
|
13
|
+
from ..types.test_set_output_response import TestSetOutputResponse
|
|
14
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
15
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
16
|
+
|
|
17
|
+
# this is used as the default value for optional parameters
|
|
18
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TestsetsClient:
|
|
22
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
23
|
+
self._client_wrapper = client_wrapper
|
|
24
|
+
|
|
25
|
+
def upload_file(
|
|
26
|
+
self,
|
|
27
|
+
*,
|
|
28
|
+
file: core.File,
|
|
29
|
+
upload_type: typing.Optional[str] = OMIT,
|
|
30
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
31
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
32
|
+
) -> TestSetSimpleResponse:
|
|
33
|
+
"""
|
|
34
|
+
Uploads a CSV or JSON file and saves its data to MongoDB.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
upload_type : Either a json or csv file.
|
|
38
|
+
file (UploadFile): The CSV or JSON file to upload.
|
|
39
|
+
testset_name (Optional): the name of the testset if provided.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
dict: The result of the upload process.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
file : core.File
|
|
47
|
+
See core.File for more documentation
|
|
48
|
+
|
|
49
|
+
upload_type : typing.Optional[str]
|
|
50
|
+
|
|
51
|
+
testset_name : typing.Optional[str]
|
|
52
|
+
|
|
53
|
+
request_options : typing.Optional[RequestOptions]
|
|
54
|
+
Request-specific configuration.
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
TestSetSimpleResponse
|
|
59
|
+
Successful Response
|
|
60
|
+
|
|
61
|
+
Examples
|
|
62
|
+
--------
|
|
63
|
+
from agenta import AgentaApi
|
|
64
|
+
|
|
65
|
+
client = AgentaApi(
|
|
66
|
+
api_key="YOUR_API_KEY",
|
|
67
|
+
base_url="https://yourhost.com/path/to/api",
|
|
68
|
+
)
|
|
69
|
+
client.testsets.upload_file()
|
|
70
|
+
"""
|
|
71
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
72
|
+
"testsets/upload",
|
|
73
|
+
method="POST",
|
|
74
|
+
data={
|
|
75
|
+
"upload_type": upload_type,
|
|
76
|
+
"testset_name": testset_name,
|
|
77
|
+
},
|
|
78
|
+
files={
|
|
79
|
+
"file": file,
|
|
80
|
+
},
|
|
81
|
+
request_options=request_options,
|
|
82
|
+
omit=OMIT,
|
|
83
|
+
)
|
|
84
|
+
try:
|
|
85
|
+
if 200 <= _response.status_code < 300:
|
|
86
|
+
return typing.cast(
|
|
87
|
+
TestSetSimpleResponse,
|
|
88
|
+
parse_obj_as(
|
|
89
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
90
|
+
object_=_response.json(),
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
if _response.status_code == 422:
|
|
94
|
+
raise UnprocessableEntityError(
|
|
95
|
+
typing.cast(
|
|
96
|
+
HttpValidationError,
|
|
97
|
+
parse_obj_as(
|
|
98
|
+
type_=HttpValidationError, # type: ignore
|
|
99
|
+
object_=_response.json(),
|
|
100
|
+
),
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
_response_json = _response.json()
|
|
104
|
+
except JSONDecodeError:
|
|
105
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
106
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
107
|
+
|
|
108
|
+
def import_testset(
|
|
109
|
+
self,
|
|
110
|
+
*,
|
|
111
|
+
endpoint: typing.Optional[str] = OMIT,
|
|
112
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
113
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
114
|
+
) -> TestSetSimpleResponse:
|
|
115
|
+
"""
|
|
116
|
+
Import JSON testset data from an endpoint and save it to MongoDB.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
endpoint (str): An endpoint URL to import data from.
|
|
120
|
+
testset_name (str): the name of the testset if provided.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
dict: The result of the import process.
|
|
124
|
+
|
|
125
|
+
Parameters
|
|
126
|
+
----------
|
|
127
|
+
endpoint : typing.Optional[str]
|
|
128
|
+
|
|
129
|
+
testset_name : typing.Optional[str]
|
|
130
|
+
|
|
131
|
+
request_options : typing.Optional[RequestOptions]
|
|
132
|
+
Request-specific configuration.
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
TestSetSimpleResponse
|
|
137
|
+
Successful Response
|
|
138
|
+
|
|
139
|
+
Examples
|
|
140
|
+
--------
|
|
141
|
+
from agenta import AgentaApi
|
|
142
|
+
|
|
143
|
+
client = AgentaApi(
|
|
144
|
+
api_key="YOUR_API_KEY",
|
|
145
|
+
base_url="https://yourhost.com/path/to/api",
|
|
146
|
+
)
|
|
147
|
+
client.testsets.import_testset()
|
|
148
|
+
"""
|
|
149
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
150
|
+
"testsets/endpoint",
|
|
151
|
+
method="POST",
|
|
152
|
+
json={
|
|
153
|
+
"endpoint": endpoint,
|
|
154
|
+
"testset_name": testset_name,
|
|
155
|
+
},
|
|
156
|
+
request_options=request_options,
|
|
157
|
+
omit=OMIT,
|
|
158
|
+
)
|
|
159
|
+
try:
|
|
160
|
+
if 200 <= _response.status_code < 300:
|
|
161
|
+
return typing.cast(
|
|
162
|
+
TestSetSimpleResponse,
|
|
163
|
+
parse_obj_as(
|
|
164
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
165
|
+
object_=_response.json(),
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
if _response.status_code == 422:
|
|
169
|
+
raise UnprocessableEntityError(
|
|
170
|
+
typing.cast(
|
|
171
|
+
HttpValidationError,
|
|
172
|
+
parse_obj_as(
|
|
173
|
+
type_=HttpValidationError, # type: ignore
|
|
174
|
+
object_=_response.json(),
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
_response_json = _response.json()
|
|
179
|
+
except JSONDecodeError:
|
|
180
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
181
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
182
|
+
|
|
183
|
+
def get_testsets(
|
|
184
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
185
|
+
) -> typing.List[TestSetOutputResponse]:
|
|
186
|
+
"""
|
|
187
|
+
Get all testsets.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
|
|
191
|
+
- A list of testset objects.
|
|
192
|
+
|
|
193
|
+
Raises:
|
|
194
|
+
|
|
195
|
+
- `HTTPException` with status code 404 if no testsets are found.
|
|
196
|
+
|
|
197
|
+
Parameters
|
|
198
|
+
----------
|
|
199
|
+
request_options : typing.Optional[RequestOptions]
|
|
200
|
+
Request-specific configuration.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
typing.List[TestSetOutputResponse]
|
|
205
|
+
Successful Response
|
|
206
|
+
|
|
207
|
+
Examples
|
|
208
|
+
--------
|
|
209
|
+
from agenta import AgentaApi
|
|
210
|
+
|
|
211
|
+
client = AgentaApi(
|
|
212
|
+
api_key="YOUR_API_KEY",
|
|
213
|
+
base_url="https://yourhost.com/path/to/api",
|
|
214
|
+
)
|
|
215
|
+
client.testsets.get_testsets()
|
|
216
|
+
"""
|
|
217
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
218
|
+
"testsets",
|
|
219
|
+
method="GET",
|
|
220
|
+
request_options=request_options,
|
|
221
|
+
)
|
|
222
|
+
try:
|
|
223
|
+
if 200 <= _response.status_code < 300:
|
|
224
|
+
return typing.cast(
|
|
225
|
+
typing.List[TestSetOutputResponse],
|
|
226
|
+
parse_obj_as(
|
|
227
|
+
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
228
|
+
object_=_response.json(),
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
_response_json = _response.json()
|
|
232
|
+
except JSONDecodeError:
|
|
233
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
234
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
235
|
+
|
|
236
|
+
def create_testset(
|
|
237
|
+
self,
|
|
238
|
+
*,
|
|
239
|
+
name: str,
|
|
240
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
241
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
242
|
+
) -> TestSetSimpleResponse:
|
|
243
|
+
"""
|
|
244
|
+
Create a testset with given name, save the testset to MongoDB.
|
|
245
|
+
|
|
246
|
+
Args:
|
|
247
|
+
name (str): name of the test set.
|
|
248
|
+
testset (Dict[str, str]): test set data.
|
|
249
|
+
|
|
250
|
+
Returns:
|
|
251
|
+
str: The id of the test set created.
|
|
252
|
+
|
|
253
|
+
Parameters
|
|
254
|
+
----------
|
|
255
|
+
name : str
|
|
256
|
+
|
|
257
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
258
|
+
|
|
259
|
+
request_options : typing.Optional[RequestOptions]
|
|
260
|
+
Request-specific configuration.
|
|
261
|
+
|
|
262
|
+
Returns
|
|
263
|
+
-------
|
|
264
|
+
TestSetSimpleResponse
|
|
265
|
+
Successful Response
|
|
266
|
+
|
|
267
|
+
Examples
|
|
268
|
+
--------
|
|
269
|
+
from agenta import AgentaApi
|
|
270
|
+
|
|
271
|
+
client = AgentaApi(
|
|
272
|
+
api_key="YOUR_API_KEY",
|
|
273
|
+
base_url="https://yourhost.com/path/to/api",
|
|
274
|
+
)
|
|
275
|
+
client.testsets.create_testset(
|
|
276
|
+
name="name",
|
|
277
|
+
csvdata=[{"key": "value"}],
|
|
278
|
+
)
|
|
279
|
+
"""
|
|
280
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
281
|
+
"testsets",
|
|
282
|
+
method="POST",
|
|
283
|
+
json={
|
|
284
|
+
"name": name,
|
|
285
|
+
"csvdata": csvdata,
|
|
286
|
+
},
|
|
287
|
+
request_options=request_options,
|
|
288
|
+
omit=OMIT,
|
|
289
|
+
)
|
|
290
|
+
try:
|
|
291
|
+
if 200 <= _response.status_code < 300:
|
|
292
|
+
return typing.cast(
|
|
293
|
+
TestSetSimpleResponse,
|
|
294
|
+
parse_obj_as(
|
|
295
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
296
|
+
object_=_response.json(),
|
|
297
|
+
),
|
|
298
|
+
)
|
|
299
|
+
if _response.status_code == 422:
|
|
300
|
+
raise UnprocessableEntityError(
|
|
301
|
+
typing.cast(
|
|
302
|
+
HttpValidationError,
|
|
303
|
+
parse_obj_as(
|
|
304
|
+
type_=HttpValidationError, # type: ignore
|
|
305
|
+
object_=_response.json(),
|
|
306
|
+
),
|
|
307
|
+
)
|
|
308
|
+
)
|
|
309
|
+
_response_json = _response.json()
|
|
310
|
+
except JSONDecodeError:
|
|
311
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
312
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
313
|
+
|
|
314
|
+
def delete_testsets(
|
|
315
|
+
self,
|
|
316
|
+
*,
|
|
317
|
+
testset_ids: typing.Sequence[str],
|
|
318
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
319
|
+
) -> typing.List[str]:
|
|
320
|
+
"""
|
|
321
|
+
Delete specific testsets based on their unique IDs.
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
testset_ids (List[str]): The unique identifiers of the testsets to delete.
|
|
325
|
+
|
|
326
|
+
Returns:
|
|
327
|
+
A list of the deleted testsets' IDs.
|
|
328
|
+
|
|
329
|
+
Parameters
|
|
330
|
+
----------
|
|
331
|
+
testset_ids : typing.Sequence[str]
|
|
332
|
+
|
|
333
|
+
request_options : typing.Optional[RequestOptions]
|
|
334
|
+
Request-specific configuration.
|
|
335
|
+
|
|
336
|
+
Returns
|
|
337
|
+
-------
|
|
338
|
+
typing.List[str]
|
|
339
|
+
Successful Response
|
|
340
|
+
|
|
341
|
+
Examples
|
|
342
|
+
--------
|
|
343
|
+
from agenta import AgentaApi
|
|
344
|
+
|
|
345
|
+
client = AgentaApi(
|
|
346
|
+
api_key="YOUR_API_KEY",
|
|
347
|
+
base_url="https://yourhost.com/path/to/api",
|
|
348
|
+
)
|
|
349
|
+
client.testsets.delete_testsets(
|
|
350
|
+
testset_ids=["testset_ids"],
|
|
351
|
+
)
|
|
352
|
+
"""
|
|
353
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
354
|
+
"testsets",
|
|
355
|
+
method="DELETE",
|
|
356
|
+
json={
|
|
357
|
+
"testset_ids": testset_ids,
|
|
358
|
+
},
|
|
359
|
+
headers={
|
|
360
|
+
"content-type": "application/json",
|
|
361
|
+
},
|
|
362
|
+
request_options=request_options,
|
|
363
|
+
omit=OMIT,
|
|
364
|
+
)
|
|
365
|
+
try:
|
|
366
|
+
if 200 <= _response.status_code < 300:
|
|
367
|
+
return typing.cast(
|
|
368
|
+
typing.List[str],
|
|
369
|
+
parse_obj_as(
|
|
370
|
+
type_=typing.List[str], # type: ignore
|
|
371
|
+
object_=_response.json(),
|
|
372
|
+
),
|
|
373
|
+
)
|
|
374
|
+
if _response.status_code == 422:
|
|
375
|
+
raise UnprocessableEntityError(
|
|
376
|
+
typing.cast(
|
|
377
|
+
HttpValidationError,
|
|
378
|
+
parse_obj_as(
|
|
379
|
+
type_=HttpValidationError, # type: ignore
|
|
380
|
+
object_=_response.json(),
|
|
381
|
+
),
|
|
382
|
+
)
|
|
383
|
+
)
|
|
384
|
+
_response_json = _response.json()
|
|
385
|
+
except JSONDecodeError:
|
|
386
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
387
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
388
|
+
|
|
389
|
+
def deprecating_create_testset(
|
|
390
|
+
self,
|
|
391
|
+
app_id: str,
|
|
392
|
+
*,
|
|
393
|
+
name: str,
|
|
394
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
395
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
396
|
+
) -> TestSetSimpleResponse:
|
|
397
|
+
"""
|
|
398
|
+
Create a testset with given name, save the testset to MongoDB.
|
|
399
|
+
|
|
400
|
+
Args:
|
|
401
|
+
name (str): name of the test set.
|
|
402
|
+
testset (Dict[str, str]): test set data.
|
|
403
|
+
|
|
404
|
+
Returns:
|
|
405
|
+
str: The id of the test set created.
|
|
406
|
+
|
|
407
|
+
Parameters
|
|
408
|
+
----------
|
|
409
|
+
app_id : str
|
|
410
|
+
|
|
411
|
+
name : str
|
|
412
|
+
|
|
413
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
414
|
+
|
|
415
|
+
request_options : typing.Optional[RequestOptions]
|
|
416
|
+
Request-specific configuration.
|
|
417
|
+
|
|
418
|
+
Returns
|
|
419
|
+
-------
|
|
420
|
+
TestSetSimpleResponse
|
|
421
|
+
Successful Response
|
|
422
|
+
|
|
423
|
+
Examples
|
|
424
|
+
--------
|
|
425
|
+
from agenta import AgentaApi
|
|
426
|
+
|
|
427
|
+
client = AgentaApi(
|
|
428
|
+
api_key="YOUR_API_KEY",
|
|
429
|
+
base_url="https://yourhost.com/path/to/api",
|
|
430
|
+
)
|
|
431
|
+
client.testsets.deprecating_create_testset(
|
|
432
|
+
app_id="app_id",
|
|
433
|
+
name="name",
|
|
434
|
+
csvdata=[{"key": "value"}],
|
|
435
|
+
)
|
|
436
|
+
"""
|
|
437
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
438
|
+
f"testsets/{jsonable_encoder(app_id)}",
|
|
439
|
+
method="POST",
|
|
440
|
+
json={
|
|
441
|
+
"name": name,
|
|
442
|
+
"csvdata": csvdata,
|
|
443
|
+
},
|
|
444
|
+
request_options=request_options,
|
|
445
|
+
omit=OMIT,
|
|
446
|
+
)
|
|
447
|
+
try:
|
|
448
|
+
if 200 <= _response.status_code < 300:
|
|
449
|
+
return typing.cast(
|
|
450
|
+
TestSetSimpleResponse,
|
|
451
|
+
parse_obj_as(
|
|
452
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
453
|
+
object_=_response.json(),
|
|
454
|
+
),
|
|
455
|
+
)
|
|
456
|
+
if _response.status_code == 422:
|
|
457
|
+
raise UnprocessableEntityError(
|
|
458
|
+
typing.cast(
|
|
459
|
+
HttpValidationError,
|
|
460
|
+
parse_obj_as(
|
|
461
|
+
type_=HttpValidationError, # type: ignore
|
|
462
|
+
object_=_response.json(),
|
|
463
|
+
),
|
|
464
|
+
)
|
|
465
|
+
)
|
|
466
|
+
_response_json = _response.json()
|
|
467
|
+
except JSONDecodeError:
|
|
468
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
469
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
470
|
+
|
|
471
|
+
def get_single_testset(
|
|
472
|
+
self,
|
|
473
|
+
testset_id: str,
|
|
474
|
+
*,
|
|
475
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
476
|
+
) -> typing.Optional[typing.Any]:
|
|
477
|
+
"""
|
|
478
|
+
Fetch a specific testset in a MongoDB collection using its \_id.
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
testset_id (str): The \_id of the testset to fetch.
|
|
482
|
+
|
|
483
|
+
Returns:
|
|
484
|
+
The requested testset if found, else an HTTPException.
|
|
485
|
+
|
|
486
|
+
Parameters
|
|
487
|
+
----------
|
|
488
|
+
testset_id : str
|
|
489
|
+
|
|
490
|
+
request_options : typing.Optional[RequestOptions]
|
|
491
|
+
Request-specific configuration.
|
|
492
|
+
|
|
493
|
+
Returns
|
|
494
|
+
-------
|
|
495
|
+
typing.Optional[typing.Any]
|
|
496
|
+
Successful Response
|
|
497
|
+
|
|
498
|
+
Examples
|
|
499
|
+
--------
|
|
500
|
+
from agenta import AgentaApi
|
|
501
|
+
|
|
502
|
+
client = AgentaApi(
|
|
503
|
+
api_key="YOUR_API_KEY",
|
|
504
|
+
base_url="https://yourhost.com/path/to/api",
|
|
505
|
+
)
|
|
506
|
+
client.testsets.get_single_testset(
|
|
507
|
+
testset_id="testset_id",
|
|
508
|
+
)
|
|
509
|
+
"""
|
|
510
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
511
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
512
|
+
method="GET",
|
|
513
|
+
request_options=request_options,
|
|
514
|
+
)
|
|
515
|
+
try:
|
|
516
|
+
if 200 <= _response.status_code < 300:
|
|
517
|
+
return typing.cast(
|
|
518
|
+
typing.Optional[typing.Any],
|
|
519
|
+
parse_obj_as(
|
|
520
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
521
|
+
object_=_response.json(),
|
|
522
|
+
),
|
|
523
|
+
)
|
|
524
|
+
if _response.status_code == 422:
|
|
525
|
+
raise UnprocessableEntityError(
|
|
526
|
+
typing.cast(
|
|
527
|
+
HttpValidationError,
|
|
528
|
+
parse_obj_as(
|
|
529
|
+
type_=HttpValidationError, # type: ignore
|
|
530
|
+
object_=_response.json(),
|
|
531
|
+
),
|
|
532
|
+
)
|
|
533
|
+
)
|
|
534
|
+
_response_json = _response.json()
|
|
535
|
+
except JSONDecodeError:
|
|
536
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
537
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
538
|
+
|
|
539
|
+
def update_testset(
|
|
540
|
+
self,
|
|
541
|
+
testset_id: str,
|
|
542
|
+
*,
|
|
543
|
+
name: str,
|
|
544
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
545
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
546
|
+
) -> typing.Optional[typing.Any]:
|
|
547
|
+
"""
|
|
548
|
+
Update a testset with given id, update the testset in MongoDB.
|
|
549
|
+
|
|
550
|
+
Args:
|
|
551
|
+
testset_id (str): id of the test set to be updated.
|
|
552
|
+
csvdata (NewTestset): New data to replace the old testset.
|
|
553
|
+
|
|
554
|
+
Returns:
|
|
555
|
+
str: The id of the test set updated.
|
|
556
|
+
|
|
557
|
+
Parameters
|
|
558
|
+
----------
|
|
559
|
+
testset_id : str
|
|
560
|
+
|
|
561
|
+
name : str
|
|
562
|
+
|
|
563
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
564
|
+
|
|
565
|
+
request_options : typing.Optional[RequestOptions]
|
|
566
|
+
Request-specific configuration.
|
|
567
|
+
|
|
568
|
+
Returns
|
|
569
|
+
-------
|
|
570
|
+
typing.Optional[typing.Any]
|
|
571
|
+
Successful Response
|
|
572
|
+
|
|
573
|
+
Examples
|
|
574
|
+
--------
|
|
575
|
+
from agenta import AgentaApi
|
|
576
|
+
|
|
577
|
+
client = AgentaApi(
|
|
578
|
+
api_key="YOUR_API_KEY",
|
|
579
|
+
base_url="https://yourhost.com/path/to/api",
|
|
580
|
+
)
|
|
581
|
+
client.testsets.update_testset(
|
|
582
|
+
testset_id="testset_id",
|
|
583
|
+
name="name",
|
|
584
|
+
csvdata=[{"key": "value"}],
|
|
585
|
+
)
|
|
586
|
+
"""
|
|
587
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
588
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
589
|
+
method="PUT",
|
|
590
|
+
json={
|
|
591
|
+
"name": name,
|
|
592
|
+
"csvdata": csvdata,
|
|
593
|
+
},
|
|
594
|
+
request_options=request_options,
|
|
595
|
+
omit=OMIT,
|
|
596
|
+
)
|
|
597
|
+
try:
|
|
598
|
+
if 200 <= _response.status_code < 300:
|
|
599
|
+
return typing.cast(
|
|
600
|
+
typing.Optional[typing.Any],
|
|
601
|
+
parse_obj_as(
|
|
602
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
603
|
+
object_=_response.json(),
|
|
604
|
+
),
|
|
605
|
+
)
|
|
606
|
+
if _response.status_code == 422:
|
|
607
|
+
raise UnprocessableEntityError(
|
|
608
|
+
typing.cast(
|
|
609
|
+
HttpValidationError,
|
|
610
|
+
parse_obj_as(
|
|
611
|
+
type_=HttpValidationError, # type: ignore
|
|
612
|
+
object_=_response.json(),
|
|
613
|
+
),
|
|
614
|
+
)
|
|
615
|
+
)
|
|
616
|
+
_response_json = _response.json()
|
|
617
|
+
except JSONDecodeError:
|
|
618
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
619
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
class AsyncTestsetsClient:
|
|
623
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
624
|
+
self._client_wrapper = client_wrapper
|
|
625
|
+
|
|
626
|
+
async def upload_file(
|
|
627
|
+
self,
|
|
628
|
+
*,
|
|
629
|
+
file: core.File,
|
|
630
|
+
upload_type: typing.Optional[str] = OMIT,
|
|
631
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
632
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
633
|
+
) -> TestSetSimpleResponse:
|
|
634
|
+
"""
|
|
635
|
+
Uploads a CSV or JSON file and saves its data to MongoDB.
|
|
636
|
+
|
|
637
|
+
Args:
|
|
638
|
+
upload_type : Either a json or csv file.
|
|
639
|
+
file (UploadFile): The CSV or JSON file to upload.
|
|
640
|
+
testset_name (Optional): the name of the testset if provided.
|
|
641
|
+
|
|
642
|
+
Returns:
|
|
643
|
+
dict: The result of the upload process.
|
|
644
|
+
|
|
645
|
+
Parameters
|
|
646
|
+
----------
|
|
647
|
+
file : core.File
|
|
648
|
+
See core.File for more documentation
|
|
649
|
+
|
|
650
|
+
upload_type : typing.Optional[str]
|
|
651
|
+
|
|
652
|
+
testset_name : typing.Optional[str]
|
|
653
|
+
|
|
654
|
+
request_options : typing.Optional[RequestOptions]
|
|
655
|
+
Request-specific configuration.
|
|
656
|
+
|
|
657
|
+
Returns
|
|
658
|
+
-------
|
|
659
|
+
TestSetSimpleResponse
|
|
660
|
+
Successful Response
|
|
661
|
+
|
|
662
|
+
Examples
|
|
663
|
+
--------
|
|
664
|
+
import asyncio
|
|
665
|
+
|
|
666
|
+
from agenta import AsyncAgentaApi
|
|
667
|
+
|
|
668
|
+
client = AsyncAgentaApi(
|
|
669
|
+
api_key="YOUR_API_KEY",
|
|
670
|
+
base_url="https://yourhost.com/path/to/api",
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
async def main() -> None:
|
|
675
|
+
await client.testsets.upload_file()
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
asyncio.run(main())
|
|
679
|
+
"""
|
|
680
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
681
|
+
"testsets/upload",
|
|
682
|
+
method="POST",
|
|
683
|
+
data={
|
|
684
|
+
"upload_type": upload_type,
|
|
685
|
+
"testset_name": testset_name,
|
|
686
|
+
},
|
|
687
|
+
files={
|
|
688
|
+
"file": file,
|
|
689
|
+
},
|
|
690
|
+
request_options=request_options,
|
|
691
|
+
omit=OMIT,
|
|
692
|
+
)
|
|
693
|
+
try:
|
|
694
|
+
if 200 <= _response.status_code < 300:
|
|
695
|
+
return typing.cast(
|
|
696
|
+
TestSetSimpleResponse,
|
|
697
|
+
parse_obj_as(
|
|
698
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
699
|
+
object_=_response.json(),
|
|
700
|
+
),
|
|
701
|
+
)
|
|
702
|
+
if _response.status_code == 422:
|
|
703
|
+
raise UnprocessableEntityError(
|
|
704
|
+
typing.cast(
|
|
705
|
+
HttpValidationError,
|
|
706
|
+
parse_obj_as(
|
|
707
|
+
type_=HttpValidationError, # type: ignore
|
|
708
|
+
object_=_response.json(),
|
|
709
|
+
),
|
|
710
|
+
)
|
|
711
|
+
)
|
|
712
|
+
_response_json = _response.json()
|
|
713
|
+
except JSONDecodeError:
|
|
714
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
715
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
716
|
+
|
|
717
|
+
async def import_testset(
|
|
718
|
+
self,
|
|
719
|
+
*,
|
|
720
|
+
endpoint: typing.Optional[str] = OMIT,
|
|
721
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
722
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
723
|
+
) -> TestSetSimpleResponse:
|
|
724
|
+
"""
|
|
725
|
+
Import JSON testset data from an endpoint and save it to MongoDB.
|
|
726
|
+
|
|
727
|
+
Args:
|
|
728
|
+
endpoint (str): An endpoint URL to import data from.
|
|
729
|
+
testset_name (str): the name of the testset if provided.
|
|
730
|
+
|
|
731
|
+
Returns:
|
|
732
|
+
dict: The result of the import process.
|
|
733
|
+
|
|
734
|
+
Parameters
|
|
735
|
+
----------
|
|
736
|
+
endpoint : typing.Optional[str]
|
|
737
|
+
|
|
738
|
+
testset_name : typing.Optional[str]
|
|
739
|
+
|
|
740
|
+
request_options : typing.Optional[RequestOptions]
|
|
741
|
+
Request-specific configuration.
|
|
742
|
+
|
|
743
|
+
Returns
|
|
744
|
+
-------
|
|
745
|
+
TestSetSimpleResponse
|
|
746
|
+
Successful Response
|
|
747
|
+
|
|
748
|
+
Examples
|
|
749
|
+
--------
|
|
750
|
+
import asyncio
|
|
751
|
+
|
|
752
|
+
from agenta import AsyncAgentaApi
|
|
753
|
+
|
|
754
|
+
client = AsyncAgentaApi(
|
|
755
|
+
api_key="YOUR_API_KEY",
|
|
756
|
+
base_url="https://yourhost.com/path/to/api",
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
async def main() -> None:
|
|
761
|
+
await client.testsets.import_testset()
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
asyncio.run(main())
|
|
765
|
+
"""
|
|
766
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
767
|
+
"testsets/endpoint",
|
|
768
|
+
method="POST",
|
|
769
|
+
json={
|
|
770
|
+
"endpoint": endpoint,
|
|
771
|
+
"testset_name": testset_name,
|
|
772
|
+
},
|
|
773
|
+
request_options=request_options,
|
|
774
|
+
omit=OMIT,
|
|
775
|
+
)
|
|
776
|
+
try:
|
|
777
|
+
if 200 <= _response.status_code < 300:
|
|
778
|
+
return typing.cast(
|
|
779
|
+
TestSetSimpleResponse,
|
|
780
|
+
parse_obj_as(
|
|
781
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
782
|
+
object_=_response.json(),
|
|
783
|
+
),
|
|
784
|
+
)
|
|
785
|
+
if _response.status_code == 422:
|
|
786
|
+
raise UnprocessableEntityError(
|
|
787
|
+
typing.cast(
|
|
788
|
+
HttpValidationError,
|
|
789
|
+
parse_obj_as(
|
|
790
|
+
type_=HttpValidationError, # type: ignore
|
|
791
|
+
object_=_response.json(),
|
|
792
|
+
),
|
|
793
|
+
)
|
|
794
|
+
)
|
|
795
|
+
_response_json = _response.json()
|
|
796
|
+
except JSONDecodeError:
|
|
797
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
798
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
799
|
+
|
|
800
|
+
async def get_testsets(
|
|
801
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
802
|
+
) -> typing.List[TestSetOutputResponse]:
|
|
803
|
+
"""
|
|
804
|
+
Get all testsets.
|
|
805
|
+
|
|
806
|
+
Returns:
|
|
807
|
+
|
|
808
|
+
- A list of testset objects.
|
|
809
|
+
|
|
810
|
+
Raises:
|
|
811
|
+
|
|
812
|
+
- `HTTPException` with status code 404 if no testsets are found.
|
|
813
|
+
|
|
814
|
+
Parameters
|
|
815
|
+
----------
|
|
816
|
+
request_options : typing.Optional[RequestOptions]
|
|
817
|
+
Request-specific configuration.
|
|
818
|
+
|
|
819
|
+
Returns
|
|
820
|
+
-------
|
|
821
|
+
typing.List[TestSetOutputResponse]
|
|
822
|
+
Successful Response
|
|
823
|
+
|
|
824
|
+
Examples
|
|
825
|
+
--------
|
|
826
|
+
import asyncio
|
|
827
|
+
|
|
828
|
+
from agenta import AsyncAgentaApi
|
|
829
|
+
|
|
830
|
+
client = AsyncAgentaApi(
|
|
831
|
+
api_key="YOUR_API_KEY",
|
|
832
|
+
base_url="https://yourhost.com/path/to/api",
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
async def main() -> None:
|
|
837
|
+
await client.testsets.get_testsets()
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
asyncio.run(main())
|
|
841
|
+
"""
|
|
842
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
843
|
+
"testsets",
|
|
844
|
+
method="GET",
|
|
845
|
+
request_options=request_options,
|
|
846
|
+
)
|
|
847
|
+
try:
|
|
848
|
+
if 200 <= _response.status_code < 300:
|
|
849
|
+
return typing.cast(
|
|
850
|
+
typing.List[TestSetOutputResponse],
|
|
851
|
+
parse_obj_as(
|
|
852
|
+
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
853
|
+
object_=_response.json(),
|
|
854
|
+
),
|
|
855
|
+
)
|
|
856
|
+
_response_json = _response.json()
|
|
857
|
+
except JSONDecodeError:
|
|
858
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
859
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
860
|
+
|
|
861
|
+
async def create_testset(
|
|
862
|
+
self,
|
|
863
|
+
*,
|
|
864
|
+
name: str,
|
|
865
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
866
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
867
|
+
) -> TestSetSimpleResponse:
|
|
868
|
+
"""
|
|
869
|
+
Create a testset with given name, save the testset to MongoDB.
|
|
870
|
+
|
|
871
|
+
Args:
|
|
872
|
+
name (str): name of the test set.
|
|
873
|
+
testset (Dict[str, str]): test set data.
|
|
874
|
+
|
|
875
|
+
Returns:
|
|
876
|
+
str: The id of the test set created.
|
|
877
|
+
|
|
878
|
+
Parameters
|
|
879
|
+
----------
|
|
880
|
+
name : str
|
|
881
|
+
|
|
882
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
883
|
+
|
|
884
|
+
request_options : typing.Optional[RequestOptions]
|
|
885
|
+
Request-specific configuration.
|
|
886
|
+
|
|
887
|
+
Returns
|
|
888
|
+
-------
|
|
889
|
+
TestSetSimpleResponse
|
|
890
|
+
Successful Response
|
|
891
|
+
|
|
892
|
+
Examples
|
|
893
|
+
--------
|
|
894
|
+
import asyncio
|
|
895
|
+
|
|
896
|
+
from agenta import AsyncAgentaApi
|
|
897
|
+
|
|
898
|
+
client = AsyncAgentaApi(
|
|
899
|
+
api_key="YOUR_API_KEY",
|
|
900
|
+
base_url="https://yourhost.com/path/to/api",
|
|
901
|
+
)
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
async def main() -> None:
|
|
905
|
+
await client.testsets.create_testset(
|
|
906
|
+
name="name",
|
|
907
|
+
csvdata=[{"key": "value"}],
|
|
908
|
+
)
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
asyncio.run(main())
|
|
912
|
+
"""
|
|
913
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
914
|
+
"testsets",
|
|
915
|
+
method="POST",
|
|
916
|
+
json={
|
|
917
|
+
"name": name,
|
|
918
|
+
"csvdata": csvdata,
|
|
919
|
+
},
|
|
920
|
+
request_options=request_options,
|
|
921
|
+
omit=OMIT,
|
|
922
|
+
)
|
|
923
|
+
try:
|
|
924
|
+
if 200 <= _response.status_code < 300:
|
|
925
|
+
return typing.cast(
|
|
926
|
+
TestSetSimpleResponse,
|
|
927
|
+
parse_obj_as(
|
|
928
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
929
|
+
object_=_response.json(),
|
|
930
|
+
),
|
|
931
|
+
)
|
|
932
|
+
if _response.status_code == 422:
|
|
933
|
+
raise UnprocessableEntityError(
|
|
934
|
+
typing.cast(
|
|
935
|
+
HttpValidationError,
|
|
936
|
+
parse_obj_as(
|
|
937
|
+
type_=HttpValidationError, # type: ignore
|
|
938
|
+
object_=_response.json(),
|
|
939
|
+
),
|
|
940
|
+
)
|
|
941
|
+
)
|
|
942
|
+
_response_json = _response.json()
|
|
943
|
+
except JSONDecodeError:
|
|
944
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
945
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
946
|
+
|
|
947
|
+
async def delete_testsets(
|
|
948
|
+
self,
|
|
949
|
+
*,
|
|
950
|
+
testset_ids: typing.Sequence[str],
|
|
951
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
952
|
+
) -> typing.List[str]:
|
|
953
|
+
"""
|
|
954
|
+
Delete specific testsets based on their unique IDs.
|
|
955
|
+
|
|
956
|
+
Args:
|
|
957
|
+
testset_ids (List[str]): The unique identifiers of the testsets to delete.
|
|
958
|
+
|
|
959
|
+
Returns:
|
|
960
|
+
A list of the deleted testsets' IDs.
|
|
961
|
+
|
|
962
|
+
Parameters
|
|
963
|
+
----------
|
|
964
|
+
testset_ids : typing.Sequence[str]
|
|
965
|
+
|
|
966
|
+
request_options : typing.Optional[RequestOptions]
|
|
967
|
+
Request-specific configuration.
|
|
968
|
+
|
|
969
|
+
Returns
|
|
970
|
+
-------
|
|
971
|
+
typing.List[str]
|
|
972
|
+
Successful Response
|
|
973
|
+
|
|
974
|
+
Examples
|
|
975
|
+
--------
|
|
976
|
+
import asyncio
|
|
977
|
+
|
|
978
|
+
from agenta import AsyncAgentaApi
|
|
979
|
+
|
|
980
|
+
client = AsyncAgentaApi(
|
|
981
|
+
api_key="YOUR_API_KEY",
|
|
982
|
+
base_url="https://yourhost.com/path/to/api",
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
async def main() -> None:
|
|
987
|
+
await client.testsets.delete_testsets(
|
|
988
|
+
testset_ids=["testset_ids"],
|
|
989
|
+
)
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
asyncio.run(main())
|
|
993
|
+
"""
|
|
994
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
995
|
+
"testsets",
|
|
996
|
+
method="DELETE",
|
|
997
|
+
json={
|
|
998
|
+
"testset_ids": testset_ids,
|
|
999
|
+
},
|
|
1000
|
+
headers={
|
|
1001
|
+
"content-type": "application/json",
|
|
1002
|
+
},
|
|
1003
|
+
request_options=request_options,
|
|
1004
|
+
omit=OMIT,
|
|
1005
|
+
)
|
|
1006
|
+
try:
|
|
1007
|
+
if 200 <= _response.status_code < 300:
|
|
1008
|
+
return typing.cast(
|
|
1009
|
+
typing.List[str],
|
|
1010
|
+
parse_obj_as(
|
|
1011
|
+
type_=typing.List[str], # type: ignore
|
|
1012
|
+
object_=_response.json(),
|
|
1013
|
+
),
|
|
1014
|
+
)
|
|
1015
|
+
if _response.status_code == 422:
|
|
1016
|
+
raise UnprocessableEntityError(
|
|
1017
|
+
typing.cast(
|
|
1018
|
+
HttpValidationError,
|
|
1019
|
+
parse_obj_as(
|
|
1020
|
+
type_=HttpValidationError, # type: ignore
|
|
1021
|
+
object_=_response.json(),
|
|
1022
|
+
),
|
|
1023
|
+
)
|
|
1024
|
+
)
|
|
1025
|
+
_response_json = _response.json()
|
|
1026
|
+
except JSONDecodeError:
|
|
1027
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1028
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1029
|
+
|
|
1030
|
+
async def deprecating_create_testset(
|
|
1031
|
+
self,
|
|
1032
|
+
app_id: str,
|
|
1033
|
+
*,
|
|
1034
|
+
name: str,
|
|
1035
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
1036
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1037
|
+
) -> TestSetSimpleResponse:
|
|
1038
|
+
"""
|
|
1039
|
+
Create a testset with given name, save the testset to MongoDB.
|
|
1040
|
+
|
|
1041
|
+
Args:
|
|
1042
|
+
name (str): name of the test set.
|
|
1043
|
+
testset (Dict[str, str]): test set data.
|
|
1044
|
+
|
|
1045
|
+
Returns:
|
|
1046
|
+
str: The id of the test set created.
|
|
1047
|
+
|
|
1048
|
+
Parameters
|
|
1049
|
+
----------
|
|
1050
|
+
app_id : str
|
|
1051
|
+
|
|
1052
|
+
name : str
|
|
1053
|
+
|
|
1054
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1055
|
+
|
|
1056
|
+
request_options : typing.Optional[RequestOptions]
|
|
1057
|
+
Request-specific configuration.
|
|
1058
|
+
|
|
1059
|
+
Returns
|
|
1060
|
+
-------
|
|
1061
|
+
TestSetSimpleResponse
|
|
1062
|
+
Successful Response
|
|
1063
|
+
|
|
1064
|
+
Examples
|
|
1065
|
+
--------
|
|
1066
|
+
import asyncio
|
|
1067
|
+
|
|
1068
|
+
from agenta import AsyncAgentaApi
|
|
1069
|
+
|
|
1070
|
+
client = AsyncAgentaApi(
|
|
1071
|
+
api_key="YOUR_API_KEY",
|
|
1072
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1073
|
+
)
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
async def main() -> None:
|
|
1077
|
+
await client.testsets.deprecating_create_testset(
|
|
1078
|
+
app_id="app_id",
|
|
1079
|
+
name="name",
|
|
1080
|
+
csvdata=[{"key": "value"}],
|
|
1081
|
+
)
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
asyncio.run(main())
|
|
1085
|
+
"""
|
|
1086
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1087
|
+
f"testsets/{jsonable_encoder(app_id)}",
|
|
1088
|
+
method="POST",
|
|
1089
|
+
json={
|
|
1090
|
+
"name": name,
|
|
1091
|
+
"csvdata": csvdata,
|
|
1092
|
+
},
|
|
1093
|
+
request_options=request_options,
|
|
1094
|
+
omit=OMIT,
|
|
1095
|
+
)
|
|
1096
|
+
try:
|
|
1097
|
+
if 200 <= _response.status_code < 300:
|
|
1098
|
+
return typing.cast(
|
|
1099
|
+
TestSetSimpleResponse,
|
|
1100
|
+
parse_obj_as(
|
|
1101
|
+
type_=TestSetSimpleResponse, # type: ignore
|
|
1102
|
+
object_=_response.json(),
|
|
1103
|
+
),
|
|
1104
|
+
)
|
|
1105
|
+
if _response.status_code == 422:
|
|
1106
|
+
raise UnprocessableEntityError(
|
|
1107
|
+
typing.cast(
|
|
1108
|
+
HttpValidationError,
|
|
1109
|
+
parse_obj_as(
|
|
1110
|
+
type_=HttpValidationError, # type: ignore
|
|
1111
|
+
object_=_response.json(),
|
|
1112
|
+
),
|
|
1113
|
+
)
|
|
1114
|
+
)
|
|
1115
|
+
_response_json = _response.json()
|
|
1116
|
+
except JSONDecodeError:
|
|
1117
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1118
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1119
|
+
|
|
1120
|
+
async def get_single_testset(
|
|
1121
|
+
self,
|
|
1122
|
+
testset_id: str,
|
|
1123
|
+
*,
|
|
1124
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1125
|
+
) -> typing.Optional[typing.Any]:
|
|
1126
|
+
"""
|
|
1127
|
+
Fetch a specific testset in a MongoDB collection using its \_id.
|
|
1128
|
+
|
|
1129
|
+
Args:
|
|
1130
|
+
testset_id (str): The \_id of the testset to fetch.
|
|
1131
|
+
|
|
1132
|
+
Returns:
|
|
1133
|
+
The requested testset if found, else an HTTPException.
|
|
1134
|
+
|
|
1135
|
+
Parameters
|
|
1136
|
+
----------
|
|
1137
|
+
testset_id : str
|
|
1138
|
+
|
|
1139
|
+
request_options : typing.Optional[RequestOptions]
|
|
1140
|
+
Request-specific configuration.
|
|
1141
|
+
|
|
1142
|
+
Returns
|
|
1143
|
+
-------
|
|
1144
|
+
typing.Optional[typing.Any]
|
|
1145
|
+
Successful Response
|
|
1146
|
+
|
|
1147
|
+
Examples
|
|
1148
|
+
--------
|
|
1149
|
+
import asyncio
|
|
1150
|
+
|
|
1151
|
+
from agenta import AsyncAgentaApi
|
|
1152
|
+
|
|
1153
|
+
client = AsyncAgentaApi(
|
|
1154
|
+
api_key="YOUR_API_KEY",
|
|
1155
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1156
|
+
)
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
async def main() -> None:
|
|
1160
|
+
await client.testsets.get_single_testset(
|
|
1161
|
+
testset_id="testset_id",
|
|
1162
|
+
)
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
asyncio.run(main())
|
|
1166
|
+
"""
|
|
1167
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1168
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
1169
|
+
method="GET",
|
|
1170
|
+
request_options=request_options,
|
|
1171
|
+
)
|
|
1172
|
+
try:
|
|
1173
|
+
if 200 <= _response.status_code < 300:
|
|
1174
|
+
return typing.cast(
|
|
1175
|
+
typing.Optional[typing.Any],
|
|
1176
|
+
parse_obj_as(
|
|
1177
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1178
|
+
object_=_response.json(),
|
|
1179
|
+
),
|
|
1180
|
+
)
|
|
1181
|
+
if _response.status_code == 422:
|
|
1182
|
+
raise UnprocessableEntityError(
|
|
1183
|
+
typing.cast(
|
|
1184
|
+
HttpValidationError,
|
|
1185
|
+
parse_obj_as(
|
|
1186
|
+
type_=HttpValidationError, # type: ignore
|
|
1187
|
+
object_=_response.json(),
|
|
1188
|
+
),
|
|
1189
|
+
)
|
|
1190
|
+
)
|
|
1191
|
+
_response_json = _response.json()
|
|
1192
|
+
except JSONDecodeError:
|
|
1193
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1194
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1195
|
+
|
|
1196
|
+
async def update_testset(
|
|
1197
|
+
self,
|
|
1198
|
+
testset_id: str,
|
|
1199
|
+
*,
|
|
1200
|
+
name: str,
|
|
1201
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
1202
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1203
|
+
) -> typing.Optional[typing.Any]:
|
|
1204
|
+
"""
|
|
1205
|
+
Update a testset with given id, update the testset in MongoDB.
|
|
1206
|
+
|
|
1207
|
+
Args:
|
|
1208
|
+
testset_id (str): id of the test set to be updated.
|
|
1209
|
+
csvdata (NewTestset): New data to replace the old testset.
|
|
1210
|
+
|
|
1211
|
+
Returns:
|
|
1212
|
+
str: The id of the test set updated.
|
|
1213
|
+
|
|
1214
|
+
Parameters
|
|
1215
|
+
----------
|
|
1216
|
+
testset_id : str
|
|
1217
|
+
|
|
1218
|
+
name : str
|
|
1219
|
+
|
|
1220
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1221
|
+
|
|
1222
|
+
request_options : typing.Optional[RequestOptions]
|
|
1223
|
+
Request-specific configuration.
|
|
1224
|
+
|
|
1225
|
+
Returns
|
|
1226
|
+
-------
|
|
1227
|
+
typing.Optional[typing.Any]
|
|
1228
|
+
Successful Response
|
|
1229
|
+
|
|
1230
|
+
Examples
|
|
1231
|
+
--------
|
|
1232
|
+
import asyncio
|
|
1233
|
+
|
|
1234
|
+
from agenta import AsyncAgentaApi
|
|
1235
|
+
|
|
1236
|
+
client = AsyncAgentaApi(
|
|
1237
|
+
api_key="YOUR_API_KEY",
|
|
1238
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1239
|
+
)
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
async def main() -> None:
|
|
1243
|
+
await client.testsets.update_testset(
|
|
1244
|
+
testset_id="testset_id",
|
|
1245
|
+
name="name",
|
|
1246
|
+
csvdata=[{"key": "value"}],
|
|
1247
|
+
)
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
asyncio.run(main())
|
|
1251
|
+
"""
|
|
1252
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1253
|
+
f"testsets/{jsonable_encoder(testset_id)}",
|
|
1254
|
+
method="PUT",
|
|
1255
|
+
json={
|
|
1256
|
+
"name": name,
|
|
1257
|
+
"csvdata": csvdata,
|
|
1258
|
+
},
|
|
1259
|
+
request_options=request_options,
|
|
1260
|
+
omit=OMIT,
|
|
1261
|
+
)
|
|
1262
|
+
try:
|
|
1263
|
+
if 200 <= _response.status_code < 300:
|
|
1264
|
+
return typing.cast(
|
|
1265
|
+
typing.Optional[typing.Any],
|
|
1266
|
+
parse_obj_as(
|
|
1267
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1268
|
+
object_=_response.json(),
|
|
1269
|
+
),
|
|
1270
|
+
)
|
|
1271
|
+
if _response.status_code == 422:
|
|
1272
|
+
raise UnprocessableEntityError(
|
|
1273
|
+
typing.cast(
|
|
1274
|
+
HttpValidationError,
|
|
1275
|
+
parse_obj_as(
|
|
1276
|
+
type_=HttpValidationError, # type: ignore
|
|
1277
|
+
object_=_response.json(),
|
|
1278
|
+
),
|
|
1279
|
+
)
|
|
1280
|
+
)
|
|
1281
|
+
_response_json = _response.json()
|
|
1282
|
+
except JSONDecodeError:
|
|
1283
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1284
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|