aeri-python 4.0.0__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.
- aeri/__init__.py +72 -0
- aeri/_client/_validation.py +204 -0
- aeri/_client/attributes.py +188 -0
- aeri/_client/client.py +3761 -0
- aeri/_client/constants.py +65 -0
- aeri/_client/datasets.py +302 -0
- aeri/_client/environment_variables.py +158 -0
- aeri/_client/get_client.py +149 -0
- aeri/_client/observe.py +661 -0
- aeri/_client/propagation.py +475 -0
- aeri/_client/resource_manager.py +510 -0
- aeri/_client/span.py +1519 -0
- aeri/_client/span_filter.py +76 -0
- aeri/_client/span_processor.py +206 -0
- aeri/_client/utils.py +132 -0
- aeri/_task_manager/media_manager.py +331 -0
- aeri/_task_manager/media_upload_consumer.py +44 -0
- aeri/_task_manager/media_upload_queue.py +12 -0
- aeri/_task_manager/score_ingestion_consumer.py +208 -0
- aeri/_task_manager/task_manager.py +475 -0
- aeri/_utils/__init__.py +19 -0
- aeri/_utils/environment.py +34 -0
- aeri/_utils/error_logging.py +47 -0
- aeri/_utils/parse_error.py +99 -0
- aeri/_utils/prompt_cache.py +188 -0
- aeri/_utils/request.py +137 -0
- aeri/_utils/serializer.py +205 -0
- aeri/api/.fern/metadata.json +14 -0
- aeri/api/__init__.py +836 -0
- aeri/api/annotation_queues/__init__.py +82 -0
- aeri/api/annotation_queues/client.py +1111 -0
- aeri/api/annotation_queues/raw_client.py +2288 -0
- aeri/api/annotation_queues/types/__init__.py +84 -0
- aeri/api/annotation_queues/types/annotation_queue.py +28 -0
- aeri/api/annotation_queues/types/annotation_queue_assignment_request.py +16 -0
- aeri/api/annotation_queues/types/annotation_queue_item.py +34 -0
- aeri/api/annotation_queues/types/annotation_queue_object_type.py +26 -0
- aeri/api/annotation_queues/types/annotation_queue_status.py +22 -0
- aeri/api/annotation_queues/types/create_annotation_queue_assignment_response.py +18 -0
- aeri/api/annotation_queues/types/create_annotation_queue_item_request.py +25 -0
- aeri/api/annotation_queues/types/create_annotation_queue_request.py +20 -0
- aeri/api/annotation_queues/types/delete_annotation_queue_assignment_response.py +14 -0
- aeri/api/annotation_queues/types/delete_annotation_queue_item_response.py +15 -0
- aeri/api/annotation_queues/types/paginated_annotation_queue_items.py +17 -0
- aeri/api/annotation_queues/types/paginated_annotation_queues.py +17 -0
- aeri/api/annotation_queues/types/update_annotation_queue_item_request.py +15 -0
- aeri/api/blob_storage_integrations/__init__.py +73 -0
- aeri/api/blob_storage_integrations/client.py +550 -0
- aeri/api/blob_storage_integrations/raw_client.py +976 -0
- aeri/api/blob_storage_integrations/types/__init__.py +77 -0
- aeri/api/blob_storage_integrations/types/blob_storage_export_frequency.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_export_mode.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_deletion_response.py +14 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_file_type.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_response.py +64 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_status_response.py +50 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integration_type.py +26 -0
- aeri/api/blob_storage_integrations/types/blob_storage_integrations_response.py +15 -0
- aeri/api/blob_storage_integrations/types/blob_storage_sync_status.py +47 -0
- aeri/api/blob_storage_integrations/types/create_blob_storage_integration_request.py +91 -0
- aeri/api/client.py +679 -0
- aeri/api/comments/__init__.py +44 -0
- aeri/api/comments/client.py +407 -0
- aeri/api/comments/raw_client.py +750 -0
- aeri/api/comments/types/__init__.py +46 -0
- aeri/api/comments/types/create_comment_request.py +47 -0
- aeri/api/comments/types/create_comment_response.py +17 -0
- aeri/api/comments/types/get_comments_response.py +17 -0
- aeri/api/commons/__init__.py +210 -0
- aeri/api/commons/errors/__init__.py +56 -0
- aeri/api/commons/errors/access_denied_error.py +12 -0
- aeri/api/commons/errors/error.py +12 -0
- aeri/api/commons/errors/method_not_allowed_error.py +12 -0
- aeri/api/commons/errors/not_found_error.py +12 -0
- aeri/api/commons/errors/unauthorized_error.py +12 -0
- aeri/api/commons/types/__init__.py +190 -0
- aeri/api/commons/types/base_score.py +90 -0
- aeri/api/commons/types/base_score_v1.py +70 -0
- aeri/api/commons/types/boolean_score.py +26 -0
- aeri/api/commons/types/boolean_score_v1.py +26 -0
- aeri/api/commons/types/categorical_score.py +26 -0
- aeri/api/commons/types/categorical_score_v1.py +26 -0
- aeri/api/commons/types/comment.py +36 -0
- aeri/api/commons/types/comment_object_type.py +30 -0
- aeri/api/commons/types/config_category.py +15 -0
- aeri/api/commons/types/correction_score.py +26 -0
- aeri/api/commons/types/create_score_value.py +5 -0
- aeri/api/commons/types/dataset.py +49 -0
- aeri/api/commons/types/dataset_item.py +58 -0
- aeri/api/commons/types/dataset_run.py +63 -0
- aeri/api/commons/types/dataset_run_item.py +40 -0
- aeri/api/commons/types/dataset_run_with_items.py +19 -0
- aeri/api/commons/types/dataset_status.py +22 -0
- aeri/api/commons/types/map_value.py +11 -0
- aeri/api/commons/types/model.py +125 -0
- aeri/api/commons/types/model_price.py +14 -0
- aeri/api/commons/types/model_usage_unit.py +42 -0
- aeri/api/commons/types/numeric_score.py +17 -0
- aeri/api/commons/types/numeric_score_v1.py +17 -0
- aeri/api/commons/types/observation.py +142 -0
- aeri/api/commons/types/observation_level.py +30 -0
- aeri/api/commons/types/observation_v2.py +235 -0
- aeri/api/commons/types/observations_view.py +89 -0
- aeri/api/commons/types/pricing_tier.py +91 -0
- aeri/api/commons/types/pricing_tier_condition.py +68 -0
- aeri/api/commons/types/pricing_tier_input.py +76 -0
- aeri/api/commons/types/pricing_tier_operator.py +42 -0
- aeri/api/commons/types/score.py +201 -0
- aeri/api/commons/types/score_config.py +66 -0
- aeri/api/commons/types/score_config_data_type.py +26 -0
- aeri/api/commons/types/score_data_type.py +30 -0
- aeri/api/commons/types/score_source.py +26 -0
- aeri/api/commons/types/score_v1.py +131 -0
- aeri/api/commons/types/session.py +25 -0
- aeri/api/commons/types/session_with_traces.py +15 -0
- aeri/api/commons/types/trace.py +84 -0
- aeri/api/commons/types/trace_with_details.py +43 -0
- aeri/api/commons/types/trace_with_full_details.py +45 -0
- aeri/api/commons/types/usage.py +59 -0
- aeri/api/core/__init__.py +111 -0
- aeri/api/core/api_error.py +23 -0
- aeri/api/core/client_wrapper.py +141 -0
- aeri/api/core/datetime_utils.py +30 -0
- aeri/api/core/enum.py +20 -0
- aeri/api/core/file.py +70 -0
- aeri/api/core/force_multipart.py +18 -0
- aeri/api/core/http_client.py +711 -0
- aeri/api/core/http_response.py +55 -0
- aeri/api/core/http_sse/__init__.py +48 -0
- aeri/api/core/http_sse/_api.py +114 -0
- aeri/api/core/http_sse/_decoders.py +66 -0
- aeri/api/core/http_sse/_exceptions.py +7 -0
- aeri/api/core/http_sse/_models.py +17 -0
- aeri/api/core/jsonable_encoder.py +102 -0
- aeri/api/core/pydantic_utilities.py +310 -0
- aeri/api/core/query_encoder.py +60 -0
- aeri/api/core/remove_none_from_dict.py +11 -0
- aeri/api/core/request_options.py +35 -0
- aeri/api/core/serialization.py +282 -0
- aeri/api/dataset_items/__init__.py +52 -0
- aeri/api/dataset_items/client.py +499 -0
- aeri/api/dataset_items/raw_client.py +973 -0
- aeri/api/dataset_items/types/__init__.py +50 -0
- aeri/api/dataset_items/types/create_dataset_item_request.py +37 -0
- aeri/api/dataset_items/types/delete_dataset_item_response.py +17 -0
- aeri/api/dataset_items/types/paginated_dataset_items.py +17 -0
- aeri/api/dataset_run_items/__init__.py +43 -0
- aeri/api/dataset_run_items/client.py +323 -0
- aeri/api/dataset_run_items/raw_client.py +547 -0
- aeri/api/dataset_run_items/types/__init__.py +44 -0
- aeri/api/dataset_run_items/types/create_dataset_run_item_request.py +51 -0
- aeri/api/dataset_run_items/types/paginated_dataset_run_items.py +17 -0
- aeri/api/datasets/__init__.py +55 -0
- aeri/api/datasets/client.py +661 -0
- aeri/api/datasets/raw_client.py +1368 -0
- aeri/api/datasets/types/__init__.py +53 -0
- aeri/api/datasets/types/create_dataset_request.py +31 -0
- aeri/api/datasets/types/delete_dataset_run_response.py +14 -0
- aeri/api/datasets/types/paginated_dataset_runs.py +17 -0
- aeri/api/datasets/types/paginated_datasets.py +17 -0
- aeri/api/health/__init__.py +44 -0
- aeri/api/health/client.py +112 -0
- aeri/api/health/errors/__init__.py +42 -0
- aeri/api/health/errors/service_unavailable_error.py +13 -0
- aeri/api/health/raw_client.py +227 -0
- aeri/api/health/types/__init__.py +40 -0
- aeri/api/health/types/health_response.py +30 -0
- aeri/api/ingestion/__init__.py +169 -0
- aeri/api/ingestion/client.py +221 -0
- aeri/api/ingestion/raw_client.py +293 -0
- aeri/api/ingestion/types/__init__.py +169 -0
- aeri/api/ingestion/types/base_event.py +27 -0
- aeri/api/ingestion/types/create_event_body.py +14 -0
- aeri/api/ingestion/types/create_event_event.py +15 -0
- aeri/api/ingestion/types/create_generation_body.py +40 -0
- aeri/api/ingestion/types/create_generation_event.py +15 -0
- aeri/api/ingestion/types/create_observation_event.py +15 -0
- aeri/api/ingestion/types/create_span_body.py +19 -0
- aeri/api/ingestion/types/create_span_event.py +15 -0
- aeri/api/ingestion/types/ingestion_error.py +17 -0
- aeri/api/ingestion/types/ingestion_event.py +155 -0
- aeri/api/ingestion/types/ingestion_response.py +17 -0
- aeri/api/ingestion/types/ingestion_success.py +15 -0
- aeri/api/ingestion/types/ingestion_usage.py +8 -0
- aeri/api/ingestion/types/observation_body.py +53 -0
- aeri/api/ingestion/types/observation_type.py +54 -0
- aeri/api/ingestion/types/open_ai_completion_usage_schema.py +26 -0
- aeri/api/ingestion/types/open_ai_response_usage_schema.py +24 -0
- aeri/api/ingestion/types/open_ai_usage.py +28 -0
- aeri/api/ingestion/types/optional_observation_body.py +36 -0
- aeri/api/ingestion/types/score_body.py +75 -0
- aeri/api/ingestion/types/score_event.py +15 -0
- aeri/api/ingestion/types/sdk_log_body.py +14 -0
- aeri/api/ingestion/types/sdk_log_event.py +15 -0
- aeri/api/ingestion/types/trace_body.py +36 -0
- aeri/api/ingestion/types/trace_event.py +15 -0
- aeri/api/ingestion/types/update_event_body.py +14 -0
- aeri/api/ingestion/types/update_generation_body.py +40 -0
- aeri/api/ingestion/types/update_generation_event.py +15 -0
- aeri/api/ingestion/types/update_observation_event.py +15 -0
- aeri/api/ingestion/types/update_span_body.py +19 -0
- aeri/api/ingestion/types/update_span_event.py +15 -0
- aeri/api/ingestion/types/usage_details.py +10 -0
- aeri/api/legacy/__init__.py +61 -0
- aeri/api/legacy/client.py +105 -0
- aeri/api/legacy/metrics_v1/__init__.py +40 -0
- aeri/api/legacy/metrics_v1/client.py +214 -0
- aeri/api/legacy/metrics_v1/raw_client.py +322 -0
- aeri/api/legacy/metrics_v1/types/__init__.py +40 -0
- aeri/api/legacy/metrics_v1/types/metrics_response.py +19 -0
- aeri/api/legacy/observations_v1/__init__.py +43 -0
- aeri/api/legacy/observations_v1/client.py +523 -0
- aeri/api/legacy/observations_v1/raw_client.py +759 -0
- aeri/api/legacy/observations_v1/types/__init__.py +44 -0
- aeri/api/legacy/observations_v1/types/observations.py +17 -0
- aeri/api/legacy/observations_v1/types/observations_views.py +17 -0
- aeri/api/legacy/raw_client.py +13 -0
- aeri/api/legacy/score_v1/__init__.py +43 -0
- aeri/api/legacy/score_v1/client.py +329 -0
- aeri/api/legacy/score_v1/raw_client.py +545 -0
- aeri/api/legacy/score_v1/types/__init__.py +44 -0
- aeri/api/legacy/score_v1/types/create_score_request.py +75 -0
- aeri/api/legacy/score_v1/types/create_score_response.py +17 -0
- aeri/api/llm_connections/__init__.py +55 -0
- aeri/api/llm_connections/client.py +311 -0
- aeri/api/llm_connections/raw_client.py +541 -0
- aeri/api/llm_connections/types/__init__.py +53 -0
- aeri/api/llm_connections/types/llm_adapter.py +38 -0
- aeri/api/llm_connections/types/llm_connection.py +77 -0
- aeri/api/llm_connections/types/paginated_llm_connections.py +17 -0
- aeri/api/llm_connections/types/upsert_llm_connection_request.py +69 -0
- aeri/api/media/__init__.py +58 -0
- aeri/api/media/client.py +427 -0
- aeri/api/media/raw_client.py +739 -0
- aeri/api/media/types/__init__.py +56 -0
- aeri/api/media/types/get_media_response.py +55 -0
- aeri/api/media/types/get_media_upload_url_request.py +51 -0
- aeri/api/media/types/get_media_upload_url_response.py +28 -0
- aeri/api/media/types/media_content_type.py +232 -0
- aeri/api/media/types/patch_media_body.py +43 -0
- aeri/api/metrics/__init__.py +40 -0
- aeri/api/metrics/client.py +422 -0
- aeri/api/metrics/raw_client.py +530 -0
- aeri/api/metrics/types/__init__.py +40 -0
- aeri/api/metrics/types/metrics_v2response.py +19 -0
- aeri/api/models/__init__.py +43 -0
- aeri/api/models/client.py +523 -0
- aeri/api/models/raw_client.py +993 -0
- aeri/api/models/types/__init__.py +44 -0
- aeri/api/models/types/create_model_request.py +103 -0
- aeri/api/models/types/paginated_models.py +17 -0
- aeri/api/observations/__init__.py +43 -0
- aeri/api/observations/client.py +522 -0
- aeri/api/observations/raw_client.py +641 -0
- aeri/api/observations/types/__init__.py +44 -0
- aeri/api/observations/types/observations_v2meta.py +21 -0
- aeri/api/observations/types/observations_v2response.py +28 -0
- aeri/api/opentelemetry/__init__.py +67 -0
- aeri/api/opentelemetry/client.py +276 -0
- aeri/api/opentelemetry/raw_client.py +291 -0
- aeri/api/opentelemetry/types/__init__.py +65 -0
- aeri/api/opentelemetry/types/otel_attribute.py +27 -0
- aeri/api/opentelemetry/types/otel_attribute_value.py +46 -0
- aeri/api/opentelemetry/types/otel_resource.py +24 -0
- aeri/api/opentelemetry/types/otel_resource_span.py +32 -0
- aeri/api/opentelemetry/types/otel_scope.py +34 -0
- aeri/api/opentelemetry/types/otel_scope_span.py +28 -0
- aeri/api/opentelemetry/types/otel_span.py +76 -0
- aeri/api/opentelemetry/types/otel_trace_response.py +16 -0
- aeri/api/organizations/__init__.py +73 -0
- aeri/api/organizations/client.py +756 -0
- aeri/api/organizations/raw_client.py +1707 -0
- aeri/api/organizations/types/__init__.py +71 -0
- aeri/api/organizations/types/delete_membership_request.py +16 -0
- aeri/api/organizations/types/membership_deletion_response.py +17 -0
- aeri/api/organizations/types/membership_request.py +18 -0
- aeri/api/organizations/types/membership_response.py +20 -0
- aeri/api/organizations/types/membership_role.py +30 -0
- aeri/api/organizations/types/memberships_response.py +15 -0
- aeri/api/organizations/types/organization_api_key.py +31 -0
- aeri/api/organizations/types/organization_api_keys_response.py +19 -0
- aeri/api/organizations/types/organization_project.py +25 -0
- aeri/api/organizations/types/organization_projects_response.py +15 -0
- aeri/api/projects/__init__.py +67 -0
- aeri/api/projects/client.py +760 -0
- aeri/api/projects/raw_client.py +1577 -0
- aeri/api/projects/types/__init__.py +65 -0
- aeri/api/projects/types/api_key_deletion_response.py +18 -0
- aeri/api/projects/types/api_key_list.py +23 -0
- aeri/api/projects/types/api_key_response.py +30 -0
- aeri/api/projects/types/api_key_summary.py +35 -0
- aeri/api/projects/types/organization.py +22 -0
- aeri/api/projects/types/project.py +34 -0
- aeri/api/projects/types/project_deletion_response.py +15 -0
- aeri/api/projects/types/projects.py +15 -0
- aeri/api/prompt_version/__init__.py +4 -0
- aeri/api/prompt_version/client.py +157 -0
- aeri/api/prompt_version/raw_client.py +264 -0
- aeri/api/prompts/__init__.py +100 -0
- aeri/api/prompts/client.py +550 -0
- aeri/api/prompts/raw_client.py +987 -0
- aeri/api/prompts/types/__init__.py +96 -0
- aeri/api/prompts/types/base_prompt.py +42 -0
- aeri/api/prompts/types/chat_message.py +17 -0
- aeri/api/prompts/types/chat_message_type.py +15 -0
- aeri/api/prompts/types/chat_message_with_placeholders.py +8 -0
- aeri/api/prompts/types/chat_prompt.py +15 -0
- aeri/api/prompts/types/create_chat_prompt_request.py +37 -0
- aeri/api/prompts/types/create_chat_prompt_type.py +15 -0
- aeri/api/prompts/types/create_prompt_request.py +8 -0
- aeri/api/prompts/types/create_text_prompt_request.py +36 -0
- aeri/api/prompts/types/create_text_prompt_type.py +15 -0
- aeri/api/prompts/types/placeholder_message.py +16 -0
- aeri/api/prompts/types/placeholder_message_type.py +15 -0
- aeri/api/prompts/types/prompt.py +58 -0
- aeri/api/prompts/types/prompt_meta.py +35 -0
- aeri/api/prompts/types/prompt_meta_list_response.py +17 -0
- aeri/api/prompts/types/prompt_type.py +20 -0
- aeri/api/prompts/types/text_prompt.py +14 -0
- aeri/api/scim/__init__.py +94 -0
- aeri/api/scim/client.py +686 -0
- aeri/api/scim/raw_client.py +1528 -0
- aeri/api/scim/types/__init__.py +92 -0
- aeri/api/scim/types/authentication_scheme.py +20 -0
- aeri/api/scim/types/bulk_config.py +22 -0
- aeri/api/scim/types/empty_response.py +16 -0
- aeri/api/scim/types/filter_config.py +17 -0
- aeri/api/scim/types/resource_meta.py +17 -0
- aeri/api/scim/types/resource_type.py +27 -0
- aeri/api/scim/types/resource_types_response.py +21 -0
- aeri/api/scim/types/schema_extension.py +17 -0
- aeri/api/scim/types/schema_resource.py +19 -0
- aeri/api/scim/types/schemas_response.py +21 -0
- aeri/api/scim/types/scim_email.py +16 -0
- aeri/api/scim/types/scim_feature_support.py +14 -0
- aeri/api/scim/types/scim_name.py +14 -0
- aeri/api/scim/types/scim_user.py +24 -0
- aeri/api/scim/types/scim_users_list_response.py +25 -0
- aeri/api/scim/types/service_provider_config.py +36 -0
- aeri/api/scim/types/user_meta.py +20 -0
- aeri/api/score_configs/__init__.py +44 -0
- aeri/api/score_configs/client.py +526 -0
- aeri/api/score_configs/raw_client.py +1012 -0
- aeri/api/score_configs/types/__init__.py +46 -0
- aeri/api/score_configs/types/create_score_config_request.py +46 -0
- aeri/api/score_configs/types/score_configs.py +17 -0
- aeri/api/score_configs/types/update_score_config_request.py +53 -0
- aeri/api/scores/__init__.py +76 -0
- aeri/api/scores/client.py +420 -0
- aeri/api/scores/raw_client.py +656 -0
- aeri/api/scores/types/__init__.py +76 -0
- aeri/api/scores/types/get_scores_response.py +17 -0
- aeri/api/scores/types/get_scores_response_data.py +211 -0
- aeri/api/scores/types/get_scores_response_data_boolean.py +15 -0
- aeri/api/scores/types/get_scores_response_data_categorical.py +15 -0
- aeri/api/scores/types/get_scores_response_data_correction.py +15 -0
- aeri/api/scores/types/get_scores_response_data_numeric.py +15 -0
- aeri/api/scores/types/get_scores_response_trace_data.py +38 -0
- aeri/api/sessions/__init__.py +40 -0
- aeri/api/sessions/client.py +262 -0
- aeri/api/sessions/raw_client.py +500 -0
- aeri/api/sessions/types/__init__.py +40 -0
- aeri/api/sessions/types/paginated_sessions.py +17 -0
- aeri/api/trace/__init__.py +44 -0
- aeri/api/trace/client.py +728 -0
- aeri/api/trace/raw_client.py +1208 -0
- aeri/api/trace/types/__init__.py +46 -0
- aeri/api/trace/types/delete_trace_response.py +14 -0
- aeri/api/trace/types/sort.py +14 -0
- aeri/api/trace/types/traces.py +17 -0
- aeri/api/utils/__init__.py +44 -0
- aeri/api/utils/pagination/__init__.py +40 -0
- aeri/api/utils/pagination/types/__init__.py +40 -0
- aeri/api/utils/pagination/types/meta_response.py +38 -0
- aeri/batch_evaluation.py +1643 -0
- aeri/experiment.py +1044 -0
- aeri/langchain/CallbackHandler.py +1377 -0
- aeri/langchain/__init__.py +5 -0
- aeri/langchain/utils.py +212 -0
- aeri/logger.py +28 -0
- aeri/media.py +352 -0
- aeri/model.py +477 -0
- aeri/openai.py +1124 -0
- aeri/py.typed +0 -0
- aeri/span_filter.py +17 -0
- aeri/types.py +79 -0
- aeri/version.py +3 -0
- aeri_python-4.0.0.dist-info/METADATA +51 -0
- aeri_python-4.0.0.dist-info/RECORD +391 -0
- aeri_python-4.0.0.dist-info/WHEEL +4 -0
- aeri_python-4.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,973 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ..commons.errors.access_denied_error import AccessDeniedError
|
|
8
|
+
from ..commons.errors.error import Error
|
|
9
|
+
from ..commons.errors.method_not_allowed_error import MethodNotAllowedError
|
|
10
|
+
from ..commons.errors.not_found_error import NotFoundError
|
|
11
|
+
from ..commons.errors.unauthorized_error import UnauthorizedError
|
|
12
|
+
from ..commons.types.dataset_item import DatasetItem
|
|
13
|
+
from ..commons.types.dataset_status import DatasetStatus
|
|
14
|
+
from ..core.api_error import ApiError
|
|
15
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
16
|
+
from ..core.datetime_utils import serialize_datetime
|
|
17
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
18
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
19
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
20
|
+
from ..core.request_options import RequestOptions
|
|
21
|
+
from .types.delete_dataset_item_response import DeleteDatasetItemResponse
|
|
22
|
+
from .types.paginated_dataset_items import PaginatedDatasetItems
|
|
23
|
+
|
|
24
|
+
# this is used as the default value for optional parameters
|
|
25
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RawDatasetItemsClient:
|
|
29
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
30
|
+
self._client_wrapper = client_wrapper
|
|
31
|
+
|
|
32
|
+
def create(
|
|
33
|
+
self,
|
|
34
|
+
*,
|
|
35
|
+
dataset_name: str,
|
|
36
|
+
input: typing.Optional[typing.Any] = OMIT,
|
|
37
|
+
expected_output: typing.Optional[typing.Any] = OMIT,
|
|
38
|
+
metadata: typing.Optional[typing.Any] = OMIT,
|
|
39
|
+
source_trace_id: typing.Optional[str] = OMIT,
|
|
40
|
+
source_observation_id: typing.Optional[str] = OMIT,
|
|
41
|
+
id: typing.Optional[str] = OMIT,
|
|
42
|
+
status: typing.Optional[DatasetStatus] = OMIT,
|
|
43
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
44
|
+
) -> HttpResponse[DatasetItem]:
|
|
45
|
+
"""
|
|
46
|
+
Create a dataset item
|
|
47
|
+
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
dataset_name : str
|
|
51
|
+
|
|
52
|
+
input : typing.Optional[typing.Any]
|
|
53
|
+
|
|
54
|
+
expected_output : typing.Optional[typing.Any]
|
|
55
|
+
|
|
56
|
+
metadata : typing.Optional[typing.Any]
|
|
57
|
+
|
|
58
|
+
source_trace_id : typing.Optional[str]
|
|
59
|
+
|
|
60
|
+
source_observation_id : typing.Optional[str]
|
|
61
|
+
|
|
62
|
+
id : typing.Optional[str]
|
|
63
|
+
Dataset items are upserted on their id. Id needs to be unique (project-level) and cannot be reused across datasets.
|
|
64
|
+
|
|
65
|
+
status : typing.Optional[DatasetStatus]
|
|
66
|
+
Defaults to ACTIVE for newly created items
|
|
67
|
+
|
|
68
|
+
request_options : typing.Optional[RequestOptions]
|
|
69
|
+
Request-specific configuration.
|
|
70
|
+
|
|
71
|
+
Returns
|
|
72
|
+
-------
|
|
73
|
+
HttpResponse[DatasetItem]
|
|
74
|
+
"""
|
|
75
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
76
|
+
"api/public/dataset-items",
|
|
77
|
+
method="POST",
|
|
78
|
+
json={
|
|
79
|
+
"datasetName": dataset_name,
|
|
80
|
+
"input": input,
|
|
81
|
+
"expectedOutput": expected_output,
|
|
82
|
+
"metadata": metadata,
|
|
83
|
+
"sourceTraceId": source_trace_id,
|
|
84
|
+
"sourceObservationId": source_observation_id,
|
|
85
|
+
"id": id,
|
|
86
|
+
"status": status,
|
|
87
|
+
},
|
|
88
|
+
request_options=request_options,
|
|
89
|
+
omit=OMIT,
|
|
90
|
+
)
|
|
91
|
+
try:
|
|
92
|
+
if 200 <= _response.status_code < 300:
|
|
93
|
+
_data = typing.cast(
|
|
94
|
+
DatasetItem,
|
|
95
|
+
parse_obj_as(
|
|
96
|
+
type_=DatasetItem, # type: ignore
|
|
97
|
+
object_=_response.json(),
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
return HttpResponse(response=_response, data=_data)
|
|
101
|
+
if _response.status_code == 400:
|
|
102
|
+
raise Error(
|
|
103
|
+
headers=dict(_response.headers),
|
|
104
|
+
body=typing.cast(
|
|
105
|
+
typing.Any,
|
|
106
|
+
parse_obj_as(
|
|
107
|
+
type_=typing.Any, # type: ignore
|
|
108
|
+
object_=_response.json(),
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
if _response.status_code == 401:
|
|
113
|
+
raise UnauthorizedError(
|
|
114
|
+
headers=dict(_response.headers),
|
|
115
|
+
body=typing.cast(
|
|
116
|
+
typing.Any,
|
|
117
|
+
parse_obj_as(
|
|
118
|
+
type_=typing.Any, # type: ignore
|
|
119
|
+
object_=_response.json(),
|
|
120
|
+
),
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
if _response.status_code == 403:
|
|
124
|
+
raise AccessDeniedError(
|
|
125
|
+
headers=dict(_response.headers),
|
|
126
|
+
body=typing.cast(
|
|
127
|
+
typing.Any,
|
|
128
|
+
parse_obj_as(
|
|
129
|
+
type_=typing.Any, # type: ignore
|
|
130
|
+
object_=_response.json(),
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
if _response.status_code == 405:
|
|
135
|
+
raise MethodNotAllowedError(
|
|
136
|
+
headers=dict(_response.headers),
|
|
137
|
+
body=typing.cast(
|
|
138
|
+
typing.Any,
|
|
139
|
+
parse_obj_as(
|
|
140
|
+
type_=typing.Any, # type: ignore
|
|
141
|
+
object_=_response.json(),
|
|
142
|
+
),
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
if _response.status_code == 404:
|
|
146
|
+
raise NotFoundError(
|
|
147
|
+
headers=dict(_response.headers),
|
|
148
|
+
body=typing.cast(
|
|
149
|
+
typing.Any,
|
|
150
|
+
parse_obj_as(
|
|
151
|
+
type_=typing.Any, # type: ignore
|
|
152
|
+
object_=_response.json(),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
_response_json = _response.json()
|
|
157
|
+
except JSONDecodeError:
|
|
158
|
+
raise ApiError(
|
|
159
|
+
status_code=_response.status_code,
|
|
160
|
+
headers=dict(_response.headers),
|
|
161
|
+
body=_response.text,
|
|
162
|
+
)
|
|
163
|
+
raise ApiError(
|
|
164
|
+
status_code=_response.status_code,
|
|
165
|
+
headers=dict(_response.headers),
|
|
166
|
+
body=_response_json,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
def get(
|
|
170
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
171
|
+
) -> HttpResponse[DatasetItem]:
|
|
172
|
+
"""
|
|
173
|
+
Get a dataset item
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
id : str
|
|
178
|
+
|
|
179
|
+
request_options : typing.Optional[RequestOptions]
|
|
180
|
+
Request-specific configuration.
|
|
181
|
+
|
|
182
|
+
Returns
|
|
183
|
+
-------
|
|
184
|
+
HttpResponse[DatasetItem]
|
|
185
|
+
"""
|
|
186
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
187
|
+
f"api/public/dataset-items/{jsonable_encoder(id)}",
|
|
188
|
+
method="GET",
|
|
189
|
+
request_options=request_options,
|
|
190
|
+
)
|
|
191
|
+
try:
|
|
192
|
+
if 200 <= _response.status_code < 300:
|
|
193
|
+
_data = typing.cast(
|
|
194
|
+
DatasetItem,
|
|
195
|
+
parse_obj_as(
|
|
196
|
+
type_=DatasetItem, # type: ignore
|
|
197
|
+
object_=_response.json(),
|
|
198
|
+
),
|
|
199
|
+
)
|
|
200
|
+
return HttpResponse(response=_response, data=_data)
|
|
201
|
+
if _response.status_code == 400:
|
|
202
|
+
raise Error(
|
|
203
|
+
headers=dict(_response.headers),
|
|
204
|
+
body=typing.cast(
|
|
205
|
+
typing.Any,
|
|
206
|
+
parse_obj_as(
|
|
207
|
+
type_=typing.Any, # type: ignore
|
|
208
|
+
object_=_response.json(),
|
|
209
|
+
),
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
if _response.status_code == 401:
|
|
213
|
+
raise UnauthorizedError(
|
|
214
|
+
headers=dict(_response.headers),
|
|
215
|
+
body=typing.cast(
|
|
216
|
+
typing.Any,
|
|
217
|
+
parse_obj_as(
|
|
218
|
+
type_=typing.Any, # type: ignore
|
|
219
|
+
object_=_response.json(),
|
|
220
|
+
),
|
|
221
|
+
),
|
|
222
|
+
)
|
|
223
|
+
if _response.status_code == 403:
|
|
224
|
+
raise AccessDeniedError(
|
|
225
|
+
headers=dict(_response.headers),
|
|
226
|
+
body=typing.cast(
|
|
227
|
+
typing.Any,
|
|
228
|
+
parse_obj_as(
|
|
229
|
+
type_=typing.Any, # type: ignore
|
|
230
|
+
object_=_response.json(),
|
|
231
|
+
),
|
|
232
|
+
),
|
|
233
|
+
)
|
|
234
|
+
if _response.status_code == 405:
|
|
235
|
+
raise MethodNotAllowedError(
|
|
236
|
+
headers=dict(_response.headers),
|
|
237
|
+
body=typing.cast(
|
|
238
|
+
typing.Any,
|
|
239
|
+
parse_obj_as(
|
|
240
|
+
type_=typing.Any, # type: ignore
|
|
241
|
+
object_=_response.json(),
|
|
242
|
+
),
|
|
243
|
+
),
|
|
244
|
+
)
|
|
245
|
+
if _response.status_code == 404:
|
|
246
|
+
raise NotFoundError(
|
|
247
|
+
headers=dict(_response.headers),
|
|
248
|
+
body=typing.cast(
|
|
249
|
+
typing.Any,
|
|
250
|
+
parse_obj_as(
|
|
251
|
+
type_=typing.Any, # type: ignore
|
|
252
|
+
object_=_response.json(),
|
|
253
|
+
),
|
|
254
|
+
),
|
|
255
|
+
)
|
|
256
|
+
_response_json = _response.json()
|
|
257
|
+
except JSONDecodeError:
|
|
258
|
+
raise ApiError(
|
|
259
|
+
status_code=_response.status_code,
|
|
260
|
+
headers=dict(_response.headers),
|
|
261
|
+
body=_response.text,
|
|
262
|
+
)
|
|
263
|
+
raise ApiError(
|
|
264
|
+
status_code=_response.status_code,
|
|
265
|
+
headers=dict(_response.headers),
|
|
266
|
+
body=_response_json,
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
def list(
|
|
270
|
+
self,
|
|
271
|
+
*,
|
|
272
|
+
dataset_name: typing.Optional[str] = None,
|
|
273
|
+
source_trace_id: typing.Optional[str] = None,
|
|
274
|
+
source_observation_id: typing.Optional[str] = None,
|
|
275
|
+
version: typing.Optional[dt.datetime] = None,
|
|
276
|
+
page: typing.Optional[int] = None,
|
|
277
|
+
limit: typing.Optional[int] = None,
|
|
278
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
279
|
+
) -> HttpResponse[PaginatedDatasetItems]:
|
|
280
|
+
"""
|
|
281
|
+
Get dataset items. Optionally specify a version to get the items as they existed at that point in time.
|
|
282
|
+
Note: If version parameter is provided, datasetName must also be provided.
|
|
283
|
+
|
|
284
|
+
Parameters
|
|
285
|
+
----------
|
|
286
|
+
dataset_name : typing.Optional[str]
|
|
287
|
+
|
|
288
|
+
source_trace_id : typing.Optional[str]
|
|
289
|
+
|
|
290
|
+
source_observation_id : typing.Optional[str]
|
|
291
|
+
|
|
292
|
+
version : typing.Optional[dt.datetime]
|
|
293
|
+
ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z").
|
|
294
|
+
If provided, returns state of dataset at this timestamp.
|
|
295
|
+
If not provided, returns the latest version. Requires datasetName to be specified.
|
|
296
|
+
|
|
297
|
+
page : typing.Optional[int]
|
|
298
|
+
page number, starts at 1
|
|
299
|
+
|
|
300
|
+
limit : typing.Optional[int]
|
|
301
|
+
limit of items per page
|
|
302
|
+
|
|
303
|
+
request_options : typing.Optional[RequestOptions]
|
|
304
|
+
Request-specific configuration.
|
|
305
|
+
|
|
306
|
+
Returns
|
|
307
|
+
-------
|
|
308
|
+
HttpResponse[PaginatedDatasetItems]
|
|
309
|
+
"""
|
|
310
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
311
|
+
"api/public/dataset-items",
|
|
312
|
+
method="GET",
|
|
313
|
+
params={
|
|
314
|
+
"datasetName": dataset_name,
|
|
315
|
+
"sourceTraceId": source_trace_id,
|
|
316
|
+
"sourceObservationId": source_observation_id,
|
|
317
|
+
"version": serialize_datetime(version) if version is not None else None,
|
|
318
|
+
"page": page,
|
|
319
|
+
"limit": limit,
|
|
320
|
+
},
|
|
321
|
+
request_options=request_options,
|
|
322
|
+
)
|
|
323
|
+
try:
|
|
324
|
+
if 200 <= _response.status_code < 300:
|
|
325
|
+
_data = typing.cast(
|
|
326
|
+
PaginatedDatasetItems,
|
|
327
|
+
parse_obj_as(
|
|
328
|
+
type_=PaginatedDatasetItems, # type: ignore
|
|
329
|
+
object_=_response.json(),
|
|
330
|
+
),
|
|
331
|
+
)
|
|
332
|
+
return HttpResponse(response=_response, data=_data)
|
|
333
|
+
if _response.status_code == 400:
|
|
334
|
+
raise Error(
|
|
335
|
+
headers=dict(_response.headers),
|
|
336
|
+
body=typing.cast(
|
|
337
|
+
typing.Any,
|
|
338
|
+
parse_obj_as(
|
|
339
|
+
type_=typing.Any, # type: ignore
|
|
340
|
+
object_=_response.json(),
|
|
341
|
+
),
|
|
342
|
+
),
|
|
343
|
+
)
|
|
344
|
+
if _response.status_code == 401:
|
|
345
|
+
raise UnauthorizedError(
|
|
346
|
+
headers=dict(_response.headers),
|
|
347
|
+
body=typing.cast(
|
|
348
|
+
typing.Any,
|
|
349
|
+
parse_obj_as(
|
|
350
|
+
type_=typing.Any, # type: ignore
|
|
351
|
+
object_=_response.json(),
|
|
352
|
+
),
|
|
353
|
+
),
|
|
354
|
+
)
|
|
355
|
+
if _response.status_code == 403:
|
|
356
|
+
raise AccessDeniedError(
|
|
357
|
+
headers=dict(_response.headers),
|
|
358
|
+
body=typing.cast(
|
|
359
|
+
typing.Any,
|
|
360
|
+
parse_obj_as(
|
|
361
|
+
type_=typing.Any, # type: ignore
|
|
362
|
+
object_=_response.json(),
|
|
363
|
+
),
|
|
364
|
+
),
|
|
365
|
+
)
|
|
366
|
+
if _response.status_code == 405:
|
|
367
|
+
raise MethodNotAllowedError(
|
|
368
|
+
headers=dict(_response.headers),
|
|
369
|
+
body=typing.cast(
|
|
370
|
+
typing.Any,
|
|
371
|
+
parse_obj_as(
|
|
372
|
+
type_=typing.Any, # type: ignore
|
|
373
|
+
object_=_response.json(),
|
|
374
|
+
),
|
|
375
|
+
),
|
|
376
|
+
)
|
|
377
|
+
if _response.status_code == 404:
|
|
378
|
+
raise NotFoundError(
|
|
379
|
+
headers=dict(_response.headers),
|
|
380
|
+
body=typing.cast(
|
|
381
|
+
typing.Any,
|
|
382
|
+
parse_obj_as(
|
|
383
|
+
type_=typing.Any, # type: ignore
|
|
384
|
+
object_=_response.json(),
|
|
385
|
+
),
|
|
386
|
+
),
|
|
387
|
+
)
|
|
388
|
+
_response_json = _response.json()
|
|
389
|
+
except JSONDecodeError:
|
|
390
|
+
raise ApiError(
|
|
391
|
+
status_code=_response.status_code,
|
|
392
|
+
headers=dict(_response.headers),
|
|
393
|
+
body=_response.text,
|
|
394
|
+
)
|
|
395
|
+
raise ApiError(
|
|
396
|
+
status_code=_response.status_code,
|
|
397
|
+
headers=dict(_response.headers),
|
|
398
|
+
body=_response_json,
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
def delete(
|
|
402
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
403
|
+
) -> HttpResponse[DeleteDatasetItemResponse]:
|
|
404
|
+
"""
|
|
405
|
+
Delete a dataset item and all its run items. This action is irreversible.
|
|
406
|
+
|
|
407
|
+
Parameters
|
|
408
|
+
----------
|
|
409
|
+
id : str
|
|
410
|
+
|
|
411
|
+
request_options : typing.Optional[RequestOptions]
|
|
412
|
+
Request-specific configuration.
|
|
413
|
+
|
|
414
|
+
Returns
|
|
415
|
+
-------
|
|
416
|
+
HttpResponse[DeleteDatasetItemResponse]
|
|
417
|
+
"""
|
|
418
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
419
|
+
f"api/public/dataset-items/{jsonable_encoder(id)}",
|
|
420
|
+
method="DELETE",
|
|
421
|
+
request_options=request_options,
|
|
422
|
+
)
|
|
423
|
+
try:
|
|
424
|
+
if 200 <= _response.status_code < 300:
|
|
425
|
+
_data = typing.cast(
|
|
426
|
+
DeleteDatasetItemResponse,
|
|
427
|
+
parse_obj_as(
|
|
428
|
+
type_=DeleteDatasetItemResponse, # type: ignore
|
|
429
|
+
object_=_response.json(),
|
|
430
|
+
),
|
|
431
|
+
)
|
|
432
|
+
return HttpResponse(response=_response, data=_data)
|
|
433
|
+
if _response.status_code == 400:
|
|
434
|
+
raise Error(
|
|
435
|
+
headers=dict(_response.headers),
|
|
436
|
+
body=typing.cast(
|
|
437
|
+
typing.Any,
|
|
438
|
+
parse_obj_as(
|
|
439
|
+
type_=typing.Any, # type: ignore
|
|
440
|
+
object_=_response.json(),
|
|
441
|
+
),
|
|
442
|
+
),
|
|
443
|
+
)
|
|
444
|
+
if _response.status_code == 401:
|
|
445
|
+
raise UnauthorizedError(
|
|
446
|
+
headers=dict(_response.headers),
|
|
447
|
+
body=typing.cast(
|
|
448
|
+
typing.Any,
|
|
449
|
+
parse_obj_as(
|
|
450
|
+
type_=typing.Any, # type: ignore
|
|
451
|
+
object_=_response.json(),
|
|
452
|
+
),
|
|
453
|
+
),
|
|
454
|
+
)
|
|
455
|
+
if _response.status_code == 403:
|
|
456
|
+
raise AccessDeniedError(
|
|
457
|
+
headers=dict(_response.headers),
|
|
458
|
+
body=typing.cast(
|
|
459
|
+
typing.Any,
|
|
460
|
+
parse_obj_as(
|
|
461
|
+
type_=typing.Any, # type: ignore
|
|
462
|
+
object_=_response.json(),
|
|
463
|
+
),
|
|
464
|
+
),
|
|
465
|
+
)
|
|
466
|
+
if _response.status_code == 405:
|
|
467
|
+
raise MethodNotAllowedError(
|
|
468
|
+
headers=dict(_response.headers),
|
|
469
|
+
body=typing.cast(
|
|
470
|
+
typing.Any,
|
|
471
|
+
parse_obj_as(
|
|
472
|
+
type_=typing.Any, # type: ignore
|
|
473
|
+
object_=_response.json(),
|
|
474
|
+
),
|
|
475
|
+
),
|
|
476
|
+
)
|
|
477
|
+
if _response.status_code == 404:
|
|
478
|
+
raise NotFoundError(
|
|
479
|
+
headers=dict(_response.headers),
|
|
480
|
+
body=typing.cast(
|
|
481
|
+
typing.Any,
|
|
482
|
+
parse_obj_as(
|
|
483
|
+
type_=typing.Any, # type: ignore
|
|
484
|
+
object_=_response.json(),
|
|
485
|
+
),
|
|
486
|
+
),
|
|
487
|
+
)
|
|
488
|
+
_response_json = _response.json()
|
|
489
|
+
except JSONDecodeError:
|
|
490
|
+
raise ApiError(
|
|
491
|
+
status_code=_response.status_code,
|
|
492
|
+
headers=dict(_response.headers),
|
|
493
|
+
body=_response.text,
|
|
494
|
+
)
|
|
495
|
+
raise ApiError(
|
|
496
|
+
status_code=_response.status_code,
|
|
497
|
+
headers=dict(_response.headers),
|
|
498
|
+
body=_response_json,
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
class AsyncRawDatasetItemsClient:
|
|
503
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
504
|
+
self._client_wrapper = client_wrapper
|
|
505
|
+
|
|
506
|
+
async def create(
|
|
507
|
+
self,
|
|
508
|
+
*,
|
|
509
|
+
dataset_name: str,
|
|
510
|
+
input: typing.Optional[typing.Any] = OMIT,
|
|
511
|
+
expected_output: typing.Optional[typing.Any] = OMIT,
|
|
512
|
+
metadata: typing.Optional[typing.Any] = OMIT,
|
|
513
|
+
source_trace_id: typing.Optional[str] = OMIT,
|
|
514
|
+
source_observation_id: typing.Optional[str] = OMIT,
|
|
515
|
+
id: typing.Optional[str] = OMIT,
|
|
516
|
+
status: typing.Optional[DatasetStatus] = OMIT,
|
|
517
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
518
|
+
) -> AsyncHttpResponse[DatasetItem]:
|
|
519
|
+
"""
|
|
520
|
+
Create a dataset item
|
|
521
|
+
|
|
522
|
+
Parameters
|
|
523
|
+
----------
|
|
524
|
+
dataset_name : str
|
|
525
|
+
|
|
526
|
+
input : typing.Optional[typing.Any]
|
|
527
|
+
|
|
528
|
+
expected_output : typing.Optional[typing.Any]
|
|
529
|
+
|
|
530
|
+
metadata : typing.Optional[typing.Any]
|
|
531
|
+
|
|
532
|
+
source_trace_id : typing.Optional[str]
|
|
533
|
+
|
|
534
|
+
source_observation_id : typing.Optional[str]
|
|
535
|
+
|
|
536
|
+
id : typing.Optional[str]
|
|
537
|
+
Dataset items are upserted on their id. Id needs to be unique (project-level) and cannot be reused across datasets.
|
|
538
|
+
|
|
539
|
+
status : typing.Optional[DatasetStatus]
|
|
540
|
+
Defaults to ACTIVE for newly created items
|
|
541
|
+
|
|
542
|
+
request_options : typing.Optional[RequestOptions]
|
|
543
|
+
Request-specific configuration.
|
|
544
|
+
|
|
545
|
+
Returns
|
|
546
|
+
-------
|
|
547
|
+
AsyncHttpResponse[DatasetItem]
|
|
548
|
+
"""
|
|
549
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
550
|
+
"api/public/dataset-items",
|
|
551
|
+
method="POST",
|
|
552
|
+
json={
|
|
553
|
+
"datasetName": dataset_name,
|
|
554
|
+
"input": input,
|
|
555
|
+
"expectedOutput": expected_output,
|
|
556
|
+
"metadata": metadata,
|
|
557
|
+
"sourceTraceId": source_trace_id,
|
|
558
|
+
"sourceObservationId": source_observation_id,
|
|
559
|
+
"id": id,
|
|
560
|
+
"status": status,
|
|
561
|
+
},
|
|
562
|
+
request_options=request_options,
|
|
563
|
+
omit=OMIT,
|
|
564
|
+
)
|
|
565
|
+
try:
|
|
566
|
+
if 200 <= _response.status_code < 300:
|
|
567
|
+
_data = typing.cast(
|
|
568
|
+
DatasetItem,
|
|
569
|
+
parse_obj_as(
|
|
570
|
+
type_=DatasetItem, # type: ignore
|
|
571
|
+
object_=_response.json(),
|
|
572
|
+
),
|
|
573
|
+
)
|
|
574
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
575
|
+
if _response.status_code == 400:
|
|
576
|
+
raise Error(
|
|
577
|
+
headers=dict(_response.headers),
|
|
578
|
+
body=typing.cast(
|
|
579
|
+
typing.Any,
|
|
580
|
+
parse_obj_as(
|
|
581
|
+
type_=typing.Any, # type: ignore
|
|
582
|
+
object_=_response.json(),
|
|
583
|
+
),
|
|
584
|
+
),
|
|
585
|
+
)
|
|
586
|
+
if _response.status_code == 401:
|
|
587
|
+
raise UnauthorizedError(
|
|
588
|
+
headers=dict(_response.headers),
|
|
589
|
+
body=typing.cast(
|
|
590
|
+
typing.Any,
|
|
591
|
+
parse_obj_as(
|
|
592
|
+
type_=typing.Any, # type: ignore
|
|
593
|
+
object_=_response.json(),
|
|
594
|
+
),
|
|
595
|
+
),
|
|
596
|
+
)
|
|
597
|
+
if _response.status_code == 403:
|
|
598
|
+
raise AccessDeniedError(
|
|
599
|
+
headers=dict(_response.headers),
|
|
600
|
+
body=typing.cast(
|
|
601
|
+
typing.Any,
|
|
602
|
+
parse_obj_as(
|
|
603
|
+
type_=typing.Any, # type: ignore
|
|
604
|
+
object_=_response.json(),
|
|
605
|
+
),
|
|
606
|
+
),
|
|
607
|
+
)
|
|
608
|
+
if _response.status_code == 405:
|
|
609
|
+
raise MethodNotAllowedError(
|
|
610
|
+
headers=dict(_response.headers),
|
|
611
|
+
body=typing.cast(
|
|
612
|
+
typing.Any,
|
|
613
|
+
parse_obj_as(
|
|
614
|
+
type_=typing.Any, # type: ignore
|
|
615
|
+
object_=_response.json(),
|
|
616
|
+
),
|
|
617
|
+
),
|
|
618
|
+
)
|
|
619
|
+
if _response.status_code == 404:
|
|
620
|
+
raise NotFoundError(
|
|
621
|
+
headers=dict(_response.headers),
|
|
622
|
+
body=typing.cast(
|
|
623
|
+
typing.Any,
|
|
624
|
+
parse_obj_as(
|
|
625
|
+
type_=typing.Any, # type: ignore
|
|
626
|
+
object_=_response.json(),
|
|
627
|
+
),
|
|
628
|
+
),
|
|
629
|
+
)
|
|
630
|
+
_response_json = _response.json()
|
|
631
|
+
except JSONDecodeError:
|
|
632
|
+
raise ApiError(
|
|
633
|
+
status_code=_response.status_code,
|
|
634
|
+
headers=dict(_response.headers),
|
|
635
|
+
body=_response.text,
|
|
636
|
+
)
|
|
637
|
+
raise ApiError(
|
|
638
|
+
status_code=_response.status_code,
|
|
639
|
+
headers=dict(_response.headers),
|
|
640
|
+
body=_response_json,
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
async def get(
|
|
644
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
645
|
+
) -> AsyncHttpResponse[DatasetItem]:
|
|
646
|
+
"""
|
|
647
|
+
Get a dataset item
|
|
648
|
+
|
|
649
|
+
Parameters
|
|
650
|
+
----------
|
|
651
|
+
id : str
|
|
652
|
+
|
|
653
|
+
request_options : typing.Optional[RequestOptions]
|
|
654
|
+
Request-specific configuration.
|
|
655
|
+
|
|
656
|
+
Returns
|
|
657
|
+
-------
|
|
658
|
+
AsyncHttpResponse[DatasetItem]
|
|
659
|
+
"""
|
|
660
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
661
|
+
f"api/public/dataset-items/{jsonable_encoder(id)}",
|
|
662
|
+
method="GET",
|
|
663
|
+
request_options=request_options,
|
|
664
|
+
)
|
|
665
|
+
try:
|
|
666
|
+
if 200 <= _response.status_code < 300:
|
|
667
|
+
_data = typing.cast(
|
|
668
|
+
DatasetItem,
|
|
669
|
+
parse_obj_as(
|
|
670
|
+
type_=DatasetItem, # type: ignore
|
|
671
|
+
object_=_response.json(),
|
|
672
|
+
),
|
|
673
|
+
)
|
|
674
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
675
|
+
if _response.status_code == 400:
|
|
676
|
+
raise Error(
|
|
677
|
+
headers=dict(_response.headers),
|
|
678
|
+
body=typing.cast(
|
|
679
|
+
typing.Any,
|
|
680
|
+
parse_obj_as(
|
|
681
|
+
type_=typing.Any, # type: ignore
|
|
682
|
+
object_=_response.json(),
|
|
683
|
+
),
|
|
684
|
+
),
|
|
685
|
+
)
|
|
686
|
+
if _response.status_code == 401:
|
|
687
|
+
raise UnauthorizedError(
|
|
688
|
+
headers=dict(_response.headers),
|
|
689
|
+
body=typing.cast(
|
|
690
|
+
typing.Any,
|
|
691
|
+
parse_obj_as(
|
|
692
|
+
type_=typing.Any, # type: ignore
|
|
693
|
+
object_=_response.json(),
|
|
694
|
+
),
|
|
695
|
+
),
|
|
696
|
+
)
|
|
697
|
+
if _response.status_code == 403:
|
|
698
|
+
raise AccessDeniedError(
|
|
699
|
+
headers=dict(_response.headers),
|
|
700
|
+
body=typing.cast(
|
|
701
|
+
typing.Any,
|
|
702
|
+
parse_obj_as(
|
|
703
|
+
type_=typing.Any, # type: ignore
|
|
704
|
+
object_=_response.json(),
|
|
705
|
+
),
|
|
706
|
+
),
|
|
707
|
+
)
|
|
708
|
+
if _response.status_code == 405:
|
|
709
|
+
raise MethodNotAllowedError(
|
|
710
|
+
headers=dict(_response.headers),
|
|
711
|
+
body=typing.cast(
|
|
712
|
+
typing.Any,
|
|
713
|
+
parse_obj_as(
|
|
714
|
+
type_=typing.Any, # type: ignore
|
|
715
|
+
object_=_response.json(),
|
|
716
|
+
),
|
|
717
|
+
),
|
|
718
|
+
)
|
|
719
|
+
if _response.status_code == 404:
|
|
720
|
+
raise NotFoundError(
|
|
721
|
+
headers=dict(_response.headers),
|
|
722
|
+
body=typing.cast(
|
|
723
|
+
typing.Any,
|
|
724
|
+
parse_obj_as(
|
|
725
|
+
type_=typing.Any, # type: ignore
|
|
726
|
+
object_=_response.json(),
|
|
727
|
+
),
|
|
728
|
+
),
|
|
729
|
+
)
|
|
730
|
+
_response_json = _response.json()
|
|
731
|
+
except JSONDecodeError:
|
|
732
|
+
raise ApiError(
|
|
733
|
+
status_code=_response.status_code,
|
|
734
|
+
headers=dict(_response.headers),
|
|
735
|
+
body=_response.text,
|
|
736
|
+
)
|
|
737
|
+
raise ApiError(
|
|
738
|
+
status_code=_response.status_code,
|
|
739
|
+
headers=dict(_response.headers),
|
|
740
|
+
body=_response_json,
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
async def list(
|
|
744
|
+
self,
|
|
745
|
+
*,
|
|
746
|
+
dataset_name: typing.Optional[str] = None,
|
|
747
|
+
source_trace_id: typing.Optional[str] = None,
|
|
748
|
+
source_observation_id: typing.Optional[str] = None,
|
|
749
|
+
version: typing.Optional[dt.datetime] = None,
|
|
750
|
+
page: typing.Optional[int] = None,
|
|
751
|
+
limit: typing.Optional[int] = None,
|
|
752
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
753
|
+
) -> AsyncHttpResponse[PaginatedDatasetItems]:
|
|
754
|
+
"""
|
|
755
|
+
Get dataset items. Optionally specify a version to get the items as they existed at that point in time.
|
|
756
|
+
Note: If version parameter is provided, datasetName must also be provided.
|
|
757
|
+
|
|
758
|
+
Parameters
|
|
759
|
+
----------
|
|
760
|
+
dataset_name : typing.Optional[str]
|
|
761
|
+
|
|
762
|
+
source_trace_id : typing.Optional[str]
|
|
763
|
+
|
|
764
|
+
source_observation_id : typing.Optional[str]
|
|
765
|
+
|
|
766
|
+
version : typing.Optional[dt.datetime]
|
|
767
|
+
ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z").
|
|
768
|
+
If provided, returns state of dataset at this timestamp.
|
|
769
|
+
If not provided, returns the latest version. Requires datasetName to be specified.
|
|
770
|
+
|
|
771
|
+
page : typing.Optional[int]
|
|
772
|
+
page number, starts at 1
|
|
773
|
+
|
|
774
|
+
limit : typing.Optional[int]
|
|
775
|
+
limit of items per page
|
|
776
|
+
|
|
777
|
+
request_options : typing.Optional[RequestOptions]
|
|
778
|
+
Request-specific configuration.
|
|
779
|
+
|
|
780
|
+
Returns
|
|
781
|
+
-------
|
|
782
|
+
AsyncHttpResponse[PaginatedDatasetItems]
|
|
783
|
+
"""
|
|
784
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
785
|
+
"api/public/dataset-items",
|
|
786
|
+
method="GET",
|
|
787
|
+
params={
|
|
788
|
+
"datasetName": dataset_name,
|
|
789
|
+
"sourceTraceId": source_trace_id,
|
|
790
|
+
"sourceObservationId": source_observation_id,
|
|
791
|
+
"version": serialize_datetime(version) if version is not None else None,
|
|
792
|
+
"page": page,
|
|
793
|
+
"limit": limit,
|
|
794
|
+
},
|
|
795
|
+
request_options=request_options,
|
|
796
|
+
)
|
|
797
|
+
try:
|
|
798
|
+
if 200 <= _response.status_code < 300:
|
|
799
|
+
_data = typing.cast(
|
|
800
|
+
PaginatedDatasetItems,
|
|
801
|
+
parse_obj_as(
|
|
802
|
+
type_=PaginatedDatasetItems, # type: ignore
|
|
803
|
+
object_=_response.json(),
|
|
804
|
+
),
|
|
805
|
+
)
|
|
806
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
807
|
+
if _response.status_code == 400:
|
|
808
|
+
raise Error(
|
|
809
|
+
headers=dict(_response.headers),
|
|
810
|
+
body=typing.cast(
|
|
811
|
+
typing.Any,
|
|
812
|
+
parse_obj_as(
|
|
813
|
+
type_=typing.Any, # type: ignore
|
|
814
|
+
object_=_response.json(),
|
|
815
|
+
),
|
|
816
|
+
),
|
|
817
|
+
)
|
|
818
|
+
if _response.status_code == 401:
|
|
819
|
+
raise UnauthorizedError(
|
|
820
|
+
headers=dict(_response.headers),
|
|
821
|
+
body=typing.cast(
|
|
822
|
+
typing.Any,
|
|
823
|
+
parse_obj_as(
|
|
824
|
+
type_=typing.Any, # type: ignore
|
|
825
|
+
object_=_response.json(),
|
|
826
|
+
),
|
|
827
|
+
),
|
|
828
|
+
)
|
|
829
|
+
if _response.status_code == 403:
|
|
830
|
+
raise AccessDeniedError(
|
|
831
|
+
headers=dict(_response.headers),
|
|
832
|
+
body=typing.cast(
|
|
833
|
+
typing.Any,
|
|
834
|
+
parse_obj_as(
|
|
835
|
+
type_=typing.Any, # type: ignore
|
|
836
|
+
object_=_response.json(),
|
|
837
|
+
),
|
|
838
|
+
),
|
|
839
|
+
)
|
|
840
|
+
if _response.status_code == 405:
|
|
841
|
+
raise MethodNotAllowedError(
|
|
842
|
+
headers=dict(_response.headers),
|
|
843
|
+
body=typing.cast(
|
|
844
|
+
typing.Any,
|
|
845
|
+
parse_obj_as(
|
|
846
|
+
type_=typing.Any, # type: ignore
|
|
847
|
+
object_=_response.json(),
|
|
848
|
+
),
|
|
849
|
+
),
|
|
850
|
+
)
|
|
851
|
+
if _response.status_code == 404:
|
|
852
|
+
raise NotFoundError(
|
|
853
|
+
headers=dict(_response.headers),
|
|
854
|
+
body=typing.cast(
|
|
855
|
+
typing.Any,
|
|
856
|
+
parse_obj_as(
|
|
857
|
+
type_=typing.Any, # type: ignore
|
|
858
|
+
object_=_response.json(),
|
|
859
|
+
),
|
|
860
|
+
),
|
|
861
|
+
)
|
|
862
|
+
_response_json = _response.json()
|
|
863
|
+
except JSONDecodeError:
|
|
864
|
+
raise ApiError(
|
|
865
|
+
status_code=_response.status_code,
|
|
866
|
+
headers=dict(_response.headers),
|
|
867
|
+
body=_response.text,
|
|
868
|
+
)
|
|
869
|
+
raise ApiError(
|
|
870
|
+
status_code=_response.status_code,
|
|
871
|
+
headers=dict(_response.headers),
|
|
872
|
+
body=_response_json,
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
async def delete(
|
|
876
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
877
|
+
) -> AsyncHttpResponse[DeleteDatasetItemResponse]:
|
|
878
|
+
"""
|
|
879
|
+
Delete a dataset item and all its run items. This action is irreversible.
|
|
880
|
+
|
|
881
|
+
Parameters
|
|
882
|
+
----------
|
|
883
|
+
id : str
|
|
884
|
+
|
|
885
|
+
request_options : typing.Optional[RequestOptions]
|
|
886
|
+
Request-specific configuration.
|
|
887
|
+
|
|
888
|
+
Returns
|
|
889
|
+
-------
|
|
890
|
+
AsyncHttpResponse[DeleteDatasetItemResponse]
|
|
891
|
+
"""
|
|
892
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
893
|
+
f"api/public/dataset-items/{jsonable_encoder(id)}",
|
|
894
|
+
method="DELETE",
|
|
895
|
+
request_options=request_options,
|
|
896
|
+
)
|
|
897
|
+
try:
|
|
898
|
+
if 200 <= _response.status_code < 300:
|
|
899
|
+
_data = typing.cast(
|
|
900
|
+
DeleteDatasetItemResponse,
|
|
901
|
+
parse_obj_as(
|
|
902
|
+
type_=DeleteDatasetItemResponse, # type: ignore
|
|
903
|
+
object_=_response.json(),
|
|
904
|
+
),
|
|
905
|
+
)
|
|
906
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
907
|
+
if _response.status_code == 400:
|
|
908
|
+
raise Error(
|
|
909
|
+
headers=dict(_response.headers),
|
|
910
|
+
body=typing.cast(
|
|
911
|
+
typing.Any,
|
|
912
|
+
parse_obj_as(
|
|
913
|
+
type_=typing.Any, # type: ignore
|
|
914
|
+
object_=_response.json(),
|
|
915
|
+
),
|
|
916
|
+
),
|
|
917
|
+
)
|
|
918
|
+
if _response.status_code == 401:
|
|
919
|
+
raise UnauthorizedError(
|
|
920
|
+
headers=dict(_response.headers),
|
|
921
|
+
body=typing.cast(
|
|
922
|
+
typing.Any,
|
|
923
|
+
parse_obj_as(
|
|
924
|
+
type_=typing.Any, # type: ignore
|
|
925
|
+
object_=_response.json(),
|
|
926
|
+
),
|
|
927
|
+
),
|
|
928
|
+
)
|
|
929
|
+
if _response.status_code == 403:
|
|
930
|
+
raise AccessDeniedError(
|
|
931
|
+
headers=dict(_response.headers),
|
|
932
|
+
body=typing.cast(
|
|
933
|
+
typing.Any,
|
|
934
|
+
parse_obj_as(
|
|
935
|
+
type_=typing.Any, # type: ignore
|
|
936
|
+
object_=_response.json(),
|
|
937
|
+
),
|
|
938
|
+
),
|
|
939
|
+
)
|
|
940
|
+
if _response.status_code == 405:
|
|
941
|
+
raise MethodNotAllowedError(
|
|
942
|
+
headers=dict(_response.headers),
|
|
943
|
+
body=typing.cast(
|
|
944
|
+
typing.Any,
|
|
945
|
+
parse_obj_as(
|
|
946
|
+
type_=typing.Any, # type: ignore
|
|
947
|
+
object_=_response.json(),
|
|
948
|
+
),
|
|
949
|
+
),
|
|
950
|
+
)
|
|
951
|
+
if _response.status_code == 404:
|
|
952
|
+
raise NotFoundError(
|
|
953
|
+
headers=dict(_response.headers),
|
|
954
|
+
body=typing.cast(
|
|
955
|
+
typing.Any,
|
|
956
|
+
parse_obj_as(
|
|
957
|
+
type_=typing.Any, # type: ignore
|
|
958
|
+
object_=_response.json(),
|
|
959
|
+
),
|
|
960
|
+
),
|
|
961
|
+
)
|
|
962
|
+
_response_json = _response.json()
|
|
963
|
+
except JSONDecodeError:
|
|
964
|
+
raise ApiError(
|
|
965
|
+
status_code=_response.status_code,
|
|
966
|
+
headers=dict(_response.headers),
|
|
967
|
+
body=_response.text,
|
|
968
|
+
)
|
|
969
|
+
raise ApiError(
|
|
970
|
+
status_code=_response.status_code,
|
|
971
|
+
headers=dict(_response.headers),
|
|
972
|
+
body=_response_json,
|
|
973
|
+
)
|