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
aeri/api/trace/client.py
ADDED
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
from ..commons.types.trace_with_full_details import TraceWithFullDetails
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.request_options import RequestOptions
|
|
9
|
+
from .raw_client import AsyncRawTraceClient, RawTraceClient
|
|
10
|
+
from .types.delete_trace_response import DeleteTraceResponse
|
|
11
|
+
from .types.traces import Traces
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TraceClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._raw_client = RawTraceClient(client_wrapper=client_wrapper)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def with_raw_response(self) -> RawTraceClient:
|
|
23
|
+
"""
|
|
24
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
RawTraceClient
|
|
29
|
+
"""
|
|
30
|
+
return self._raw_client
|
|
31
|
+
|
|
32
|
+
def get(
|
|
33
|
+
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
34
|
+
) -> TraceWithFullDetails:
|
|
35
|
+
"""
|
|
36
|
+
Get a specific trace
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
trace_id : str
|
|
41
|
+
The unique aeri identifier of a trace
|
|
42
|
+
|
|
43
|
+
request_options : typing.Optional[RequestOptions]
|
|
44
|
+
Request-specific configuration.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
TraceWithFullDetails
|
|
49
|
+
|
|
50
|
+
Examples
|
|
51
|
+
--------
|
|
52
|
+
from aeri import AeriAPI
|
|
53
|
+
|
|
54
|
+
client = AeriAPI(
|
|
55
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
56
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
57
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
58
|
+
username="YOUR_USERNAME",
|
|
59
|
+
password="YOUR_PASSWORD",
|
|
60
|
+
base_url="https://yourhost.com/path/to/api",
|
|
61
|
+
)
|
|
62
|
+
client.trace.get(
|
|
63
|
+
trace_id="traceId",
|
|
64
|
+
)
|
|
65
|
+
"""
|
|
66
|
+
_response = self._raw_client.get(trace_id, request_options=request_options)
|
|
67
|
+
return _response.data
|
|
68
|
+
|
|
69
|
+
def delete(
|
|
70
|
+
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
71
|
+
) -> DeleteTraceResponse:
|
|
72
|
+
"""
|
|
73
|
+
Delete a specific trace
|
|
74
|
+
|
|
75
|
+
Parameters
|
|
76
|
+
----------
|
|
77
|
+
trace_id : str
|
|
78
|
+
The unique aeri identifier of the trace to delete
|
|
79
|
+
|
|
80
|
+
request_options : typing.Optional[RequestOptions]
|
|
81
|
+
Request-specific configuration.
|
|
82
|
+
|
|
83
|
+
Returns
|
|
84
|
+
-------
|
|
85
|
+
DeleteTraceResponse
|
|
86
|
+
|
|
87
|
+
Examples
|
|
88
|
+
--------
|
|
89
|
+
from aeri import AeriAPI
|
|
90
|
+
|
|
91
|
+
client = AeriAPI(
|
|
92
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
93
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
94
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
95
|
+
username="YOUR_USERNAME",
|
|
96
|
+
password="YOUR_PASSWORD",
|
|
97
|
+
base_url="https://yourhost.com/path/to/api",
|
|
98
|
+
)
|
|
99
|
+
client.trace.delete(
|
|
100
|
+
trace_id="traceId",
|
|
101
|
+
)
|
|
102
|
+
"""
|
|
103
|
+
_response = self._raw_client.delete(trace_id, request_options=request_options)
|
|
104
|
+
return _response.data
|
|
105
|
+
|
|
106
|
+
def list(
|
|
107
|
+
self,
|
|
108
|
+
*,
|
|
109
|
+
page: typing.Optional[int] = None,
|
|
110
|
+
limit: typing.Optional[int] = None,
|
|
111
|
+
user_id: typing.Optional[str] = None,
|
|
112
|
+
name: typing.Optional[str] = None,
|
|
113
|
+
session_id: typing.Optional[str] = None,
|
|
114
|
+
from_timestamp: typing.Optional[dt.datetime] = None,
|
|
115
|
+
to_timestamp: typing.Optional[dt.datetime] = None,
|
|
116
|
+
order_by: typing.Optional[str] = None,
|
|
117
|
+
tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
118
|
+
version: typing.Optional[str] = None,
|
|
119
|
+
release: typing.Optional[str] = None,
|
|
120
|
+
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
121
|
+
fields: typing.Optional[str] = None,
|
|
122
|
+
filter: typing.Optional[str] = None,
|
|
123
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
124
|
+
) -> Traces:
|
|
125
|
+
"""
|
|
126
|
+
Get list of traces
|
|
127
|
+
|
|
128
|
+
Parameters
|
|
129
|
+
----------
|
|
130
|
+
page : typing.Optional[int]
|
|
131
|
+
Page number, starts at 1
|
|
132
|
+
|
|
133
|
+
limit : typing.Optional[int]
|
|
134
|
+
Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.
|
|
135
|
+
|
|
136
|
+
user_id : typing.Optional[str]
|
|
137
|
+
|
|
138
|
+
name : typing.Optional[str]
|
|
139
|
+
|
|
140
|
+
session_id : typing.Optional[str]
|
|
141
|
+
|
|
142
|
+
from_timestamp : typing.Optional[dt.datetime]
|
|
143
|
+
Optional filter to only include traces with a trace.timestamp on or after a certain datetime (ISO 8601)
|
|
144
|
+
|
|
145
|
+
to_timestamp : typing.Optional[dt.datetime]
|
|
146
|
+
Optional filter to only include traces with a trace.timestamp before a certain datetime (ISO 8601)
|
|
147
|
+
|
|
148
|
+
order_by : typing.Optional[str]
|
|
149
|
+
Format of the string [field].[asc/desc]. Fields: id, timestamp, name, userId, release, version, public, bookmarked, sessionId. Example: timestamp.asc
|
|
150
|
+
|
|
151
|
+
tags : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
152
|
+
Only traces that include all of these tags will be returned.
|
|
153
|
+
|
|
154
|
+
version : typing.Optional[str]
|
|
155
|
+
Optional filter to only include traces with a certain version.
|
|
156
|
+
|
|
157
|
+
release : typing.Optional[str]
|
|
158
|
+
Optional filter to only include traces with a certain release.
|
|
159
|
+
|
|
160
|
+
environment : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
161
|
+
Optional filter for traces where the environment is one of the provided values.
|
|
162
|
+
|
|
163
|
+
fields : typing.Optional[str]
|
|
164
|
+
Comma-separated list of fields to include in the response. Available field groups: 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not specified, all fields are returned. Example: 'core,scores,metrics'. Note: Excluded 'observations' or 'scores' fields return empty arrays; excluded 'metrics' returns -1 for 'totalCost' and 'latency'.
|
|
165
|
+
|
|
166
|
+
filter : typing.Optional[str]
|
|
167
|
+
JSON string containing an array of filter conditions. When provided, this takes precedence over query parameter filters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp).
|
|
168
|
+
|
|
169
|
+
## Filter Structure
|
|
170
|
+
Each filter condition has the following structure:
|
|
171
|
+
```json
|
|
172
|
+
[
|
|
173
|
+
{
|
|
174
|
+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
|
|
175
|
+
"column": string, // Required. Column to filter on (see available columns below)
|
|
176
|
+
"operator": string, // Required. Operator based on type:
|
|
177
|
+
// - datetime: ">", "<", ">=", "<="
|
|
178
|
+
// - string: "=", "contains", "does not contain", "starts with", "ends with"
|
|
179
|
+
// - stringOptions: "any of", "none of"
|
|
180
|
+
// - categoryOptions: "any of", "none of"
|
|
181
|
+
// - arrayOptions: "any of", "none of", "all of"
|
|
182
|
+
// - number: "=", ">", "<", ">=", "<="
|
|
183
|
+
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
|
|
184
|
+
// - numberObject: "=", ">", "<", ">=", "<="
|
|
185
|
+
// - boolean: "=", "<>"
|
|
186
|
+
// - null: "is null", "is not null"
|
|
187
|
+
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
|
|
188
|
+
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Available Columns
|
|
194
|
+
|
|
195
|
+
### Core Trace Fields
|
|
196
|
+
- `id` (string) - Trace ID
|
|
197
|
+
- `name` (string) - Trace name
|
|
198
|
+
- `timestamp` (datetime) - Trace timestamp
|
|
199
|
+
- `userId` (string) - User ID
|
|
200
|
+
- `sessionId` (string) - Session ID
|
|
201
|
+
- `environment` (string) - Environment tag
|
|
202
|
+
- `version` (string) - Version tag
|
|
203
|
+
- `release` (string) - Release tag
|
|
204
|
+
- `tags` (arrayOptions) - Array of tags
|
|
205
|
+
- `bookmarked` (boolean) - Bookmark status
|
|
206
|
+
|
|
207
|
+
### Structured Data
|
|
208
|
+
- `metadata` (stringObject/numberObject/categoryOptions) - Metadata key-value pairs. Use `key` parameter to filter on specific metadata keys.
|
|
209
|
+
|
|
210
|
+
### Aggregated Metrics (from observations)
|
|
211
|
+
These metrics are aggregated from all observations within the trace:
|
|
212
|
+
- `latency` (number) - Latency in seconds (time from first observation start to last observation end)
|
|
213
|
+
- `inputTokens` (number) - Total input tokens across all observations
|
|
214
|
+
- `outputTokens` (number) - Total output tokens across all observations
|
|
215
|
+
- `totalTokens` (number) - Total tokens (alias: `tokens`)
|
|
216
|
+
- `inputCost` (number) - Total input cost in USD
|
|
217
|
+
- `outputCost` (number) - Total output cost in USD
|
|
218
|
+
- `totalCost` (number) - Total cost in USD
|
|
219
|
+
|
|
220
|
+
### Observation Level Aggregations
|
|
221
|
+
These fields aggregate observation levels within the trace:
|
|
222
|
+
- `level` (string) - Highest severity level (ERROR > WARNING > DEFAULT > DEBUG)
|
|
223
|
+
- `warningCount` (number) - Count of WARNING level observations
|
|
224
|
+
- `errorCount` (number) - Count of ERROR level observations
|
|
225
|
+
- `defaultCount` (number) - Count of DEFAULT level observations
|
|
226
|
+
- `debugCount` (number) - Count of DEBUG level observations
|
|
227
|
+
|
|
228
|
+
### Scores (requires join with scores table)
|
|
229
|
+
- `scores_avg` (number) - Average of numeric scores (alias: `scores`)
|
|
230
|
+
- `score_categories` (categoryOptions) - Categorical score values
|
|
231
|
+
|
|
232
|
+
## Filter Examples
|
|
233
|
+
```json
|
|
234
|
+
[
|
|
235
|
+
{
|
|
236
|
+
"type": "datetime",
|
|
237
|
+
"column": "timestamp",
|
|
238
|
+
"operator": ">=",
|
|
239
|
+
"value": "2024-01-01T00:00:00Z"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"type": "string",
|
|
243
|
+
"column": "userId",
|
|
244
|
+
"operator": "=",
|
|
245
|
+
"value": "user-123"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"type": "number",
|
|
249
|
+
"column": "totalCost",
|
|
250
|
+
"operator": ">=",
|
|
251
|
+
"value": 0.01
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"type": "arrayOptions",
|
|
255
|
+
"column": "tags",
|
|
256
|
+
"operator": "all of",
|
|
257
|
+
"value": ["production", "critical"]
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"type": "stringObject",
|
|
261
|
+
"column": "metadata",
|
|
262
|
+
"key": "customer_tier",
|
|
263
|
+
"operator": "=",
|
|
264
|
+
"value": "enterprise"
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Performance Notes
|
|
270
|
+
- Filtering on `userId`, `sessionId`, or `metadata` may enable skip indexes for better query performance
|
|
271
|
+
- Score filters require a join with the scores table and may impact query performance
|
|
272
|
+
|
|
273
|
+
request_options : typing.Optional[RequestOptions]
|
|
274
|
+
Request-specific configuration.
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
-------
|
|
278
|
+
Traces
|
|
279
|
+
|
|
280
|
+
Examples
|
|
281
|
+
--------
|
|
282
|
+
from aeri import AeriAPI
|
|
283
|
+
|
|
284
|
+
client = AeriAPI(
|
|
285
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
286
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
287
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
288
|
+
username="YOUR_USERNAME",
|
|
289
|
+
password="YOUR_PASSWORD",
|
|
290
|
+
base_url="https://yourhost.com/path/to/api",
|
|
291
|
+
)
|
|
292
|
+
client.trace.list()
|
|
293
|
+
"""
|
|
294
|
+
_response = self._raw_client.list(
|
|
295
|
+
page=page,
|
|
296
|
+
limit=limit,
|
|
297
|
+
user_id=user_id,
|
|
298
|
+
name=name,
|
|
299
|
+
session_id=session_id,
|
|
300
|
+
from_timestamp=from_timestamp,
|
|
301
|
+
to_timestamp=to_timestamp,
|
|
302
|
+
order_by=order_by,
|
|
303
|
+
tags=tags,
|
|
304
|
+
version=version,
|
|
305
|
+
release=release,
|
|
306
|
+
environment=environment,
|
|
307
|
+
fields=fields,
|
|
308
|
+
filter=filter,
|
|
309
|
+
request_options=request_options,
|
|
310
|
+
)
|
|
311
|
+
return _response.data
|
|
312
|
+
|
|
313
|
+
def delete_multiple(
|
|
314
|
+
self,
|
|
315
|
+
*,
|
|
316
|
+
trace_ids: typing.Sequence[str],
|
|
317
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
318
|
+
) -> DeleteTraceResponse:
|
|
319
|
+
"""
|
|
320
|
+
Delete multiple traces
|
|
321
|
+
|
|
322
|
+
Parameters
|
|
323
|
+
----------
|
|
324
|
+
trace_ids : typing.Sequence[str]
|
|
325
|
+
List of trace IDs to delete
|
|
326
|
+
|
|
327
|
+
request_options : typing.Optional[RequestOptions]
|
|
328
|
+
Request-specific configuration.
|
|
329
|
+
|
|
330
|
+
Returns
|
|
331
|
+
-------
|
|
332
|
+
DeleteTraceResponse
|
|
333
|
+
|
|
334
|
+
Examples
|
|
335
|
+
--------
|
|
336
|
+
from aeri import AeriAPI
|
|
337
|
+
|
|
338
|
+
client = AeriAPI(
|
|
339
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
340
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
341
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
342
|
+
username="YOUR_USERNAME",
|
|
343
|
+
password="YOUR_PASSWORD",
|
|
344
|
+
base_url="https://yourhost.com/path/to/api",
|
|
345
|
+
)
|
|
346
|
+
client.trace.delete_multiple(
|
|
347
|
+
trace_ids=["traceIds", "traceIds"],
|
|
348
|
+
)
|
|
349
|
+
"""
|
|
350
|
+
_response = self._raw_client.delete_multiple(
|
|
351
|
+
trace_ids=trace_ids, request_options=request_options
|
|
352
|
+
)
|
|
353
|
+
return _response.data
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
class AsyncTraceClient:
|
|
357
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
358
|
+
self._raw_client = AsyncRawTraceClient(client_wrapper=client_wrapper)
|
|
359
|
+
|
|
360
|
+
@property
|
|
361
|
+
def with_raw_response(self) -> AsyncRawTraceClient:
|
|
362
|
+
"""
|
|
363
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
364
|
+
|
|
365
|
+
Returns
|
|
366
|
+
-------
|
|
367
|
+
AsyncRawTraceClient
|
|
368
|
+
"""
|
|
369
|
+
return self._raw_client
|
|
370
|
+
|
|
371
|
+
async def get(
|
|
372
|
+
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
373
|
+
) -> TraceWithFullDetails:
|
|
374
|
+
"""
|
|
375
|
+
Get a specific trace
|
|
376
|
+
|
|
377
|
+
Parameters
|
|
378
|
+
----------
|
|
379
|
+
trace_id : str
|
|
380
|
+
The unique aeri identifier of a trace
|
|
381
|
+
|
|
382
|
+
request_options : typing.Optional[RequestOptions]
|
|
383
|
+
Request-specific configuration.
|
|
384
|
+
|
|
385
|
+
Returns
|
|
386
|
+
-------
|
|
387
|
+
TraceWithFullDetails
|
|
388
|
+
|
|
389
|
+
Examples
|
|
390
|
+
--------
|
|
391
|
+
import asyncio
|
|
392
|
+
|
|
393
|
+
from aeri import AsyncAeriAPI
|
|
394
|
+
|
|
395
|
+
client = AsyncAeriAPI(
|
|
396
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
397
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
398
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
399
|
+
username="YOUR_USERNAME",
|
|
400
|
+
password="YOUR_PASSWORD",
|
|
401
|
+
base_url="https://yourhost.com/path/to/api",
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
async def main() -> None:
|
|
406
|
+
await client.trace.get(
|
|
407
|
+
trace_id="traceId",
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
asyncio.run(main())
|
|
412
|
+
"""
|
|
413
|
+
_response = await self._raw_client.get(
|
|
414
|
+
trace_id, request_options=request_options
|
|
415
|
+
)
|
|
416
|
+
return _response.data
|
|
417
|
+
|
|
418
|
+
async def delete(
|
|
419
|
+
self, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
420
|
+
) -> DeleteTraceResponse:
|
|
421
|
+
"""
|
|
422
|
+
Delete a specific trace
|
|
423
|
+
|
|
424
|
+
Parameters
|
|
425
|
+
----------
|
|
426
|
+
trace_id : str
|
|
427
|
+
The unique aeri identifier of the trace to delete
|
|
428
|
+
|
|
429
|
+
request_options : typing.Optional[RequestOptions]
|
|
430
|
+
Request-specific configuration.
|
|
431
|
+
|
|
432
|
+
Returns
|
|
433
|
+
-------
|
|
434
|
+
DeleteTraceResponse
|
|
435
|
+
|
|
436
|
+
Examples
|
|
437
|
+
--------
|
|
438
|
+
import asyncio
|
|
439
|
+
|
|
440
|
+
from aeri import AsyncAeriAPI
|
|
441
|
+
|
|
442
|
+
client = AsyncAeriAPI(
|
|
443
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
444
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
445
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
446
|
+
username="YOUR_USERNAME",
|
|
447
|
+
password="YOUR_PASSWORD",
|
|
448
|
+
base_url="https://yourhost.com/path/to/api",
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
async def main() -> None:
|
|
453
|
+
await client.trace.delete(
|
|
454
|
+
trace_id="traceId",
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
asyncio.run(main())
|
|
459
|
+
"""
|
|
460
|
+
_response = await self._raw_client.delete(
|
|
461
|
+
trace_id, request_options=request_options
|
|
462
|
+
)
|
|
463
|
+
return _response.data
|
|
464
|
+
|
|
465
|
+
async def list(
|
|
466
|
+
self,
|
|
467
|
+
*,
|
|
468
|
+
page: typing.Optional[int] = None,
|
|
469
|
+
limit: typing.Optional[int] = None,
|
|
470
|
+
user_id: typing.Optional[str] = None,
|
|
471
|
+
name: typing.Optional[str] = None,
|
|
472
|
+
session_id: typing.Optional[str] = None,
|
|
473
|
+
from_timestamp: typing.Optional[dt.datetime] = None,
|
|
474
|
+
to_timestamp: typing.Optional[dt.datetime] = None,
|
|
475
|
+
order_by: typing.Optional[str] = None,
|
|
476
|
+
tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
477
|
+
version: typing.Optional[str] = None,
|
|
478
|
+
release: typing.Optional[str] = None,
|
|
479
|
+
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
480
|
+
fields: typing.Optional[str] = None,
|
|
481
|
+
filter: typing.Optional[str] = None,
|
|
482
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
483
|
+
) -> Traces:
|
|
484
|
+
"""
|
|
485
|
+
Get list of traces
|
|
486
|
+
|
|
487
|
+
Parameters
|
|
488
|
+
----------
|
|
489
|
+
page : typing.Optional[int]
|
|
490
|
+
Page number, starts at 1
|
|
491
|
+
|
|
492
|
+
limit : typing.Optional[int]
|
|
493
|
+
Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.
|
|
494
|
+
|
|
495
|
+
user_id : typing.Optional[str]
|
|
496
|
+
|
|
497
|
+
name : typing.Optional[str]
|
|
498
|
+
|
|
499
|
+
session_id : typing.Optional[str]
|
|
500
|
+
|
|
501
|
+
from_timestamp : typing.Optional[dt.datetime]
|
|
502
|
+
Optional filter to only include traces with a trace.timestamp on or after a certain datetime (ISO 8601)
|
|
503
|
+
|
|
504
|
+
to_timestamp : typing.Optional[dt.datetime]
|
|
505
|
+
Optional filter to only include traces with a trace.timestamp before a certain datetime (ISO 8601)
|
|
506
|
+
|
|
507
|
+
order_by : typing.Optional[str]
|
|
508
|
+
Format of the string [field].[asc/desc]. Fields: id, timestamp, name, userId, release, version, public, bookmarked, sessionId. Example: timestamp.asc
|
|
509
|
+
|
|
510
|
+
tags : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
511
|
+
Only traces that include all of these tags will be returned.
|
|
512
|
+
|
|
513
|
+
version : typing.Optional[str]
|
|
514
|
+
Optional filter to only include traces with a certain version.
|
|
515
|
+
|
|
516
|
+
release : typing.Optional[str]
|
|
517
|
+
Optional filter to only include traces with a certain release.
|
|
518
|
+
|
|
519
|
+
environment : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
520
|
+
Optional filter for traces where the environment is one of the provided values.
|
|
521
|
+
|
|
522
|
+
fields : typing.Optional[str]
|
|
523
|
+
Comma-separated list of fields to include in the response. Available field groups: 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not specified, all fields are returned. Example: 'core,scores,metrics'. Note: Excluded 'observations' or 'scores' fields return empty arrays; excluded 'metrics' returns -1 for 'totalCost' and 'latency'.
|
|
524
|
+
|
|
525
|
+
filter : typing.Optional[str]
|
|
526
|
+
JSON string containing an array of filter conditions. When provided, this takes precedence over query parameter filters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp).
|
|
527
|
+
|
|
528
|
+
## Filter Structure
|
|
529
|
+
Each filter condition has the following structure:
|
|
530
|
+
```json
|
|
531
|
+
[
|
|
532
|
+
{
|
|
533
|
+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
|
|
534
|
+
"column": string, // Required. Column to filter on (see available columns below)
|
|
535
|
+
"operator": string, // Required. Operator based on type:
|
|
536
|
+
// - datetime: ">", "<", ">=", "<="
|
|
537
|
+
// - string: "=", "contains", "does not contain", "starts with", "ends with"
|
|
538
|
+
// - stringOptions: "any of", "none of"
|
|
539
|
+
// - categoryOptions: "any of", "none of"
|
|
540
|
+
// - arrayOptions: "any of", "none of", "all of"
|
|
541
|
+
// - number: "=", ">", "<", ">=", "<="
|
|
542
|
+
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
|
|
543
|
+
// - numberObject: "=", ">", "<", ">=", "<="
|
|
544
|
+
// - boolean: "=", "<>"
|
|
545
|
+
// - null: "is null", "is not null"
|
|
546
|
+
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
|
|
547
|
+
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
|
|
548
|
+
}
|
|
549
|
+
]
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
## Available Columns
|
|
553
|
+
|
|
554
|
+
### Core Trace Fields
|
|
555
|
+
- `id` (string) - Trace ID
|
|
556
|
+
- `name` (string) - Trace name
|
|
557
|
+
- `timestamp` (datetime) - Trace timestamp
|
|
558
|
+
- `userId` (string) - User ID
|
|
559
|
+
- `sessionId` (string) - Session ID
|
|
560
|
+
- `environment` (string) - Environment tag
|
|
561
|
+
- `version` (string) - Version tag
|
|
562
|
+
- `release` (string) - Release tag
|
|
563
|
+
- `tags` (arrayOptions) - Array of tags
|
|
564
|
+
- `bookmarked` (boolean) - Bookmark status
|
|
565
|
+
|
|
566
|
+
### Structured Data
|
|
567
|
+
- `metadata` (stringObject/numberObject/categoryOptions) - Metadata key-value pairs. Use `key` parameter to filter on specific metadata keys.
|
|
568
|
+
|
|
569
|
+
### Aggregated Metrics (from observations)
|
|
570
|
+
These metrics are aggregated from all observations within the trace:
|
|
571
|
+
- `latency` (number) - Latency in seconds (time from first observation start to last observation end)
|
|
572
|
+
- `inputTokens` (number) - Total input tokens across all observations
|
|
573
|
+
- `outputTokens` (number) - Total output tokens across all observations
|
|
574
|
+
- `totalTokens` (number) - Total tokens (alias: `tokens`)
|
|
575
|
+
- `inputCost` (number) - Total input cost in USD
|
|
576
|
+
- `outputCost` (number) - Total output cost in USD
|
|
577
|
+
- `totalCost` (number) - Total cost in USD
|
|
578
|
+
|
|
579
|
+
### Observation Level Aggregations
|
|
580
|
+
These fields aggregate observation levels within the trace:
|
|
581
|
+
- `level` (string) - Highest severity level (ERROR > WARNING > DEFAULT > DEBUG)
|
|
582
|
+
- `warningCount` (number) - Count of WARNING level observations
|
|
583
|
+
- `errorCount` (number) - Count of ERROR level observations
|
|
584
|
+
- `defaultCount` (number) - Count of DEFAULT level observations
|
|
585
|
+
- `debugCount` (number) - Count of DEBUG level observations
|
|
586
|
+
|
|
587
|
+
### Scores (requires join with scores table)
|
|
588
|
+
- `scores_avg` (number) - Average of numeric scores (alias: `scores`)
|
|
589
|
+
- `score_categories` (categoryOptions) - Categorical score values
|
|
590
|
+
|
|
591
|
+
## Filter Examples
|
|
592
|
+
```json
|
|
593
|
+
[
|
|
594
|
+
{
|
|
595
|
+
"type": "datetime",
|
|
596
|
+
"column": "timestamp",
|
|
597
|
+
"operator": ">=",
|
|
598
|
+
"value": "2024-01-01T00:00:00Z"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"type": "string",
|
|
602
|
+
"column": "userId",
|
|
603
|
+
"operator": "=",
|
|
604
|
+
"value": "user-123"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"type": "number",
|
|
608
|
+
"column": "totalCost",
|
|
609
|
+
"operator": ">=",
|
|
610
|
+
"value": 0.01
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"type": "arrayOptions",
|
|
614
|
+
"column": "tags",
|
|
615
|
+
"operator": "all of",
|
|
616
|
+
"value": ["production", "critical"]
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"type": "stringObject",
|
|
620
|
+
"column": "metadata",
|
|
621
|
+
"key": "customer_tier",
|
|
622
|
+
"operator": "=",
|
|
623
|
+
"value": "enterprise"
|
|
624
|
+
}
|
|
625
|
+
]
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
## Performance Notes
|
|
629
|
+
- Filtering on `userId`, `sessionId`, or `metadata` may enable skip indexes for better query performance
|
|
630
|
+
- Score filters require a join with the scores table and may impact query performance
|
|
631
|
+
|
|
632
|
+
request_options : typing.Optional[RequestOptions]
|
|
633
|
+
Request-specific configuration.
|
|
634
|
+
|
|
635
|
+
Returns
|
|
636
|
+
-------
|
|
637
|
+
Traces
|
|
638
|
+
|
|
639
|
+
Examples
|
|
640
|
+
--------
|
|
641
|
+
import asyncio
|
|
642
|
+
|
|
643
|
+
from aeri import AsyncAeriAPI
|
|
644
|
+
|
|
645
|
+
client = AsyncAeriAPI(
|
|
646
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
647
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
648
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
649
|
+
username="YOUR_USERNAME",
|
|
650
|
+
password="YOUR_PASSWORD",
|
|
651
|
+
base_url="https://yourhost.com/path/to/api",
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
async def main() -> None:
|
|
656
|
+
await client.trace.list()
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
asyncio.run(main())
|
|
660
|
+
"""
|
|
661
|
+
_response = await self._raw_client.list(
|
|
662
|
+
page=page,
|
|
663
|
+
limit=limit,
|
|
664
|
+
user_id=user_id,
|
|
665
|
+
name=name,
|
|
666
|
+
session_id=session_id,
|
|
667
|
+
from_timestamp=from_timestamp,
|
|
668
|
+
to_timestamp=to_timestamp,
|
|
669
|
+
order_by=order_by,
|
|
670
|
+
tags=tags,
|
|
671
|
+
version=version,
|
|
672
|
+
release=release,
|
|
673
|
+
environment=environment,
|
|
674
|
+
fields=fields,
|
|
675
|
+
filter=filter,
|
|
676
|
+
request_options=request_options,
|
|
677
|
+
)
|
|
678
|
+
return _response.data
|
|
679
|
+
|
|
680
|
+
async def delete_multiple(
|
|
681
|
+
self,
|
|
682
|
+
*,
|
|
683
|
+
trace_ids: typing.Sequence[str],
|
|
684
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
685
|
+
) -> DeleteTraceResponse:
|
|
686
|
+
"""
|
|
687
|
+
Delete multiple traces
|
|
688
|
+
|
|
689
|
+
Parameters
|
|
690
|
+
----------
|
|
691
|
+
trace_ids : typing.Sequence[str]
|
|
692
|
+
List of trace IDs to delete
|
|
693
|
+
|
|
694
|
+
request_options : typing.Optional[RequestOptions]
|
|
695
|
+
Request-specific configuration.
|
|
696
|
+
|
|
697
|
+
Returns
|
|
698
|
+
-------
|
|
699
|
+
DeleteTraceResponse
|
|
700
|
+
|
|
701
|
+
Examples
|
|
702
|
+
--------
|
|
703
|
+
import asyncio
|
|
704
|
+
|
|
705
|
+
from aeri import AsyncAeriAPI
|
|
706
|
+
|
|
707
|
+
client = AsyncAeriAPI(
|
|
708
|
+
x_aeri_sdk_name="YOUR_X_AERI_SDK_NAME",
|
|
709
|
+
x_aeri_sdk_version="YOUR_X_AERI_SDK_VERSION",
|
|
710
|
+
x_aeri_public_key="YOUR_X_AERI_PUBLIC_KEY",
|
|
711
|
+
username="YOUR_USERNAME",
|
|
712
|
+
password="YOUR_PASSWORD",
|
|
713
|
+
base_url="https://yourhost.com/path/to/api",
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
async def main() -> None:
|
|
718
|
+
await client.trace.delete_multiple(
|
|
719
|
+
trace_ids=["traceIds", "traceIds"],
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
asyncio.run(main())
|
|
724
|
+
"""
|
|
725
|
+
_response = await self._raw_client.delete_multiple(
|
|
726
|
+
trace_ids=trace_ids, request_options=request_options
|
|
727
|
+
)
|
|
728
|
+
return _response.data
|