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
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
from .. import core
|
|
6
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
7
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.
|
|
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
|
|
8
|
+
from ..types.meta_request import MetaRequest
|
|
13
9
|
from ..types.test_set_output_response import TestSetOutputResponse
|
|
14
|
-
from ..
|
|
15
|
-
from ..
|
|
10
|
+
from ..types.test_set_simple_response import TestSetSimpleResponse
|
|
11
|
+
from ..types.testcase_response import TestcaseResponse
|
|
12
|
+
from ..types.testset import Testset
|
|
13
|
+
from ..types.testset_response import TestsetResponse
|
|
14
|
+
from ..types.testsets_response import TestsetsResponse
|
|
15
|
+
from .raw_client import AsyncRawTestsetsClient, RawTestsetsClient
|
|
16
|
+
from .types.create_testset_from_file_request_file_type import (
|
|
17
|
+
CreateTestsetFromFileRequestFileType,
|
|
18
|
+
)
|
|
19
|
+
from .types.fetch_testset_to_file_request_file_type import (
|
|
20
|
+
FetchTestsetToFileRequestFileType,
|
|
21
|
+
)
|
|
22
|
+
from .types.update_testset_from_file_request_file_type import (
|
|
23
|
+
UpdateTestsetFromFileRequestFileType,
|
|
24
|
+
)
|
|
16
25
|
|
|
17
26
|
# this is used as the default value for optional parameters
|
|
18
27
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -20,7 +29,18 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
20
29
|
|
|
21
30
|
class TestsetsClient:
|
|
22
31
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
23
|
-
self.
|
|
32
|
+
self._raw_client = RawTestsetsClient(client_wrapper=client_wrapper)
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def with_raw_response(self) -> RawTestsetsClient:
|
|
36
|
+
"""
|
|
37
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
RawTestsetsClient
|
|
42
|
+
"""
|
|
43
|
+
return self._raw_client
|
|
24
44
|
|
|
25
45
|
def upload_file(
|
|
26
46
|
self,
|
|
@@ -64,46 +84,16 @@ class TestsetsClient:
|
|
|
64
84
|
|
|
65
85
|
client = AgentaApi(
|
|
66
86
|
api_key="YOUR_API_KEY",
|
|
67
|
-
base_url="https://yourhost.com/path/to/api",
|
|
68
87
|
)
|
|
69
88
|
client.testsets.upload_file()
|
|
70
89
|
"""
|
|
71
|
-
_response = self.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"upload_type": upload_type,
|
|
76
|
-
"testset_name": testset_name,
|
|
77
|
-
},
|
|
78
|
-
files={
|
|
79
|
-
"file": file,
|
|
80
|
-
},
|
|
90
|
+
_response = self._raw_client.upload_file(
|
|
91
|
+
file=file,
|
|
92
|
+
upload_type=upload_type,
|
|
93
|
+
testset_name=testset_name,
|
|
81
94
|
request_options=request_options,
|
|
82
|
-
|
|
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)
|
|
95
|
+
)
|
|
96
|
+
return _response.data
|
|
107
97
|
|
|
108
98
|
def import_testset(
|
|
109
99
|
self,
|
|
@@ -145,46 +135,16 @@ class TestsetsClient:
|
|
|
145
135
|
|
|
146
136
|
client = AgentaApi(
|
|
147
137
|
api_key="YOUR_API_KEY",
|
|
148
|
-
base_url="https://yourhost.com/path/to/api",
|
|
149
138
|
)
|
|
150
139
|
client.testsets.import_testset()
|
|
151
140
|
"""
|
|
152
|
-
_response = self.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"authorization": authorization,
|
|
157
|
-
},
|
|
158
|
-
json={
|
|
159
|
-
"endpoint": endpoint,
|
|
160
|
-
"testset_name": testset_name,
|
|
161
|
-
},
|
|
141
|
+
_response = self._raw_client.import_testset(
|
|
142
|
+
authorization=authorization,
|
|
143
|
+
endpoint=endpoint,
|
|
144
|
+
testset_name=testset_name,
|
|
162
145
|
request_options=request_options,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
try:
|
|
166
|
-
if 200 <= _response.status_code < 300:
|
|
167
|
-
return typing.cast(
|
|
168
|
-
TestSetSimpleResponse,
|
|
169
|
-
parse_obj_as(
|
|
170
|
-
type_=TestSetSimpleResponse, # type: ignore
|
|
171
|
-
object_=_response.json(),
|
|
172
|
-
),
|
|
173
|
-
)
|
|
174
|
-
if _response.status_code == 422:
|
|
175
|
-
raise UnprocessableEntityError(
|
|
176
|
-
typing.cast(
|
|
177
|
-
HttpValidationError,
|
|
178
|
-
parse_obj_as(
|
|
179
|
-
type_=HttpValidationError, # type: ignore
|
|
180
|
-
object_=_response.json(),
|
|
181
|
-
),
|
|
182
|
-
)
|
|
183
|
-
)
|
|
184
|
-
_response_json = _response.json()
|
|
185
|
-
except JSONDecodeError:
|
|
186
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
187
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
146
|
+
)
|
|
147
|
+
return _response.data
|
|
188
148
|
|
|
189
149
|
def get_testsets(
|
|
190
150
|
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
@@ -214,106 +174,46 @@ class TestsetsClient:
|
|
|
214
174
|
|
|
215
175
|
client = AgentaApi(
|
|
216
176
|
api_key="YOUR_API_KEY",
|
|
217
|
-
base_url="https://yourhost.com/path/to/api",
|
|
218
177
|
)
|
|
219
178
|
client.testsets.get_testsets()
|
|
220
179
|
"""
|
|
221
|
-
_response = self.
|
|
222
|
-
|
|
223
|
-
method="GET",
|
|
224
|
-
request_options=request_options,
|
|
225
|
-
)
|
|
226
|
-
try:
|
|
227
|
-
if 200 <= _response.status_code < 300:
|
|
228
|
-
return typing.cast(
|
|
229
|
-
typing.List[TestSetOutputResponse],
|
|
230
|
-
parse_obj_as(
|
|
231
|
-
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
232
|
-
object_=_response.json(),
|
|
233
|
-
),
|
|
234
|
-
)
|
|
235
|
-
_response_json = _response.json()
|
|
236
|
-
except JSONDecodeError:
|
|
237
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
238
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
180
|
+
_response = self._raw_client.get_testsets(request_options=request_options)
|
|
181
|
+
return _response.data
|
|
239
182
|
|
|
240
183
|
def create_testset(
|
|
241
184
|
self,
|
|
242
185
|
*,
|
|
243
|
-
|
|
244
|
-
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
186
|
+
testset: Testset,
|
|
245
187
|
request_options: typing.Optional[RequestOptions] = None,
|
|
246
|
-
) ->
|
|
188
|
+
) -> TestsetResponse:
|
|
247
189
|
"""
|
|
248
|
-
Create a testset with given name, save the testset to Postgres.
|
|
249
|
-
|
|
250
|
-
Args:
|
|
251
|
-
name (str): name of the test set.
|
|
252
|
-
testset (Dict[str, str]): test set data.
|
|
253
|
-
|
|
254
|
-
Returns:
|
|
255
|
-
str: The id of the test set created.
|
|
256
|
-
|
|
257
190
|
Parameters
|
|
258
191
|
----------
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
192
|
+
testset : Testset
|
|
262
193
|
|
|
263
194
|
request_options : typing.Optional[RequestOptions]
|
|
264
195
|
Request-specific configuration.
|
|
265
196
|
|
|
266
197
|
Returns
|
|
267
198
|
-------
|
|
268
|
-
|
|
199
|
+
TestsetResponse
|
|
269
200
|
Successful Response
|
|
270
201
|
|
|
271
202
|
Examples
|
|
272
203
|
--------
|
|
273
|
-
from agenta import AgentaApi
|
|
204
|
+
from agenta import AgentaApi, Testset
|
|
274
205
|
|
|
275
206
|
client = AgentaApi(
|
|
276
207
|
api_key="YOUR_API_KEY",
|
|
277
|
-
base_url="https://yourhost.com/path/to/api",
|
|
278
208
|
)
|
|
279
209
|
client.testsets.create_testset(
|
|
280
|
-
|
|
281
|
-
csvdata=[{"key": "value"}],
|
|
210
|
+
testset=Testset(),
|
|
282
211
|
)
|
|
283
212
|
"""
|
|
284
|
-
_response = self.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
"name": name,
|
|
289
|
-
"csvdata": csvdata,
|
|
290
|
-
},
|
|
291
|
-
request_options=request_options,
|
|
292
|
-
omit=OMIT,
|
|
293
|
-
)
|
|
294
|
-
try:
|
|
295
|
-
if 200 <= _response.status_code < 300:
|
|
296
|
-
return typing.cast(
|
|
297
|
-
TestSetSimpleResponse,
|
|
298
|
-
parse_obj_as(
|
|
299
|
-
type_=TestSetSimpleResponse, # type: ignore
|
|
300
|
-
object_=_response.json(),
|
|
301
|
-
),
|
|
302
|
-
)
|
|
303
|
-
if _response.status_code == 422:
|
|
304
|
-
raise UnprocessableEntityError(
|
|
305
|
-
typing.cast(
|
|
306
|
-
HttpValidationError,
|
|
307
|
-
parse_obj_as(
|
|
308
|
-
type_=HttpValidationError, # type: ignore
|
|
309
|
-
object_=_response.json(),
|
|
310
|
-
),
|
|
311
|
-
)
|
|
312
|
-
)
|
|
313
|
-
_response_json = _response.json()
|
|
314
|
-
except JSONDecodeError:
|
|
315
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
316
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
213
|
+
_response = self._raw_client.create_testset(
|
|
214
|
+
testset=testset, request_options=request_options
|
|
215
|
+
)
|
|
216
|
+
return _response.data
|
|
317
217
|
|
|
318
218
|
def delete_testsets(
|
|
319
219
|
self,
|
|
@@ -348,47 +248,15 @@ class TestsetsClient:
|
|
|
348
248
|
|
|
349
249
|
client = AgentaApi(
|
|
350
250
|
api_key="YOUR_API_KEY",
|
|
351
|
-
base_url="https://yourhost.com/path/to/api",
|
|
352
251
|
)
|
|
353
252
|
client.testsets.delete_testsets(
|
|
354
253
|
testset_ids=["testset_ids"],
|
|
355
254
|
)
|
|
356
255
|
"""
|
|
357
|
-
_response = self.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
"testset_ids": testset_ids,
|
|
362
|
-
},
|
|
363
|
-
headers={
|
|
364
|
-
"content-type": "application/json",
|
|
365
|
-
},
|
|
366
|
-
request_options=request_options,
|
|
367
|
-
omit=OMIT,
|
|
368
|
-
)
|
|
369
|
-
try:
|
|
370
|
-
if 200 <= _response.status_code < 300:
|
|
371
|
-
return typing.cast(
|
|
372
|
-
typing.List[str],
|
|
373
|
-
parse_obj_as(
|
|
374
|
-
type_=typing.List[str], # type: ignore
|
|
375
|
-
object_=_response.json(),
|
|
376
|
-
),
|
|
377
|
-
)
|
|
378
|
-
if _response.status_code == 422:
|
|
379
|
-
raise UnprocessableEntityError(
|
|
380
|
-
typing.cast(
|
|
381
|
-
HttpValidationError,
|
|
382
|
-
parse_obj_as(
|
|
383
|
-
type_=HttpValidationError, # type: ignore
|
|
384
|
-
object_=_response.json(),
|
|
385
|
-
),
|
|
386
|
-
)
|
|
387
|
-
)
|
|
388
|
-
_response_json = _response.json()
|
|
389
|
-
except JSONDecodeError:
|
|
390
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
391
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
256
|
+
_response = self._raw_client.delete_testsets(
|
|
257
|
+
testset_ids=testset_ids, request_options=request_options
|
|
258
|
+
)
|
|
259
|
+
return _response.data
|
|
392
260
|
|
|
393
261
|
def get_single_testset(
|
|
394
262
|
self,
|
|
@@ -423,40 +291,15 @@ class TestsetsClient:
|
|
|
423
291
|
|
|
424
292
|
client = AgentaApi(
|
|
425
293
|
api_key="YOUR_API_KEY",
|
|
426
|
-
base_url="https://yourhost.com/path/to/api",
|
|
427
294
|
)
|
|
428
295
|
client.testsets.get_single_testset(
|
|
429
296
|
testset_id="testset_id",
|
|
430
297
|
)
|
|
431
298
|
"""
|
|
432
|
-
_response = self.
|
|
433
|
-
|
|
434
|
-
method="GET",
|
|
435
|
-
request_options=request_options,
|
|
299
|
+
_response = self._raw_client.get_single_testset(
|
|
300
|
+
testset_id, request_options=request_options
|
|
436
301
|
)
|
|
437
|
-
|
|
438
|
-
if 200 <= _response.status_code < 300:
|
|
439
|
-
return typing.cast(
|
|
440
|
-
typing.Optional[typing.Any],
|
|
441
|
-
parse_obj_as(
|
|
442
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
443
|
-
object_=_response.json(),
|
|
444
|
-
),
|
|
445
|
-
)
|
|
446
|
-
if _response.status_code == 422:
|
|
447
|
-
raise UnprocessableEntityError(
|
|
448
|
-
typing.cast(
|
|
449
|
-
HttpValidationError,
|
|
450
|
-
parse_obj_as(
|
|
451
|
-
type_=HttpValidationError, # type: ignore
|
|
452
|
-
object_=_response.json(),
|
|
453
|
-
),
|
|
454
|
-
)
|
|
455
|
-
)
|
|
456
|
-
_response_json = _response.json()
|
|
457
|
-
except JSONDecodeError:
|
|
458
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
459
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
302
|
+
return _response.data
|
|
460
303
|
|
|
461
304
|
def update_testset(
|
|
462
305
|
self,
|
|
@@ -498,7 +341,6 @@ class TestsetsClient:
|
|
|
498
341
|
|
|
499
342
|
client = AgentaApi(
|
|
500
343
|
api_key="YOUR_API_KEY",
|
|
501
|
-
base_url="https://yourhost.com/path/to/api",
|
|
502
344
|
)
|
|
503
345
|
client.testsets.update_testset(
|
|
504
346
|
testset_id="testset_id",
|
|
@@ -506,561 +348,996 @@ class TestsetsClient:
|
|
|
506
348
|
csvdata=[{"key": "value"}],
|
|
507
349
|
)
|
|
508
350
|
"""
|
|
509
|
-
_response = self.
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
"name": name,
|
|
514
|
-
"csvdata": csvdata,
|
|
515
|
-
},
|
|
516
|
-
request_options=request_options,
|
|
517
|
-
omit=OMIT,
|
|
518
|
-
)
|
|
519
|
-
try:
|
|
520
|
-
if 200 <= _response.status_code < 300:
|
|
521
|
-
return typing.cast(
|
|
522
|
-
typing.Optional[typing.Any],
|
|
523
|
-
parse_obj_as(
|
|
524
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
525
|
-
object_=_response.json(),
|
|
526
|
-
),
|
|
527
|
-
)
|
|
528
|
-
if _response.status_code == 422:
|
|
529
|
-
raise UnprocessableEntityError(
|
|
530
|
-
typing.cast(
|
|
531
|
-
HttpValidationError,
|
|
532
|
-
parse_obj_as(
|
|
533
|
-
type_=HttpValidationError, # type: ignore
|
|
534
|
-
object_=_response.json(),
|
|
535
|
-
),
|
|
536
|
-
)
|
|
537
|
-
)
|
|
538
|
-
_response_json = _response.json()
|
|
539
|
-
except JSONDecodeError:
|
|
540
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
541
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
351
|
+
_response = self._raw_client.update_testset(
|
|
352
|
+
testset_id, name=name, csvdata=csvdata, request_options=request_options
|
|
353
|
+
)
|
|
354
|
+
return _response.data
|
|
542
355
|
|
|
356
|
+
def list_testsets(
|
|
357
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
358
|
+
) -> TestsetResponse:
|
|
359
|
+
"""
|
|
360
|
+
Parameters
|
|
361
|
+
----------
|
|
362
|
+
request_options : typing.Optional[RequestOptions]
|
|
363
|
+
Request-specific configuration.
|
|
543
364
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
365
|
+
Returns
|
|
366
|
+
-------
|
|
367
|
+
TestsetResponse
|
|
368
|
+
Successful Response
|
|
547
369
|
|
|
548
|
-
|
|
370
|
+
Examples
|
|
371
|
+
--------
|
|
372
|
+
from agenta import AgentaApi
|
|
373
|
+
|
|
374
|
+
client = AgentaApi(
|
|
375
|
+
api_key="YOUR_API_KEY",
|
|
376
|
+
)
|
|
377
|
+
client.testsets.list_testsets()
|
|
378
|
+
"""
|
|
379
|
+
_response = self._raw_client.list_testsets(request_options=request_options)
|
|
380
|
+
return _response.data
|
|
381
|
+
|
|
382
|
+
def fetch_testset(
|
|
549
383
|
self,
|
|
384
|
+
testset_id: str,
|
|
550
385
|
*,
|
|
551
|
-
file: core.File,
|
|
552
|
-
upload_type: typing.Optional[str] = OMIT,
|
|
553
|
-
testset_name: typing.Optional[str] = OMIT,
|
|
554
386
|
request_options: typing.Optional[RequestOptions] = None,
|
|
555
|
-
) ->
|
|
387
|
+
) -> TestsetResponse:
|
|
556
388
|
"""
|
|
557
|
-
Uploads a CSV or JSON file and saves its data to Postgres.
|
|
558
|
-
|
|
559
|
-
Args:
|
|
560
|
-
upload_type : Either a json or csv file.
|
|
561
|
-
file (UploadFile): The CSV or JSON file to upload.
|
|
562
|
-
testset_name (Optional): the name of the testset if provided.
|
|
563
|
-
|
|
564
|
-
Returns:
|
|
565
|
-
dict: The result of the upload process.
|
|
566
|
-
|
|
567
389
|
Parameters
|
|
568
390
|
----------
|
|
569
|
-
|
|
570
|
-
See core.File for more documentation
|
|
571
|
-
|
|
572
|
-
upload_type : typing.Optional[str]
|
|
573
|
-
|
|
574
|
-
testset_name : typing.Optional[str]
|
|
391
|
+
testset_id : str
|
|
575
392
|
|
|
576
393
|
request_options : typing.Optional[RequestOptions]
|
|
577
394
|
Request-specific configuration.
|
|
578
395
|
|
|
579
396
|
Returns
|
|
580
397
|
-------
|
|
581
|
-
|
|
398
|
+
TestsetResponse
|
|
582
399
|
Successful Response
|
|
583
400
|
|
|
584
401
|
Examples
|
|
585
402
|
--------
|
|
586
|
-
import
|
|
587
|
-
|
|
588
|
-
from agenta import AsyncAgentaApi
|
|
403
|
+
from agenta import AgentaApi
|
|
589
404
|
|
|
590
|
-
client =
|
|
405
|
+
client = AgentaApi(
|
|
591
406
|
api_key="YOUR_API_KEY",
|
|
592
|
-
base_url="https://yourhost.com/path/to/api",
|
|
593
407
|
)
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
await client.testsets.upload_file()
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
asyncio.run(main())
|
|
408
|
+
client.testsets.fetch_testset(
|
|
409
|
+
testset_id="testset_id",
|
|
410
|
+
)
|
|
601
411
|
"""
|
|
602
|
-
_response =
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
"upload_type": upload_type,
|
|
607
|
-
"testset_name": testset_name,
|
|
608
|
-
},
|
|
609
|
-
files={
|
|
610
|
-
"file": file,
|
|
611
|
-
},
|
|
612
|
-
request_options=request_options,
|
|
613
|
-
omit=OMIT,
|
|
614
|
-
)
|
|
615
|
-
try:
|
|
616
|
-
if 200 <= _response.status_code < 300:
|
|
617
|
-
return typing.cast(
|
|
618
|
-
TestSetSimpleResponse,
|
|
619
|
-
parse_obj_as(
|
|
620
|
-
type_=TestSetSimpleResponse, # type: ignore
|
|
621
|
-
object_=_response.json(),
|
|
622
|
-
),
|
|
623
|
-
)
|
|
624
|
-
if _response.status_code == 422:
|
|
625
|
-
raise UnprocessableEntityError(
|
|
626
|
-
typing.cast(
|
|
627
|
-
HttpValidationError,
|
|
628
|
-
parse_obj_as(
|
|
629
|
-
type_=HttpValidationError, # type: ignore
|
|
630
|
-
object_=_response.json(),
|
|
631
|
-
),
|
|
632
|
-
)
|
|
633
|
-
)
|
|
634
|
-
_response_json = _response.json()
|
|
635
|
-
except JSONDecodeError:
|
|
636
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
637
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
412
|
+
_response = self._raw_client.fetch_testset(
|
|
413
|
+
testset_id, request_options=request_options
|
|
414
|
+
)
|
|
415
|
+
return _response.data
|
|
638
416
|
|
|
639
|
-
|
|
417
|
+
def edit_testset(
|
|
640
418
|
self,
|
|
419
|
+
testset_id: str,
|
|
641
420
|
*,
|
|
642
|
-
|
|
643
|
-
endpoint: typing.Optional[str] = OMIT,
|
|
644
|
-
testset_name: typing.Optional[str] = OMIT,
|
|
421
|
+
testset: Testset,
|
|
645
422
|
request_options: typing.Optional[RequestOptions] = None,
|
|
646
|
-
) ->
|
|
423
|
+
) -> TestsetResponse:
|
|
647
424
|
"""
|
|
648
|
-
Import JSON testset data from an endpoint and save it to Postgres.
|
|
649
|
-
|
|
650
|
-
Args:
|
|
651
|
-
endpoint (str): An endpoint URL to import data from.
|
|
652
|
-
testset_name (str): the name of the testset if provided.
|
|
653
|
-
|
|
654
|
-
Returns:
|
|
655
|
-
dict: The result of the import process.
|
|
656
|
-
|
|
657
425
|
Parameters
|
|
658
426
|
----------
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
endpoint : typing.Optional[str]
|
|
427
|
+
testset_id : str
|
|
662
428
|
|
|
663
|
-
|
|
429
|
+
testset : Testset
|
|
664
430
|
|
|
665
431
|
request_options : typing.Optional[RequestOptions]
|
|
666
432
|
Request-specific configuration.
|
|
667
433
|
|
|
668
434
|
Returns
|
|
669
435
|
-------
|
|
670
|
-
|
|
436
|
+
TestsetResponse
|
|
671
437
|
Successful Response
|
|
672
438
|
|
|
673
439
|
Examples
|
|
674
440
|
--------
|
|
675
|
-
import
|
|
676
|
-
|
|
677
|
-
from agenta import AsyncAgentaApi
|
|
441
|
+
from agenta import AgentaApi, Testset
|
|
678
442
|
|
|
679
|
-
client =
|
|
443
|
+
client = AgentaApi(
|
|
680
444
|
api_key="YOUR_API_KEY",
|
|
681
|
-
base_url="https://yourhost.com/path/to/api",
|
|
682
445
|
)
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
asyncio.run(main())
|
|
446
|
+
client.testsets.edit_testset(
|
|
447
|
+
testset_id="testset_id",
|
|
448
|
+
testset=Testset(),
|
|
449
|
+
)
|
|
690
450
|
"""
|
|
691
|
-
_response =
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
"authorization": authorization,
|
|
696
|
-
},
|
|
697
|
-
json={
|
|
698
|
-
"endpoint": endpoint,
|
|
699
|
-
"testset_name": testset_name,
|
|
700
|
-
},
|
|
701
|
-
request_options=request_options,
|
|
702
|
-
omit=OMIT,
|
|
703
|
-
)
|
|
704
|
-
try:
|
|
705
|
-
if 200 <= _response.status_code < 300:
|
|
706
|
-
return typing.cast(
|
|
707
|
-
TestSetSimpleResponse,
|
|
708
|
-
parse_obj_as(
|
|
709
|
-
type_=TestSetSimpleResponse, # type: ignore
|
|
710
|
-
object_=_response.json(),
|
|
711
|
-
),
|
|
712
|
-
)
|
|
713
|
-
if _response.status_code == 422:
|
|
714
|
-
raise UnprocessableEntityError(
|
|
715
|
-
typing.cast(
|
|
716
|
-
HttpValidationError,
|
|
717
|
-
parse_obj_as(
|
|
718
|
-
type_=HttpValidationError, # type: ignore
|
|
719
|
-
object_=_response.json(),
|
|
720
|
-
),
|
|
721
|
-
)
|
|
722
|
-
)
|
|
723
|
-
_response_json = _response.json()
|
|
724
|
-
except JSONDecodeError:
|
|
725
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
726
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
451
|
+
_response = self._raw_client.edit_testset(
|
|
452
|
+
testset_id, testset=testset, request_options=request_options
|
|
453
|
+
)
|
|
454
|
+
return _response.data
|
|
727
455
|
|
|
728
|
-
|
|
729
|
-
self,
|
|
730
|
-
|
|
456
|
+
def archive_testset(
|
|
457
|
+
self,
|
|
458
|
+
testset_id: str,
|
|
459
|
+
*,
|
|
460
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
461
|
+
) -> TestsetResponse:
|
|
731
462
|
"""
|
|
732
|
-
Get all testsets.
|
|
733
|
-
|
|
734
|
-
Returns:
|
|
735
|
-
- A list of testset objects.
|
|
736
|
-
|
|
737
|
-
Raises:
|
|
738
|
-
- `HTTPException` with status code 404 if no testsets are found.
|
|
739
|
-
|
|
740
463
|
Parameters
|
|
741
464
|
----------
|
|
465
|
+
testset_id : str
|
|
466
|
+
|
|
742
467
|
request_options : typing.Optional[RequestOptions]
|
|
743
468
|
Request-specific configuration.
|
|
744
469
|
|
|
745
470
|
Returns
|
|
746
471
|
-------
|
|
747
|
-
|
|
472
|
+
TestsetResponse
|
|
748
473
|
Successful Response
|
|
749
474
|
|
|
750
475
|
Examples
|
|
751
476
|
--------
|
|
752
|
-
import
|
|
753
|
-
|
|
754
|
-
from agenta import AsyncAgentaApi
|
|
477
|
+
from agenta import AgentaApi
|
|
755
478
|
|
|
756
|
-
client =
|
|
479
|
+
client = AgentaApi(
|
|
757
480
|
api_key="YOUR_API_KEY",
|
|
758
|
-
base_url="https://yourhost.com/path/to/api",
|
|
759
481
|
)
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
await client.testsets.get_testsets()
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
asyncio.run(main())
|
|
482
|
+
client.testsets.archive_testset(
|
|
483
|
+
testset_id="testset_id",
|
|
484
|
+
)
|
|
767
485
|
"""
|
|
768
|
-
_response =
|
|
769
|
-
|
|
770
|
-
method="GET",
|
|
771
|
-
request_options=request_options,
|
|
486
|
+
_response = self._raw_client.archive_testset(
|
|
487
|
+
testset_id, request_options=request_options
|
|
772
488
|
)
|
|
773
|
-
|
|
774
|
-
if 200 <= _response.status_code < 300:
|
|
775
|
-
return typing.cast(
|
|
776
|
-
typing.List[TestSetOutputResponse],
|
|
777
|
-
parse_obj_as(
|
|
778
|
-
type_=typing.List[TestSetOutputResponse], # type: ignore
|
|
779
|
-
object_=_response.json(),
|
|
780
|
-
),
|
|
781
|
-
)
|
|
782
|
-
_response_json = _response.json()
|
|
783
|
-
except JSONDecodeError:
|
|
784
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
785
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
489
|
+
return _response.data
|
|
786
490
|
|
|
787
|
-
|
|
491
|
+
def unarchive_testset(
|
|
788
492
|
self,
|
|
493
|
+
testset_id: str,
|
|
789
494
|
*,
|
|
790
|
-
name: str,
|
|
791
|
-
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
792
495
|
request_options: typing.Optional[RequestOptions] = None,
|
|
793
|
-
) ->
|
|
496
|
+
) -> TestsetResponse:
|
|
794
497
|
"""
|
|
795
|
-
Create a testset with given name, save the testset to Postgres.
|
|
796
|
-
|
|
797
|
-
Args:
|
|
798
|
-
name (str): name of the test set.
|
|
799
|
-
testset (Dict[str, str]): test set data.
|
|
800
|
-
|
|
801
|
-
Returns:
|
|
802
|
-
str: The id of the test set created.
|
|
803
|
-
|
|
804
498
|
Parameters
|
|
805
499
|
----------
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
500
|
+
testset_id : str
|
|
809
501
|
|
|
810
502
|
request_options : typing.Optional[RequestOptions]
|
|
811
503
|
Request-specific configuration.
|
|
812
504
|
|
|
813
505
|
Returns
|
|
814
506
|
-------
|
|
815
|
-
|
|
507
|
+
TestsetResponse
|
|
816
508
|
Successful Response
|
|
817
509
|
|
|
818
510
|
Examples
|
|
819
511
|
--------
|
|
820
|
-
import
|
|
821
|
-
|
|
822
|
-
from agenta import AsyncAgentaApi
|
|
512
|
+
from agenta import AgentaApi
|
|
823
513
|
|
|
824
|
-
client =
|
|
514
|
+
client = AgentaApi(
|
|
825
515
|
api_key="YOUR_API_KEY",
|
|
826
|
-
base_url="https://yourhost.com/path/to/api",
|
|
827
516
|
)
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
await client.testsets.create_testset(
|
|
832
|
-
name="name",
|
|
833
|
-
csvdata=[{"key": "value"}],
|
|
834
|
-
)
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
asyncio.run(main())
|
|
517
|
+
client.testsets.unarchive_testset(
|
|
518
|
+
testset_id="testset_id",
|
|
519
|
+
)
|
|
838
520
|
"""
|
|
839
|
-
_response =
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
"name": name,
|
|
844
|
-
"csvdata": csvdata,
|
|
845
|
-
},
|
|
846
|
-
request_options=request_options,
|
|
847
|
-
omit=OMIT,
|
|
848
|
-
)
|
|
849
|
-
try:
|
|
850
|
-
if 200 <= _response.status_code < 300:
|
|
851
|
-
return typing.cast(
|
|
852
|
-
TestSetSimpleResponse,
|
|
853
|
-
parse_obj_as(
|
|
854
|
-
type_=TestSetSimpleResponse, # type: ignore
|
|
855
|
-
object_=_response.json(),
|
|
856
|
-
),
|
|
857
|
-
)
|
|
858
|
-
if _response.status_code == 422:
|
|
859
|
-
raise UnprocessableEntityError(
|
|
860
|
-
typing.cast(
|
|
861
|
-
HttpValidationError,
|
|
862
|
-
parse_obj_as(
|
|
863
|
-
type_=HttpValidationError, # type: ignore
|
|
864
|
-
object_=_response.json(),
|
|
865
|
-
),
|
|
866
|
-
)
|
|
867
|
-
)
|
|
868
|
-
_response_json = _response.json()
|
|
869
|
-
except JSONDecodeError:
|
|
870
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
871
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
521
|
+
_response = self._raw_client.unarchive_testset(
|
|
522
|
+
testset_id, request_options=request_options
|
|
523
|
+
)
|
|
524
|
+
return _response.data
|
|
872
525
|
|
|
873
|
-
|
|
526
|
+
def query_testsets(
|
|
874
527
|
self,
|
|
875
528
|
*,
|
|
876
|
-
|
|
529
|
+
request: typing.Optional[MetaRequest] = None,
|
|
877
530
|
request_options: typing.Optional[RequestOptions] = None,
|
|
878
|
-
) ->
|
|
531
|
+
) -> TestsetsResponse:
|
|
879
532
|
"""
|
|
880
|
-
Delete specific testsets based on their unique IDs.
|
|
881
|
-
|
|
882
|
-
Args:
|
|
883
|
-
testset_ids (List[str]): The unique identifiers of the testsets to delete.
|
|
884
|
-
|
|
885
|
-
Returns:
|
|
886
|
-
A list of the deleted testsets' IDs.
|
|
887
|
-
|
|
888
533
|
Parameters
|
|
889
534
|
----------
|
|
890
|
-
|
|
535
|
+
request : typing.Optional[MetaRequest]
|
|
891
536
|
|
|
892
537
|
request_options : typing.Optional[RequestOptions]
|
|
893
538
|
Request-specific configuration.
|
|
894
539
|
|
|
895
540
|
Returns
|
|
896
541
|
-------
|
|
897
|
-
|
|
542
|
+
TestsetsResponse
|
|
898
543
|
Successful Response
|
|
899
544
|
|
|
900
545
|
Examples
|
|
901
546
|
--------
|
|
902
|
-
import
|
|
903
|
-
|
|
904
|
-
from agenta import AsyncAgentaApi
|
|
547
|
+
from agenta import AgentaApi
|
|
905
548
|
|
|
906
|
-
client =
|
|
549
|
+
client = AgentaApi(
|
|
907
550
|
api_key="YOUR_API_KEY",
|
|
908
|
-
base_url="https://yourhost.com/path/to/api",
|
|
909
551
|
)
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
async def main() -> None:
|
|
913
|
-
await client.testsets.delete_testsets(
|
|
914
|
-
testset_ids=["testset_ids"],
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
asyncio.run(main())
|
|
552
|
+
client.testsets.query_testsets()
|
|
919
553
|
"""
|
|
920
|
-
_response =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
"testset_ids": testset_ids,
|
|
925
|
-
},
|
|
926
|
-
headers={
|
|
927
|
-
"content-type": "application/json",
|
|
928
|
-
},
|
|
929
|
-
request_options=request_options,
|
|
930
|
-
omit=OMIT,
|
|
931
|
-
)
|
|
932
|
-
try:
|
|
933
|
-
if 200 <= _response.status_code < 300:
|
|
934
|
-
return typing.cast(
|
|
935
|
-
typing.List[str],
|
|
936
|
-
parse_obj_as(
|
|
937
|
-
type_=typing.List[str], # type: ignore
|
|
938
|
-
object_=_response.json(),
|
|
939
|
-
),
|
|
940
|
-
)
|
|
941
|
-
if _response.status_code == 422:
|
|
942
|
-
raise UnprocessableEntityError(
|
|
943
|
-
typing.cast(
|
|
944
|
-
HttpValidationError,
|
|
945
|
-
parse_obj_as(
|
|
946
|
-
type_=HttpValidationError, # type: ignore
|
|
947
|
-
object_=_response.json(),
|
|
948
|
-
),
|
|
949
|
-
)
|
|
950
|
-
)
|
|
951
|
-
_response_json = _response.json()
|
|
952
|
-
except JSONDecodeError:
|
|
953
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
954
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
554
|
+
_response = self._raw_client.query_testsets(
|
|
555
|
+
request=request, request_options=request_options
|
|
556
|
+
)
|
|
557
|
+
return _response.data
|
|
955
558
|
|
|
956
|
-
|
|
559
|
+
def create_testset_from_file(
|
|
957
560
|
self,
|
|
958
|
-
testset_id: str,
|
|
959
561
|
*,
|
|
562
|
+
file: core.File,
|
|
563
|
+
file_type: typing.Optional[CreateTestsetFromFileRequestFileType] = OMIT,
|
|
564
|
+
testset_slug: typing.Optional[str] = OMIT,
|
|
565
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
566
|
+
testset_description: typing.Optional[str] = OMIT,
|
|
567
|
+
testset_meta: typing.Optional[typing.List[str]] = OMIT,
|
|
960
568
|
request_options: typing.Optional[RequestOptions] = None,
|
|
961
|
-
) ->
|
|
569
|
+
) -> TestsetResponse:
|
|
962
570
|
"""
|
|
963
|
-
|
|
571
|
+
Parameters
|
|
572
|
+
----------
|
|
573
|
+
file : core.File
|
|
574
|
+
See core.File for more documentation
|
|
964
575
|
|
|
965
|
-
|
|
966
|
-
testset_id (str): The id of the testset to fetch.
|
|
576
|
+
file_type : typing.Optional[CreateTestsetFromFileRequestFileType]
|
|
967
577
|
|
|
968
|
-
|
|
969
|
-
The requested testset if found, else an HTTPException.
|
|
578
|
+
testset_slug : typing.Optional[str]
|
|
970
579
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
580
|
+
testset_name : typing.Optional[str]
|
|
581
|
+
|
|
582
|
+
testset_description : typing.Optional[str]
|
|
583
|
+
|
|
584
|
+
testset_meta : typing.Optional[typing.List[str]]
|
|
974
585
|
|
|
975
586
|
request_options : typing.Optional[RequestOptions]
|
|
976
587
|
Request-specific configuration.
|
|
977
588
|
|
|
978
589
|
Returns
|
|
979
590
|
-------
|
|
980
|
-
|
|
591
|
+
TestsetResponse
|
|
981
592
|
Successful Response
|
|
982
593
|
|
|
983
594
|
Examples
|
|
984
595
|
--------
|
|
985
|
-
import
|
|
596
|
+
from agenta import AgentaApi
|
|
986
597
|
|
|
987
|
-
|
|
598
|
+
client = AgentaApi(
|
|
599
|
+
api_key="YOUR_API_KEY",
|
|
600
|
+
)
|
|
601
|
+
client.testsets.create_testset_from_file()
|
|
602
|
+
"""
|
|
603
|
+
_response = self._raw_client.create_testset_from_file(
|
|
604
|
+
file=file,
|
|
605
|
+
file_type=file_type,
|
|
606
|
+
testset_slug=testset_slug,
|
|
607
|
+
testset_name=testset_name,
|
|
608
|
+
testset_description=testset_description,
|
|
609
|
+
testset_meta=testset_meta,
|
|
610
|
+
request_options=request_options,
|
|
611
|
+
)
|
|
612
|
+
return _response.data
|
|
613
|
+
|
|
614
|
+
def update_testset_from_file(
|
|
615
|
+
self,
|
|
616
|
+
testset_id: str,
|
|
617
|
+
*,
|
|
618
|
+
file: core.File,
|
|
619
|
+
file_type: typing.Optional[UpdateTestsetFromFileRequestFileType] = OMIT,
|
|
620
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
621
|
+
) -> TestsetResponse:
|
|
622
|
+
"""
|
|
623
|
+
Parameters
|
|
624
|
+
----------
|
|
625
|
+
testset_id : str
|
|
626
|
+
|
|
627
|
+
file : core.File
|
|
628
|
+
See core.File for more documentation
|
|
629
|
+
|
|
630
|
+
file_type : typing.Optional[UpdateTestsetFromFileRequestFileType]
|
|
631
|
+
|
|
632
|
+
request_options : typing.Optional[RequestOptions]
|
|
633
|
+
Request-specific configuration.
|
|
634
|
+
|
|
635
|
+
Returns
|
|
636
|
+
-------
|
|
637
|
+
TestsetResponse
|
|
638
|
+
Successful Response
|
|
639
|
+
|
|
640
|
+
Examples
|
|
641
|
+
--------
|
|
642
|
+
from agenta import AgentaApi
|
|
643
|
+
|
|
644
|
+
client = AgentaApi(
|
|
645
|
+
api_key="YOUR_API_KEY",
|
|
646
|
+
)
|
|
647
|
+
client.testsets.update_testset_from_file(
|
|
648
|
+
testset_id="testset_id",
|
|
649
|
+
)
|
|
650
|
+
"""
|
|
651
|
+
_response = self._raw_client.update_testset_from_file(
|
|
652
|
+
testset_id, file=file, file_type=file_type, request_options=request_options
|
|
653
|
+
)
|
|
654
|
+
return _response.data
|
|
655
|
+
|
|
656
|
+
def fetch_testset_to_file(
|
|
657
|
+
self,
|
|
658
|
+
testset_id: str,
|
|
659
|
+
*,
|
|
660
|
+
file_type: typing.Optional[FetchTestsetToFileRequestFileType] = None,
|
|
661
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
662
|
+
) -> TestsetResponse:
|
|
663
|
+
"""
|
|
664
|
+
Parameters
|
|
665
|
+
----------
|
|
666
|
+
testset_id : str
|
|
667
|
+
|
|
668
|
+
file_type : typing.Optional[FetchTestsetToFileRequestFileType]
|
|
669
|
+
|
|
670
|
+
request_options : typing.Optional[RequestOptions]
|
|
671
|
+
Request-specific configuration.
|
|
672
|
+
|
|
673
|
+
Returns
|
|
674
|
+
-------
|
|
675
|
+
TestsetResponse
|
|
676
|
+
Successful Response
|
|
677
|
+
|
|
678
|
+
Examples
|
|
679
|
+
--------
|
|
680
|
+
from agenta import AgentaApi
|
|
681
|
+
|
|
682
|
+
client = AgentaApi(
|
|
683
|
+
api_key="YOUR_API_KEY",
|
|
684
|
+
)
|
|
685
|
+
client.testsets.fetch_testset_to_file(
|
|
686
|
+
testset_id="testset_id",
|
|
687
|
+
)
|
|
688
|
+
"""
|
|
689
|
+
_response = self._raw_client.fetch_testset_to_file(
|
|
690
|
+
testset_id, file_type=file_type, request_options=request_options
|
|
691
|
+
)
|
|
692
|
+
return _response.data
|
|
693
|
+
|
|
694
|
+
def fetch_testcase(
|
|
695
|
+
self,
|
|
696
|
+
testcase_id: str,
|
|
697
|
+
*,
|
|
698
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
699
|
+
) -> TestcaseResponse:
|
|
700
|
+
"""
|
|
701
|
+
Parameters
|
|
702
|
+
----------
|
|
703
|
+
testcase_id : str
|
|
704
|
+
|
|
705
|
+
request_options : typing.Optional[RequestOptions]
|
|
706
|
+
Request-specific configuration.
|
|
707
|
+
|
|
708
|
+
Returns
|
|
709
|
+
-------
|
|
710
|
+
TestcaseResponse
|
|
711
|
+
Successful Response
|
|
712
|
+
|
|
713
|
+
Examples
|
|
714
|
+
--------
|
|
715
|
+
from agenta import AgentaApi
|
|
716
|
+
|
|
717
|
+
client = AgentaApi(
|
|
718
|
+
api_key="YOUR_API_KEY",
|
|
719
|
+
)
|
|
720
|
+
client.testsets.fetch_testcase(
|
|
721
|
+
testcase_id="testcase_id",
|
|
722
|
+
)
|
|
723
|
+
"""
|
|
724
|
+
_response = self._raw_client.fetch_testcase(
|
|
725
|
+
testcase_id, request_options=request_options
|
|
726
|
+
)
|
|
727
|
+
return _response.data
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
class AsyncTestsetsClient:
|
|
731
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
732
|
+
self._raw_client = AsyncRawTestsetsClient(client_wrapper=client_wrapper)
|
|
733
|
+
|
|
734
|
+
@property
|
|
735
|
+
def with_raw_response(self) -> AsyncRawTestsetsClient:
|
|
736
|
+
"""
|
|
737
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
738
|
+
|
|
739
|
+
Returns
|
|
740
|
+
-------
|
|
741
|
+
AsyncRawTestsetsClient
|
|
742
|
+
"""
|
|
743
|
+
return self._raw_client
|
|
744
|
+
|
|
745
|
+
async def upload_file(
|
|
746
|
+
self,
|
|
747
|
+
*,
|
|
748
|
+
file: core.File,
|
|
749
|
+
upload_type: typing.Optional[str] = OMIT,
|
|
750
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
751
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
752
|
+
) -> TestSetSimpleResponse:
|
|
753
|
+
"""
|
|
754
|
+
Uploads a CSV or JSON file and saves its data to Postgres.
|
|
755
|
+
|
|
756
|
+
Args:
|
|
757
|
+
upload_type : Either a json or csv file.
|
|
758
|
+
file (UploadFile): The CSV or JSON file to upload.
|
|
759
|
+
testset_name (Optional): the name of the testset if provided.
|
|
760
|
+
|
|
761
|
+
Returns:
|
|
762
|
+
dict: The result of the upload process.
|
|
763
|
+
|
|
764
|
+
Parameters
|
|
765
|
+
----------
|
|
766
|
+
file : core.File
|
|
767
|
+
See core.File for more documentation
|
|
768
|
+
|
|
769
|
+
upload_type : typing.Optional[str]
|
|
770
|
+
|
|
771
|
+
testset_name : typing.Optional[str]
|
|
772
|
+
|
|
773
|
+
request_options : typing.Optional[RequestOptions]
|
|
774
|
+
Request-specific configuration.
|
|
775
|
+
|
|
776
|
+
Returns
|
|
777
|
+
-------
|
|
778
|
+
TestSetSimpleResponse
|
|
779
|
+
Successful Response
|
|
780
|
+
|
|
781
|
+
Examples
|
|
782
|
+
--------
|
|
783
|
+
import asyncio
|
|
784
|
+
|
|
785
|
+
from agenta import AsyncAgentaApi
|
|
786
|
+
|
|
787
|
+
client = AsyncAgentaApi(
|
|
788
|
+
api_key="YOUR_API_KEY",
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
async def main() -> None:
|
|
793
|
+
await client.testsets.upload_file()
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
asyncio.run(main())
|
|
797
|
+
"""
|
|
798
|
+
_response = await self._raw_client.upload_file(
|
|
799
|
+
file=file,
|
|
800
|
+
upload_type=upload_type,
|
|
801
|
+
testset_name=testset_name,
|
|
802
|
+
request_options=request_options,
|
|
803
|
+
)
|
|
804
|
+
return _response.data
|
|
805
|
+
|
|
806
|
+
async def import_testset(
|
|
807
|
+
self,
|
|
808
|
+
*,
|
|
809
|
+
authorization: typing.Optional[str] = None,
|
|
810
|
+
endpoint: typing.Optional[str] = OMIT,
|
|
811
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
812
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
813
|
+
) -> TestSetSimpleResponse:
|
|
814
|
+
"""
|
|
815
|
+
Import JSON testset data from an endpoint and save it to Postgres.
|
|
816
|
+
|
|
817
|
+
Args:
|
|
818
|
+
endpoint (str): An endpoint URL to import data from.
|
|
819
|
+
testset_name (str): the name of the testset if provided.
|
|
820
|
+
|
|
821
|
+
Returns:
|
|
822
|
+
dict: The result of the import process.
|
|
823
|
+
|
|
824
|
+
Parameters
|
|
825
|
+
----------
|
|
826
|
+
authorization : typing.Optional[str]
|
|
827
|
+
|
|
828
|
+
endpoint : typing.Optional[str]
|
|
829
|
+
|
|
830
|
+
testset_name : typing.Optional[str]
|
|
831
|
+
|
|
832
|
+
request_options : typing.Optional[RequestOptions]
|
|
833
|
+
Request-specific configuration.
|
|
834
|
+
|
|
835
|
+
Returns
|
|
836
|
+
-------
|
|
837
|
+
TestSetSimpleResponse
|
|
838
|
+
Successful Response
|
|
839
|
+
|
|
840
|
+
Examples
|
|
841
|
+
--------
|
|
842
|
+
import asyncio
|
|
843
|
+
|
|
844
|
+
from agenta import AsyncAgentaApi
|
|
845
|
+
|
|
846
|
+
client = AsyncAgentaApi(
|
|
847
|
+
api_key="YOUR_API_KEY",
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
async def main() -> None:
|
|
852
|
+
await client.testsets.import_testset()
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
asyncio.run(main())
|
|
856
|
+
"""
|
|
857
|
+
_response = await self._raw_client.import_testset(
|
|
858
|
+
authorization=authorization,
|
|
859
|
+
endpoint=endpoint,
|
|
860
|
+
testset_name=testset_name,
|
|
861
|
+
request_options=request_options,
|
|
862
|
+
)
|
|
863
|
+
return _response.data
|
|
864
|
+
|
|
865
|
+
async def get_testsets(
|
|
866
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
867
|
+
) -> typing.List[TestSetOutputResponse]:
|
|
868
|
+
"""
|
|
869
|
+
Get all testsets.
|
|
870
|
+
|
|
871
|
+
Returns:
|
|
872
|
+
- A list of testset objects.
|
|
873
|
+
|
|
874
|
+
Raises:
|
|
875
|
+
- `HTTPException` with status code 404 if no testsets are found.
|
|
876
|
+
|
|
877
|
+
Parameters
|
|
878
|
+
----------
|
|
879
|
+
request_options : typing.Optional[RequestOptions]
|
|
880
|
+
Request-specific configuration.
|
|
881
|
+
|
|
882
|
+
Returns
|
|
883
|
+
-------
|
|
884
|
+
typing.List[TestSetOutputResponse]
|
|
885
|
+
Successful Response
|
|
886
|
+
|
|
887
|
+
Examples
|
|
888
|
+
--------
|
|
889
|
+
import asyncio
|
|
890
|
+
|
|
891
|
+
from agenta import AsyncAgentaApi
|
|
892
|
+
|
|
893
|
+
client = AsyncAgentaApi(
|
|
894
|
+
api_key="YOUR_API_KEY",
|
|
895
|
+
)
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
async def main() -> None:
|
|
899
|
+
await client.testsets.get_testsets()
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
asyncio.run(main())
|
|
903
|
+
"""
|
|
904
|
+
_response = await self._raw_client.get_testsets(request_options=request_options)
|
|
905
|
+
return _response.data
|
|
906
|
+
|
|
907
|
+
async def create_testset(
|
|
908
|
+
self,
|
|
909
|
+
*,
|
|
910
|
+
testset: Testset,
|
|
911
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
912
|
+
) -> TestsetResponse:
|
|
913
|
+
"""
|
|
914
|
+
Parameters
|
|
915
|
+
----------
|
|
916
|
+
testset : Testset
|
|
917
|
+
|
|
918
|
+
request_options : typing.Optional[RequestOptions]
|
|
919
|
+
Request-specific configuration.
|
|
920
|
+
|
|
921
|
+
Returns
|
|
922
|
+
-------
|
|
923
|
+
TestsetResponse
|
|
924
|
+
Successful Response
|
|
925
|
+
|
|
926
|
+
Examples
|
|
927
|
+
--------
|
|
928
|
+
import asyncio
|
|
929
|
+
|
|
930
|
+
from agenta import AsyncAgentaApi, Testset
|
|
931
|
+
|
|
932
|
+
client = AsyncAgentaApi(
|
|
933
|
+
api_key="YOUR_API_KEY",
|
|
934
|
+
)
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
async def main() -> None:
|
|
938
|
+
await client.testsets.create_testset(
|
|
939
|
+
testset=Testset(),
|
|
940
|
+
)
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
asyncio.run(main())
|
|
944
|
+
"""
|
|
945
|
+
_response = await self._raw_client.create_testset(
|
|
946
|
+
testset=testset, request_options=request_options
|
|
947
|
+
)
|
|
948
|
+
return _response.data
|
|
949
|
+
|
|
950
|
+
async def delete_testsets(
|
|
951
|
+
self,
|
|
952
|
+
*,
|
|
953
|
+
testset_ids: typing.Sequence[str],
|
|
954
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
955
|
+
) -> typing.List[str]:
|
|
956
|
+
"""
|
|
957
|
+
Delete specific testsets based on their unique IDs.
|
|
958
|
+
|
|
959
|
+
Args:
|
|
960
|
+
testset_ids (List[str]): The unique identifiers of the testsets to delete.
|
|
961
|
+
|
|
962
|
+
Returns:
|
|
963
|
+
A list of the deleted testsets' IDs.
|
|
964
|
+
|
|
965
|
+
Parameters
|
|
966
|
+
----------
|
|
967
|
+
testset_ids : typing.Sequence[str]
|
|
968
|
+
|
|
969
|
+
request_options : typing.Optional[RequestOptions]
|
|
970
|
+
Request-specific configuration.
|
|
971
|
+
|
|
972
|
+
Returns
|
|
973
|
+
-------
|
|
974
|
+
typing.List[str]
|
|
975
|
+
Successful Response
|
|
976
|
+
|
|
977
|
+
Examples
|
|
978
|
+
--------
|
|
979
|
+
import asyncio
|
|
980
|
+
|
|
981
|
+
from agenta import AsyncAgentaApi
|
|
982
|
+
|
|
983
|
+
client = AsyncAgentaApi(
|
|
984
|
+
api_key="YOUR_API_KEY",
|
|
985
|
+
)
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
async def main() -> None:
|
|
989
|
+
await client.testsets.delete_testsets(
|
|
990
|
+
testset_ids=["testset_ids"],
|
|
991
|
+
)
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
asyncio.run(main())
|
|
995
|
+
"""
|
|
996
|
+
_response = await self._raw_client.delete_testsets(
|
|
997
|
+
testset_ids=testset_ids, request_options=request_options
|
|
998
|
+
)
|
|
999
|
+
return _response.data
|
|
1000
|
+
|
|
1001
|
+
async def get_single_testset(
|
|
1002
|
+
self,
|
|
1003
|
+
testset_id: str,
|
|
1004
|
+
*,
|
|
1005
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1006
|
+
) -> typing.Optional[typing.Any]:
|
|
1007
|
+
"""
|
|
1008
|
+
Fetch a specific testset in Postgres.
|
|
1009
|
+
|
|
1010
|
+
Args:
|
|
1011
|
+
testset_id (str): The id of the testset to fetch.
|
|
1012
|
+
|
|
1013
|
+
Returns:
|
|
1014
|
+
The requested testset if found, else an HTTPException.
|
|
1015
|
+
|
|
1016
|
+
Parameters
|
|
1017
|
+
----------
|
|
1018
|
+
testset_id : str
|
|
1019
|
+
|
|
1020
|
+
request_options : typing.Optional[RequestOptions]
|
|
1021
|
+
Request-specific configuration.
|
|
1022
|
+
|
|
1023
|
+
Returns
|
|
1024
|
+
-------
|
|
1025
|
+
typing.Optional[typing.Any]
|
|
1026
|
+
Successful Response
|
|
1027
|
+
|
|
1028
|
+
Examples
|
|
1029
|
+
--------
|
|
1030
|
+
import asyncio
|
|
1031
|
+
|
|
1032
|
+
from agenta import AsyncAgentaApi
|
|
1033
|
+
|
|
1034
|
+
client = AsyncAgentaApi(
|
|
1035
|
+
api_key="YOUR_API_KEY",
|
|
1036
|
+
)
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
async def main() -> None:
|
|
1040
|
+
await client.testsets.get_single_testset(
|
|
1041
|
+
testset_id="testset_id",
|
|
1042
|
+
)
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
asyncio.run(main())
|
|
1046
|
+
"""
|
|
1047
|
+
_response = await self._raw_client.get_single_testset(
|
|
1048
|
+
testset_id, request_options=request_options
|
|
1049
|
+
)
|
|
1050
|
+
return _response.data
|
|
1051
|
+
|
|
1052
|
+
async def update_testset(
|
|
1053
|
+
self,
|
|
1054
|
+
testset_id: str,
|
|
1055
|
+
*,
|
|
1056
|
+
name: str,
|
|
1057
|
+
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
1058
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1059
|
+
) -> typing.Optional[typing.Any]:
|
|
1060
|
+
"""
|
|
1061
|
+
Update a testset with given id, update the testset in Postgres.
|
|
1062
|
+
|
|
1063
|
+
Args:
|
|
1064
|
+
testset_id (str): id of the test set to be updated.
|
|
1065
|
+
csvdata (NewTestset): New data to replace the old testset.
|
|
1066
|
+
|
|
1067
|
+
Returns:
|
|
1068
|
+
str: The id of the test set updated.
|
|
1069
|
+
|
|
1070
|
+
Parameters
|
|
1071
|
+
----------
|
|
1072
|
+
testset_id : str
|
|
1073
|
+
|
|
1074
|
+
name : str
|
|
1075
|
+
|
|
1076
|
+
csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1077
|
+
|
|
1078
|
+
request_options : typing.Optional[RequestOptions]
|
|
1079
|
+
Request-specific configuration.
|
|
1080
|
+
|
|
1081
|
+
Returns
|
|
1082
|
+
-------
|
|
1083
|
+
typing.Optional[typing.Any]
|
|
1084
|
+
Successful Response
|
|
1085
|
+
|
|
1086
|
+
Examples
|
|
1087
|
+
--------
|
|
1088
|
+
import asyncio
|
|
1089
|
+
|
|
1090
|
+
from agenta import AsyncAgentaApi
|
|
1091
|
+
|
|
1092
|
+
client = AsyncAgentaApi(
|
|
1093
|
+
api_key="YOUR_API_KEY",
|
|
1094
|
+
)
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
async def main() -> None:
|
|
1098
|
+
await client.testsets.update_testset(
|
|
1099
|
+
testset_id="testset_id",
|
|
1100
|
+
name="name",
|
|
1101
|
+
csvdata=[{"key": "value"}],
|
|
1102
|
+
)
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
asyncio.run(main())
|
|
1106
|
+
"""
|
|
1107
|
+
_response = await self._raw_client.update_testset(
|
|
1108
|
+
testset_id, name=name, csvdata=csvdata, request_options=request_options
|
|
1109
|
+
)
|
|
1110
|
+
return _response.data
|
|
1111
|
+
|
|
1112
|
+
async def list_testsets(
|
|
1113
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1114
|
+
) -> TestsetResponse:
|
|
1115
|
+
"""
|
|
1116
|
+
Parameters
|
|
1117
|
+
----------
|
|
1118
|
+
request_options : typing.Optional[RequestOptions]
|
|
1119
|
+
Request-specific configuration.
|
|
1120
|
+
|
|
1121
|
+
Returns
|
|
1122
|
+
-------
|
|
1123
|
+
TestsetResponse
|
|
1124
|
+
Successful Response
|
|
1125
|
+
|
|
1126
|
+
Examples
|
|
1127
|
+
--------
|
|
1128
|
+
import asyncio
|
|
1129
|
+
|
|
1130
|
+
from agenta import AsyncAgentaApi
|
|
1131
|
+
|
|
1132
|
+
client = AsyncAgentaApi(
|
|
1133
|
+
api_key="YOUR_API_KEY",
|
|
1134
|
+
)
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
async def main() -> None:
|
|
1138
|
+
await client.testsets.list_testsets()
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
asyncio.run(main())
|
|
1142
|
+
"""
|
|
1143
|
+
_response = await self._raw_client.list_testsets(
|
|
1144
|
+
request_options=request_options
|
|
1145
|
+
)
|
|
1146
|
+
return _response.data
|
|
1147
|
+
|
|
1148
|
+
async def fetch_testset(
|
|
1149
|
+
self,
|
|
1150
|
+
testset_id: str,
|
|
1151
|
+
*,
|
|
1152
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1153
|
+
) -> TestsetResponse:
|
|
1154
|
+
"""
|
|
1155
|
+
Parameters
|
|
1156
|
+
----------
|
|
1157
|
+
testset_id : str
|
|
1158
|
+
|
|
1159
|
+
request_options : typing.Optional[RequestOptions]
|
|
1160
|
+
Request-specific configuration.
|
|
1161
|
+
|
|
1162
|
+
Returns
|
|
1163
|
+
-------
|
|
1164
|
+
TestsetResponse
|
|
1165
|
+
Successful Response
|
|
1166
|
+
|
|
1167
|
+
Examples
|
|
1168
|
+
--------
|
|
1169
|
+
import asyncio
|
|
1170
|
+
|
|
1171
|
+
from agenta import AsyncAgentaApi
|
|
1172
|
+
|
|
1173
|
+
client = AsyncAgentaApi(
|
|
1174
|
+
api_key="YOUR_API_KEY",
|
|
1175
|
+
)
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
async def main() -> None:
|
|
1179
|
+
await client.testsets.fetch_testset(
|
|
1180
|
+
testset_id="testset_id",
|
|
1181
|
+
)
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
asyncio.run(main())
|
|
1185
|
+
"""
|
|
1186
|
+
_response = await self._raw_client.fetch_testset(
|
|
1187
|
+
testset_id, request_options=request_options
|
|
1188
|
+
)
|
|
1189
|
+
return _response.data
|
|
1190
|
+
|
|
1191
|
+
async def edit_testset(
|
|
1192
|
+
self,
|
|
1193
|
+
testset_id: str,
|
|
1194
|
+
*,
|
|
1195
|
+
testset: Testset,
|
|
1196
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1197
|
+
) -> TestsetResponse:
|
|
1198
|
+
"""
|
|
1199
|
+
Parameters
|
|
1200
|
+
----------
|
|
1201
|
+
testset_id : str
|
|
1202
|
+
|
|
1203
|
+
testset : Testset
|
|
1204
|
+
|
|
1205
|
+
request_options : typing.Optional[RequestOptions]
|
|
1206
|
+
Request-specific configuration.
|
|
1207
|
+
|
|
1208
|
+
Returns
|
|
1209
|
+
-------
|
|
1210
|
+
TestsetResponse
|
|
1211
|
+
Successful Response
|
|
1212
|
+
|
|
1213
|
+
Examples
|
|
1214
|
+
--------
|
|
1215
|
+
import asyncio
|
|
1216
|
+
|
|
1217
|
+
from agenta import AsyncAgentaApi, Testset
|
|
988
1218
|
|
|
989
1219
|
client = AsyncAgentaApi(
|
|
990
1220
|
api_key="YOUR_API_KEY",
|
|
991
|
-
base_url="https://yourhost.com/path/to/api",
|
|
992
1221
|
)
|
|
993
1222
|
|
|
994
1223
|
|
|
995
1224
|
async def main() -> None:
|
|
996
|
-
await client.testsets.
|
|
1225
|
+
await client.testsets.edit_testset(
|
|
997
1226
|
testset_id="testset_id",
|
|
1227
|
+
testset=Testset(),
|
|
998
1228
|
)
|
|
999
1229
|
|
|
1000
1230
|
|
|
1001
1231
|
asyncio.run(main())
|
|
1002
1232
|
"""
|
|
1003
|
-
_response = await self.
|
|
1004
|
-
|
|
1005
|
-
method="GET",
|
|
1006
|
-
request_options=request_options,
|
|
1233
|
+
_response = await self._raw_client.edit_testset(
|
|
1234
|
+
testset_id, testset=testset, request_options=request_options
|
|
1007
1235
|
)
|
|
1008
|
-
|
|
1009
|
-
if 200 <= _response.status_code < 300:
|
|
1010
|
-
return typing.cast(
|
|
1011
|
-
typing.Optional[typing.Any],
|
|
1012
|
-
parse_obj_as(
|
|
1013
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1014
|
-
object_=_response.json(),
|
|
1015
|
-
),
|
|
1016
|
-
)
|
|
1017
|
-
if _response.status_code == 422:
|
|
1018
|
-
raise UnprocessableEntityError(
|
|
1019
|
-
typing.cast(
|
|
1020
|
-
HttpValidationError,
|
|
1021
|
-
parse_obj_as(
|
|
1022
|
-
type_=HttpValidationError, # type: ignore
|
|
1023
|
-
object_=_response.json(),
|
|
1024
|
-
),
|
|
1025
|
-
)
|
|
1026
|
-
)
|
|
1027
|
-
_response_json = _response.json()
|
|
1028
|
-
except JSONDecodeError:
|
|
1029
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1030
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1236
|
+
return _response.data
|
|
1031
1237
|
|
|
1032
|
-
async def
|
|
1238
|
+
async def archive_testset(
|
|
1033
1239
|
self,
|
|
1034
1240
|
testset_id: str,
|
|
1035
1241
|
*,
|
|
1036
|
-
name: str,
|
|
1037
|
-
csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
|
|
1038
1242
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1039
|
-
) ->
|
|
1243
|
+
) -> TestsetResponse:
|
|
1040
1244
|
"""
|
|
1041
|
-
|
|
1245
|
+
Parameters
|
|
1246
|
+
----------
|
|
1247
|
+
testset_id : str
|
|
1042
1248
|
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
csvdata (NewTestset): New data to replace the old testset.
|
|
1249
|
+
request_options : typing.Optional[RequestOptions]
|
|
1250
|
+
Request-specific configuration.
|
|
1046
1251
|
|
|
1047
|
-
Returns
|
|
1048
|
-
|
|
1252
|
+
Returns
|
|
1253
|
+
-------
|
|
1254
|
+
TestsetResponse
|
|
1255
|
+
Successful Response
|
|
1256
|
+
|
|
1257
|
+
Examples
|
|
1258
|
+
--------
|
|
1259
|
+
import asyncio
|
|
1260
|
+
|
|
1261
|
+
from agenta import AsyncAgentaApi
|
|
1262
|
+
|
|
1263
|
+
client = AsyncAgentaApi(
|
|
1264
|
+
api_key="YOUR_API_KEY",
|
|
1265
|
+
)
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
async def main() -> None:
|
|
1269
|
+
await client.testsets.archive_testset(
|
|
1270
|
+
testset_id="testset_id",
|
|
1271
|
+
)
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
asyncio.run(main())
|
|
1275
|
+
"""
|
|
1276
|
+
_response = await self._raw_client.archive_testset(
|
|
1277
|
+
testset_id, request_options=request_options
|
|
1278
|
+
)
|
|
1279
|
+
return _response.data
|
|
1049
1280
|
|
|
1281
|
+
async def unarchive_testset(
|
|
1282
|
+
self,
|
|
1283
|
+
testset_id: str,
|
|
1284
|
+
*,
|
|
1285
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1286
|
+
) -> TestsetResponse:
|
|
1287
|
+
"""
|
|
1050
1288
|
Parameters
|
|
1051
1289
|
----------
|
|
1052
1290
|
testset_id : str
|
|
1053
1291
|
|
|
1054
|
-
|
|
1292
|
+
request_options : typing.Optional[RequestOptions]
|
|
1293
|
+
Request-specific configuration.
|
|
1055
1294
|
|
|
1056
|
-
|
|
1295
|
+
Returns
|
|
1296
|
+
-------
|
|
1297
|
+
TestsetResponse
|
|
1298
|
+
Successful Response
|
|
1299
|
+
|
|
1300
|
+
Examples
|
|
1301
|
+
--------
|
|
1302
|
+
import asyncio
|
|
1303
|
+
|
|
1304
|
+
from agenta import AsyncAgentaApi
|
|
1305
|
+
|
|
1306
|
+
client = AsyncAgentaApi(
|
|
1307
|
+
api_key="YOUR_API_KEY",
|
|
1308
|
+
)
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
async def main() -> None:
|
|
1312
|
+
await client.testsets.unarchive_testset(
|
|
1313
|
+
testset_id="testset_id",
|
|
1314
|
+
)
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
asyncio.run(main())
|
|
1318
|
+
"""
|
|
1319
|
+
_response = await self._raw_client.unarchive_testset(
|
|
1320
|
+
testset_id, request_options=request_options
|
|
1321
|
+
)
|
|
1322
|
+
return _response.data
|
|
1323
|
+
|
|
1324
|
+
async def query_testsets(
|
|
1325
|
+
self,
|
|
1326
|
+
*,
|
|
1327
|
+
request: typing.Optional[MetaRequest] = None,
|
|
1328
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1329
|
+
) -> TestsetsResponse:
|
|
1330
|
+
"""
|
|
1331
|
+
Parameters
|
|
1332
|
+
----------
|
|
1333
|
+
request : typing.Optional[MetaRequest]
|
|
1057
1334
|
|
|
1058
1335
|
request_options : typing.Optional[RequestOptions]
|
|
1059
1336
|
Request-specific configuration.
|
|
1060
1337
|
|
|
1061
1338
|
Returns
|
|
1062
1339
|
-------
|
|
1063
|
-
|
|
1340
|
+
TestsetsResponse
|
|
1064
1341
|
Successful Response
|
|
1065
1342
|
|
|
1066
1343
|
Examples
|
|
@@ -1071,50 +1348,218 @@ class AsyncTestsetsClient:
|
|
|
1071
1348
|
|
|
1072
1349
|
client = AsyncAgentaApi(
|
|
1073
1350
|
api_key="YOUR_API_KEY",
|
|
1074
|
-
base_url="https://yourhost.com/path/to/api",
|
|
1075
1351
|
)
|
|
1076
1352
|
|
|
1077
1353
|
|
|
1078
1354
|
async def main() -> None:
|
|
1079
|
-
await client.testsets.
|
|
1355
|
+
await client.testsets.query_testsets()
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
asyncio.run(main())
|
|
1359
|
+
"""
|
|
1360
|
+
_response = await self._raw_client.query_testsets(
|
|
1361
|
+
request=request, request_options=request_options
|
|
1362
|
+
)
|
|
1363
|
+
return _response.data
|
|
1364
|
+
|
|
1365
|
+
async def create_testset_from_file(
|
|
1366
|
+
self,
|
|
1367
|
+
*,
|
|
1368
|
+
file: core.File,
|
|
1369
|
+
file_type: typing.Optional[CreateTestsetFromFileRequestFileType] = OMIT,
|
|
1370
|
+
testset_slug: typing.Optional[str] = OMIT,
|
|
1371
|
+
testset_name: typing.Optional[str] = OMIT,
|
|
1372
|
+
testset_description: typing.Optional[str] = OMIT,
|
|
1373
|
+
testset_meta: typing.Optional[typing.List[str]] = OMIT,
|
|
1374
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1375
|
+
) -> TestsetResponse:
|
|
1376
|
+
"""
|
|
1377
|
+
Parameters
|
|
1378
|
+
----------
|
|
1379
|
+
file : core.File
|
|
1380
|
+
See core.File for more documentation
|
|
1381
|
+
|
|
1382
|
+
file_type : typing.Optional[CreateTestsetFromFileRequestFileType]
|
|
1383
|
+
|
|
1384
|
+
testset_slug : typing.Optional[str]
|
|
1385
|
+
|
|
1386
|
+
testset_name : typing.Optional[str]
|
|
1387
|
+
|
|
1388
|
+
testset_description : typing.Optional[str]
|
|
1389
|
+
|
|
1390
|
+
testset_meta : typing.Optional[typing.List[str]]
|
|
1391
|
+
|
|
1392
|
+
request_options : typing.Optional[RequestOptions]
|
|
1393
|
+
Request-specific configuration.
|
|
1394
|
+
|
|
1395
|
+
Returns
|
|
1396
|
+
-------
|
|
1397
|
+
TestsetResponse
|
|
1398
|
+
Successful Response
|
|
1399
|
+
|
|
1400
|
+
Examples
|
|
1401
|
+
--------
|
|
1402
|
+
import asyncio
|
|
1403
|
+
|
|
1404
|
+
from agenta import AsyncAgentaApi
|
|
1405
|
+
|
|
1406
|
+
client = AsyncAgentaApi(
|
|
1407
|
+
api_key="YOUR_API_KEY",
|
|
1408
|
+
)
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
async def main() -> None:
|
|
1412
|
+
await client.testsets.create_testset_from_file()
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
asyncio.run(main())
|
|
1416
|
+
"""
|
|
1417
|
+
_response = await self._raw_client.create_testset_from_file(
|
|
1418
|
+
file=file,
|
|
1419
|
+
file_type=file_type,
|
|
1420
|
+
testset_slug=testset_slug,
|
|
1421
|
+
testset_name=testset_name,
|
|
1422
|
+
testset_description=testset_description,
|
|
1423
|
+
testset_meta=testset_meta,
|
|
1424
|
+
request_options=request_options,
|
|
1425
|
+
)
|
|
1426
|
+
return _response.data
|
|
1427
|
+
|
|
1428
|
+
async def update_testset_from_file(
|
|
1429
|
+
self,
|
|
1430
|
+
testset_id: str,
|
|
1431
|
+
*,
|
|
1432
|
+
file: core.File,
|
|
1433
|
+
file_type: typing.Optional[UpdateTestsetFromFileRequestFileType] = OMIT,
|
|
1434
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1435
|
+
) -> TestsetResponse:
|
|
1436
|
+
"""
|
|
1437
|
+
Parameters
|
|
1438
|
+
----------
|
|
1439
|
+
testset_id : str
|
|
1440
|
+
|
|
1441
|
+
file : core.File
|
|
1442
|
+
See core.File for more documentation
|
|
1443
|
+
|
|
1444
|
+
file_type : typing.Optional[UpdateTestsetFromFileRequestFileType]
|
|
1445
|
+
|
|
1446
|
+
request_options : typing.Optional[RequestOptions]
|
|
1447
|
+
Request-specific configuration.
|
|
1448
|
+
|
|
1449
|
+
Returns
|
|
1450
|
+
-------
|
|
1451
|
+
TestsetResponse
|
|
1452
|
+
Successful Response
|
|
1453
|
+
|
|
1454
|
+
Examples
|
|
1455
|
+
--------
|
|
1456
|
+
import asyncio
|
|
1457
|
+
|
|
1458
|
+
from agenta import AsyncAgentaApi
|
|
1459
|
+
|
|
1460
|
+
client = AsyncAgentaApi(
|
|
1461
|
+
api_key="YOUR_API_KEY",
|
|
1462
|
+
)
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
async def main() -> None:
|
|
1466
|
+
await client.testsets.update_testset_from_file(
|
|
1080
1467
|
testset_id="testset_id",
|
|
1081
|
-
name="name",
|
|
1082
|
-
csvdata=[{"key": "value"}],
|
|
1083
1468
|
)
|
|
1084
1469
|
|
|
1085
1470
|
|
|
1086
1471
|
asyncio.run(main())
|
|
1087
1472
|
"""
|
|
1088
|
-
_response = await self.
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1473
|
+
_response = await self._raw_client.update_testset_from_file(
|
|
1474
|
+
testset_id, file=file, file_type=file_type, request_options=request_options
|
|
1475
|
+
)
|
|
1476
|
+
return _response.data
|
|
1477
|
+
|
|
1478
|
+
async def fetch_testset_to_file(
|
|
1479
|
+
self,
|
|
1480
|
+
testset_id: str,
|
|
1481
|
+
*,
|
|
1482
|
+
file_type: typing.Optional[FetchTestsetToFileRequestFileType] = None,
|
|
1483
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1484
|
+
) -> TestsetResponse:
|
|
1485
|
+
"""
|
|
1486
|
+
Parameters
|
|
1487
|
+
----------
|
|
1488
|
+
testset_id : str
|
|
1489
|
+
|
|
1490
|
+
file_type : typing.Optional[FetchTestsetToFileRequestFileType]
|
|
1491
|
+
|
|
1492
|
+
request_options : typing.Optional[RequestOptions]
|
|
1493
|
+
Request-specific configuration.
|
|
1494
|
+
|
|
1495
|
+
Returns
|
|
1496
|
+
-------
|
|
1497
|
+
TestsetResponse
|
|
1498
|
+
Successful Response
|
|
1499
|
+
|
|
1500
|
+
Examples
|
|
1501
|
+
--------
|
|
1502
|
+
import asyncio
|
|
1503
|
+
|
|
1504
|
+
from agenta import AsyncAgentaApi
|
|
1505
|
+
|
|
1506
|
+
client = AsyncAgentaApi(
|
|
1507
|
+
api_key="YOUR_API_KEY",
|
|
1508
|
+
)
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
async def main() -> None:
|
|
1512
|
+
await client.testsets.fetch_testset_to_file(
|
|
1513
|
+
testset_id="testset_id",
|
|
1514
|
+
)
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
asyncio.run(main())
|
|
1518
|
+
"""
|
|
1519
|
+
_response = await self._raw_client.fetch_testset_to_file(
|
|
1520
|
+
testset_id, file_type=file_type, request_options=request_options
|
|
1521
|
+
)
|
|
1522
|
+
return _response.data
|
|
1523
|
+
|
|
1524
|
+
async def fetch_testcase(
|
|
1525
|
+
self,
|
|
1526
|
+
testcase_id: str,
|
|
1527
|
+
*,
|
|
1528
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1529
|
+
) -> TestcaseResponse:
|
|
1530
|
+
"""
|
|
1531
|
+
Parameters
|
|
1532
|
+
----------
|
|
1533
|
+
testcase_id : str
|
|
1534
|
+
|
|
1535
|
+
request_options : typing.Optional[RequestOptions]
|
|
1536
|
+
Request-specific configuration.
|
|
1537
|
+
|
|
1538
|
+
Returns
|
|
1539
|
+
-------
|
|
1540
|
+
TestcaseResponse
|
|
1541
|
+
Successful Response
|
|
1542
|
+
|
|
1543
|
+
Examples
|
|
1544
|
+
--------
|
|
1545
|
+
import asyncio
|
|
1546
|
+
|
|
1547
|
+
from agenta import AsyncAgentaApi
|
|
1548
|
+
|
|
1549
|
+
client = AsyncAgentaApi(
|
|
1550
|
+
api_key="YOUR_API_KEY",
|
|
1551
|
+
)
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
async def main() -> None:
|
|
1555
|
+
await client.testsets.fetch_testcase(
|
|
1556
|
+
testcase_id="testcase_id",
|
|
1557
|
+
)
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
asyncio.run(main())
|
|
1561
|
+
"""
|
|
1562
|
+
_response = await self._raw_client.fetch_testcase(
|
|
1563
|
+
testcase_id, request_options=request_options
|
|
1564
|
+
)
|
|
1565
|
+
return _response.data
|