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