mirascope 2.0.0a5__py3-none-any.whl → 2.0.1__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.
- mirascope/__init__.py +10 -1
- mirascope/_stubs.py +363 -0
- mirascope/api/__init__.py +8 -0
- mirascope/api/_generated/__init__.py +285 -2
- mirascope/api/_generated/annotations/__init__.py +33 -0
- mirascope/api/_generated/annotations/client.py +506 -0
- mirascope/api/_generated/annotations/raw_client.py +1414 -0
- mirascope/api/_generated/annotations/types/__init__.py +31 -0
- mirascope/api/_generated/annotations/types/annotations_create_request_label.py +5 -0
- mirascope/api/_generated/annotations/types/annotations_create_response.py +48 -0
- mirascope/api/_generated/annotations/types/annotations_create_response_label.py +5 -0
- mirascope/api/_generated/annotations/types/annotations_get_response.py +48 -0
- mirascope/api/_generated/annotations/types/annotations_get_response_label.py +5 -0
- mirascope/api/_generated/annotations/types/annotations_list_request_label.py +5 -0
- mirascope/api/_generated/annotations/types/annotations_list_response.py +21 -0
- mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +50 -0
- mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item_label.py +5 -0
- mirascope/api/_generated/annotations/types/annotations_update_request_label.py +5 -0
- mirascope/api/_generated/annotations/types/annotations_update_response.py +48 -0
- mirascope/api/_generated/annotations/types/annotations_update_response_label.py +5 -0
- mirascope/api/_generated/api_keys/__init__.py +12 -2
- mirascope/api/_generated/api_keys/client.py +77 -0
- mirascope/api/_generated/api_keys/raw_client.py +422 -39
- mirascope/api/_generated/api_keys/types/__init__.py +7 -1
- mirascope/api/_generated/api_keys/types/api_keys_create_response.py +4 -12
- mirascope/api/_generated/api_keys/types/api_keys_get_response.py +4 -12
- mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
- mirascope/api/_generated/api_keys/types/api_keys_list_response_item.py +4 -12
- mirascope/api/_generated/client.py +42 -0
- mirascope/api/_generated/core/client_wrapper.py +2 -14
- mirascope/api/_generated/core/datetime_utils.py +1 -3
- mirascope/api/_generated/core/file.py +2 -5
- mirascope/api/_generated/core/http_client.py +36 -112
- mirascope/api/_generated/core/jsonable_encoder.py +1 -3
- mirascope/api/_generated/core/pydantic_utilities.py +19 -74
- mirascope/api/_generated/core/query_encoder.py +1 -3
- mirascope/api/_generated/core/serialization.py +4 -10
- mirascope/api/_generated/docs/client.py +2 -6
- mirascope/api/_generated/docs/raw_client.py +51 -5
- mirascope/api/_generated/environment.py +3 -3
- mirascope/api/_generated/environments/__init__.py +6 -0
- mirascope/api/_generated/environments/client.py +117 -0
- mirascope/api/_generated/environments/raw_client.py +530 -51
- mirascope/api/_generated/environments/types/__init__.py +10 -0
- mirascope/api/_generated/environments/types/environments_create_response.py +1 -3
- mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
- mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
- mirascope/api/_generated/environments/types/environments_get_analytics_response_top_models_item.py +22 -0
- mirascope/api/_generated/environments/types/environments_get_response.py +1 -3
- mirascope/api/_generated/environments/types/environments_list_response_item.py +1 -3
- mirascope/api/_generated/environments/types/environments_update_response.py +1 -3
- mirascope/api/_generated/errors/__init__.py +8 -0
- mirascope/api/_generated/errors/bad_request_error.py +1 -2
- mirascope/api/_generated/errors/conflict_error.py +1 -2
- mirascope/api/_generated/errors/forbidden_error.py +1 -5
- mirascope/api/_generated/errors/internal_server_error.py +1 -6
- mirascope/api/_generated/errors/not_found_error.py +1 -5
- mirascope/api/_generated/errors/payment_required_error.py +15 -0
- mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
- mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
- mirascope/api/_generated/errors/unauthorized_error.py +11 -0
- mirascope/api/_generated/functions/__init__.py +39 -0
- mirascope/api/_generated/functions/client.py +647 -0
- mirascope/api/_generated/functions/raw_client.py +1890 -0
- mirascope/api/_generated/functions/types/__init__.py +53 -0
- mirascope/api/_generated/functions/types/functions_create_request_dependencies_value.py +20 -0
- mirascope/api/_generated/functions/types/functions_create_response.py +37 -0
- mirascope/api/_generated/functions/types/functions_create_response_dependencies_value.py +20 -0
- mirascope/api/_generated/functions/types/functions_find_by_hash_response.py +39 -0
- mirascope/api/_generated/functions/types/functions_find_by_hash_response_dependencies_value.py +20 -0
- mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
- mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
- mirascope/api/_generated/functions/types/functions_get_response.py +37 -0
- mirascope/api/_generated/functions/types/functions_get_response_dependencies_value.py +20 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
- mirascope/api/_generated/functions/types/functions_list_response.py +21 -0
- mirascope/api/_generated/functions/types/functions_list_response_functions_item.py +41 -0
- mirascope/api/_generated/functions/types/functions_list_response_functions_item_dependencies_value.py +20 -0
- mirascope/api/_generated/health/client.py +2 -6
- mirascope/api/_generated/health/raw_client.py +51 -5
- mirascope/api/_generated/health/types/health_check_response.py +1 -3
- mirascope/api/_generated/organization_invitations/__init__.py +33 -0
- mirascope/api/_generated/organization_invitations/client.py +546 -0
- mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
- mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
- mirascope/api/_generated/organization_memberships/__init__.py +19 -0
- mirascope/api/_generated/organization_memberships/client.py +302 -0
- mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
- mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
- mirascope/api/_generated/organizations/__init__.py +26 -0
- mirascope/api/_generated/organizations/client.py +465 -0
- mirascope/api/_generated/organizations/raw_client.py +1799 -108
- mirascope/api/_generated/organizations/types/__init__.py +48 -0
- mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
- mirascope/api/_generated/organizations/types/organizations_create_response.py +4 -3
- mirascope/api/_generated/organizations/types/organizations_create_response_role.py +1 -3
- mirascope/api/_generated/organizations/types/organizations_get_response.py +4 -3
- mirascope/api/_generated/organizations/types/organizations_get_response_role.py +1 -3
- mirascope/api/_generated/organizations/types/organizations_list_response_item.py +4 -3
- mirascope/api/_generated/organizations/types/organizations_list_response_item_role.py +1 -3
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_update_response.py +4 -3
- mirascope/api/_generated/organizations/types/organizations_update_response_role.py +1 -3
- mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
- mirascope/api/_generated/project_memberships/__init__.py +25 -0
- mirascope/api/_generated/project_memberships/client.py +437 -0
- mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
- mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
- mirascope/api/_generated/projects/__init__.py +2 -12
- mirascope/api/_generated/projects/client.py +17 -71
- mirascope/api/_generated/projects/raw_client.py +295 -51
- mirascope/api/_generated/projects/types/__init__.py +1 -6
- mirascope/api/_generated/projects/types/projects_create_response.py +3 -9
- mirascope/api/_generated/projects/types/projects_get_response.py +3 -9
- mirascope/api/_generated/projects/types/projects_list_response_item.py +3 -9
- mirascope/api/_generated/projects/types/projects_update_response.py +3 -9
- mirascope/api/_generated/reference.md +3619 -182
- mirascope/api/_generated/tags/__init__.py +19 -0
- mirascope/api/_generated/tags/client.py +504 -0
- mirascope/api/_generated/tags/raw_client.py +1288 -0
- mirascope/api/_generated/tags/types/__init__.py +17 -0
- mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
- mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
- mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
- mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
- mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
- mirascope/api/_generated/token_cost/__init__.py +7 -0
- mirascope/api/_generated/token_cost/client.py +160 -0
- mirascope/api/_generated/token_cost/raw_client.py +264 -0
- mirascope/api/_generated/token_cost/types/__init__.py +8 -0
- mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
- mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
- mirascope/api/_generated/traces/__init__.py +42 -0
- mirascope/api/_generated/traces/client.py +941 -0
- mirascope/api/_generated/traces/raw_client.py +2177 -23
- mirascope/api/_generated/traces/types/__init__.py +60 -0
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item.py +4 -11
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item.py +1 -3
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value.py +8 -24
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_array_value.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value.py +3 -9
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value_values_item.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item.py +3 -9
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope.py +4 -8
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value.py +8 -24
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_array_value.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value.py +3 -9
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value_values_item.py +1 -3
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item.py +6 -18
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item.py +3 -9
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value.py +8 -24
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_array_value.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value_values_item.py +1 -3
- mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_status.py +2 -6
- mirascope/api/_generated/traces/types/traces_create_response.py +2 -5
- mirascope/api/_generated/traces/types/traces_create_response_partial_success.py +3 -9
- mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +60 -0
- mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_functions_item.py +24 -0
- mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_models_item.py +22 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_response.py +33 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +88 -0
- mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
- mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
- mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item_operator.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_request_sort_by.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_request_sort_order.py +5 -0
- mirascope/api/_generated/traces/types/traces_search_response.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +50 -0
- mirascope/api/_generated/types/__init__.py +48 -0
- mirascope/api/_generated/types/already_exists_error.py +1 -3
- mirascope/api/_generated/types/bad_request_error_body.py +50 -0
- mirascope/api/_generated/types/click_house_error.py +22 -0
- mirascope/api/_generated/types/database_error.py +1 -3
- mirascope/api/_generated/types/date.py +3 -0
- mirascope/api/_generated/types/http_api_decode_error.py +1 -3
- mirascope/api/_generated/types/immutable_resource_error.py +22 -0
- mirascope/api/_generated/types/internal_server_error_body.py +49 -0
- mirascope/api/_generated/types/issue.py +1 -3
- mirascope/api/_generated/types/issue_tag.py +1 -8
- mirascope/api/_generated/types/not_found_error_body.py +1 -3
- mirascope/api/_generated/types/number_from_string.py +3 -0
- mirascope/api/_generated/types/permission_denied_error.py +1 -3
- mirascope/api/_generated/types/permission_denied_error_tag.py +1 -3
- mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
- mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
- mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
- mirascope/api/_generated/types/property_key_key.py +1 -3
- mirascope/api/_generated/types/rate_limit_error.py +31 -0
- mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
- mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
- mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
- mirascope/api/_generated/types/stripe_error.py +20 -0
- mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
- mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
- mirascope/api/_generated/types/unauthorized_error_body.py +21 -0
- mirascope/api/_generated/types/unauthorized_error_tag.py +5 -0
- mirascope/api/settings.py +19 -1
- mirascope/llm/__init__.py +55 -8
- mirascope/llm/calls/__init__.py +2 -1
- mirascope/llm/calls/calls.py +3 -1
- mirascope/llm/calls/decorator.py +21 -7
- mirascope/llm/content/tool_call.py +6 -0
- mirascope/llm/content/tool_output.py +22 -5
- mirascope/llm/exceptions.py +284 -71
- mirascope/llm/formatting/__init__.py +19 -2
- mirascope/llm/formatting/format.py +219 -30
- mirascope/llm/formatting/output_parser.py +178 -0
- mirascope/llm/formatting/partial.py +80 -7
- mirascope/llm/formatting/primitives.py +192 -0
- mirascope/llm/formatting/types.py +21 -64
- mirascope/llm/mcp/__init__.py +2 -2
- mirascope/llm/mcp/mcp_client.py +130 -0
- mirascope/llm/messages/__init__.py +3 -0
- mirascope/llm/messages/_utils.py +34 -0
- mirascope/llm/models/__init__.py +5 -0
- mirascope/llm/models/models.py +137 -69
- mirascope/llm/{providers/base → models}/params.py +16 -37
- mirascope/llm/models/thinking_config.py +61 -0
- mirascope/llm/prompts/_utils.py +0 -32
- mirascope/llm/prompts/decorator.py +16 -5
- mirascope/llm/prompts/prompts.py +131 -68
- mirascope/llm/providers/__init__.py +18 -2
- mirascope/llm/providers/anthropic/__init__.py +3 -21
- mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
- mirascope/llm/providers/anthropic/_utils/beta_decode.py +22 -11
- mirascope/llm/providers/anthropic/_utils/beta_encode.py +75 -25
- mirascope/llm/providers/anthropic/_utils/decode.py +22 -11
- mirascope/llm/providers/anthropic/_utils/encode.py +82 -20
- mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
- mirascope/llm/providers/anthropic/beta_provider.py +64 -18
- mirascope/llm/providers/anthropic/provider.py +91 -33
- mirascope/llm/providers/base/__init__.py +0 -2
- mirascope/llm/providers/base/_utils.py +55 -11
- mirascope/llm/providers/base/base_provider.py +116 -37
- mirascope/llm/providers/google/__init__.py +2 -17
- mirascope/llm/providers/google/_utils/__init__.py +2 -0
- mirascope/llm/providers/google/_utils/decode.py +37 -15
- mirascope/llm/providers/google/_utils/encode.py +127 -19
- mirascope/llm/providers/google/_utils/errors.py +3 -2
- mirascope/llm/providers/google/model_info.py +1 -0
- mirascope/llm/providers/google/provider.py +68 -19
- mirascope/llm/providers/mirascope/__init__.py +5 -0
- mirascope/llm/providers/mirascope/_utils.py +73 -0
- mirascope/llm/providers/mirascope/provider.py +349 -0
- mirascope/llm/providers/mlx/__init__.py +2 -17
- mirascope/llm/providers/mlx/_utils.py +8 -3
- mirascope/llm/providers/mlx/encoding/base.py +5 -2
- mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
- mirascope/llm/providers/mlx/mlx.py +23 -6
- mirascope/llm/providers/mlx/provider.py +42 -13
- mirascope/llm/providers/ollama/__init__.py +1 -13
- mirascope/llm/providers/openai/_utils/errors.py +2 -2
- mirascope/llm/providers/openai/completions/__init__.py +2 -20
- mirascope/llm/providers/openai/completions/_utils/decode.py +14 -3
- mirascope/llm/providers/openai/completions/_utils/encode.py +35 -28
- mirascope/llm/providers/openai/completions/base_provider.py +40 -11
- mirascope/llm/providers/openai/provider.py +40 -10
- mirascope/llm/providers/openai/responses/__init__.py +1 -17
- mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
- mirascope/llm/providers/openai/responses/_utils/decode.py +21 -8
- mirascope/llm/providers/openai/responses/_utils/encode.py +59 -19
- mirascope/llm/providers/openai/responses/provider.py +56 -18
- mirascope/llm/providers/provider_id.py +1 -0
- mirascope/llm/providers/provider_registry.py +96 -19
- mirascope/llm/providers/together/__init__.py +1 -13
- mirascope/llm/responses/__init__.py +6 -1
- mirascope/llm/responses/_utils.py +102 -12
- mirascope/llm/responses/base_response.py +5 -2
- mirascope/llm/responses/base_stream_response.py +139 -45
- mirascope/llm/responses/response.py +2 -1
- mirascope/llm/responses/root_response.py +89 -17
- mirascope/llm/responses/stream_response.py +6 -9
- mirascope/llm/tools/decorator.py +17 -8
- mirascope/llm/tools/tool_schema.py +43 -10
- mirascope/llm/tools/toolkit.py +35 -27
- mirascope/llm/tools/tools.py +123 -30
- mirascope/ops/__init__.py +64 -109
- mirascope/ops/_internal/configuration.py +82 -31
- mirascope/ops/_internal/exporters/exporters.py +64 -11
- mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
- mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
- mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
- mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1243
- mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
- mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
- mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
- mirascope/ops/_internal/protocols.py +83 -1
- mirascope/ops/_internal/traced_calls.py +4 -0
- mirascope/ops/_internal/traced_functions.py +141 -12
- mirascope/ops/_internal/tracing.py +78 -1
- mirascope/ops/_internal/utils.py +52 -4
- mirascope/ops/_internal/versioned_functions.py +54 -43
- {mirascope-2.0.0a5.dist-info → mirascope-2.0.1.dist-info}/METADATA +14 -13
- mirascope-2.0.1.dist-info/RECORD +423 -0
- {mirascope-2.0.0a5.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
- mirascope/llm/formatting/_utils.py +0 -78
- mirascope/llm/mcp/client.py +0 -118
- mirascope/llm/providers/_missing_import_stubs.py +0 -49
- mirascope-2.0.0a5.dist-info/RECORD +0 -265
- {mirascope-2.0.0a5.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
|
@@ -14,12 +14,13 @@ from ..errors.conflict_error import ConflictError
|
|
|
14
14
|
from ..errors.forbidden_error import ForbiddenError
|
|
15
15
|
from ..errors.internal_server_error import InternalServerError
|
|
16
16
|
from ..errors.not_found_error import NotFoundError
|
|
17
|
-
from ..
|
|
18
|
-
from ..
|
|
19
|
-
from ..types.http_api_decode_error import HttpApiDecodeError
|
|
17
|
+
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
18
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
20
19
|
from ..types.not_found_error_body import NotFoundErrorBody
|
|
21
20
|
from ..types.permission_denied_error import PermissionDeniedError
|
|
21
|
+
from ..types.rate_limit_error import RateLimitError
|
|
22
22
|
from .types.environments_create_response import EnvironmentsCreateResponse
|
|
23
|
+
from .types.environments_get_analytics_response import EnvironmentsGetAnalyticsResponse
|
|
23
24
|
from .types.environments_get_response import EnvironmentsGetResponse
|
|
24
25
|
from .types.environments_list_response_item import EnvironmentsListResponseItem
|
|
25
26
|
from .types.environments_update_response import EnvironmentsUpdateResponse
|
|
@@ -73,9 +74,9 @@ class RawEnvironmentsClient:
|
|
|
73
74
|
raise BadRequestError(
|
|
74
75
|
headers=dict(_response.headers),
|
|
75
76
|
body=typing.cast(
|
|
76
|
-
|
|
77
|
+
typing.Optional[typing.Any],
|
|
77
78
|
parse_obj_as(
|
|
78
|
-
type_=
|
|
79
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
79
80
|
object_=_response.json(),
|
|
80
81
|
),
|
|
81
82
|
),
|
|
@@ -102,13 +103,35 @@ class RawEnvironmentsClient:
|
|
|
102
103
|
),
|
|
103
104
|
),
|
|
104
105
|
)
|
|
106
|
+
if _response.status_code == 429:
|
|
107
|
+
raise TooManyRequestsError(
|
|
108
|
+
headers=dict(_response.headers),
|
|
109
|
+
body=typing.cast(
|
|
110
|
+
RateLimitError,
|
|
111
|
+
parse_obj_as(
|
|
112
|
+
type_=RateLimitError, # type: ignore
|
|
113
|
+
object_=_response.json(),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
)
|
|
105
117
|
if _response.status_code == 500:
|
|
106
118
|
raise InternalServerError(
|
|
107
119
|
headers=dict(_response.headers),
|
|
108
120
|
body=typing.cast(
|
|
109
|
-
|
|
121
|
+
typing.Optional[typing.Any],
|
|
122
|
+
parse_obj_as(
|
|
123
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
124
|
+
object_=_response.json(),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
if _response.status_code == 503:
|
|
129
|
+
raise ServiceUnavailableError(
|
|
130
|
+
headers=dict(_response.headers),
|
|
131
|
+
body=typing.cast(
|
|
132
|
+
typing.Optional[typing.Any],
|
|
110
133
|
parse_obj_as(
|
|
111
|
-
type_=
|
|
134
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
112
135
|
object_=_response.json(),
|
|
113
136
|
),
|
|
114
137
|
),
|
|
@@ -183,9 +206,9 @@ class RawEnvironmentsClient:
|
|
|
183
206
|
raise BadRequestError(
|
|
184
207
|
headers=dict(_response.headers),
|
|
185
208
|
body=typing.cast(
|
|
186
|
-
|
|
209
|
+
typing.Optional[typing.Any],
|
|
187
210
|
parse_obj_as(
|
|
188
|
-
type_=
|
|
211
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
189
212
|
object_=_response.json(),
|
|
190
213
|
),
|
|
191
214
|
),
|
|
@@ -216,9 +239,20 @@ class RawEnvironmentsClient:
|
|
|
216
239
|
raise ConflictError(
|
|
217
240
|
headers=dict(_response.headers),
|
|
218
241
|
body=typing.cast(
|
|
219
|
-
|
|
242
|
+
typing.Optional[typing.Any],
|
|
220
243
|
parse_obj_as(
|
|
221
|
-
type_=
|
|
244
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
245
|
+
object_=_response.json(),
|
|
246
|
+
),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
if _response.status_code == 429:
|
|
250
|
+
raise TooManyRequestsError(
|
|
251
|
+
headers=dict(_response.headers),
|
|
252
|
+
body=typing.cast(
|
|
253
|
+
RateLimitError,
|
|
254
|
+
parse_obj_as(
|
|
255
|
+
type_=RateLimitError, # type: ignore
|
|
222
256
|
object_=_response.json(),
|
|
223
257
|
),
|
|
224
258
|
),
|
|
@@ -227,9 +261,20 @@ class RawEnvironmentsClient:
|
|
|
227
261
|
raise InternalServerError(
|
|
228
262
|
headers=dict(_response.headers),
|
|
229
263
|
body=typing.cast(
|
|
230
|
-
|
|
264
|
+
typing.Optional[typing.Any],
|
|
265
|
+
parse_obj_as(
|
|
266
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
if _response.status_code == 503:
|
|
272
|
+
raise ServiceUnavailableError(
|
|
273
|
+
headers=dict(_response.headers),
|
|
274
|
+
body=typing.cast(
|
|
275
|
+
typing.Optional[typing.Any],
|
|
231
276
|
parse_obj_as(
|
|
232
|
-
type_=
|
|
277
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
233
278
|
object_=_response.json(),
|
|
234
279
|
),
|
|
235
280
|
),
|
|
@@ -291,9 +336,9 @@ class RawEnvironmentsClient:
|
|
|
291
336
|
raise BadRequestError(
|
|
292
337
|
headers=dict(_response.headers),
|
|
293
338
|
body=typing.cast(
|
|
294
|
-
|
|
339
|
+
typing.Optional[typing.Any],
|
|
295
340
|
parse_obj_as(
|
|
296
|
-
type_=
|
|
341
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
297
342
|
object_=_response.json(),
|
|
298
343
|
),
|
|
299
344
|
),
|
|
@@ -320,13 +365,35 @@ class RawEnvironmentsClient:
|
|
|
320
365
|
),
|
|
321
366
|
),
|
|
322
367
|
)
|
|
368
|
+
if _response.status_code == 429:
|
|
369
|
+
raise TooManyRequestsError(
|
|
370
|
+
headers=dict(_response.headers),
|
|
371
|
+
body=typing.cast(
|
|
372
|
+
RateLimitError,
|
|
373
|
+
parse_obj_as(
|
|
374
|
+
type_=RateLimitError, # type: ignore
|
|
375
|
+
object_=_response.json(),
|
|
376
|
+
),
|
|
377
|
+
),
|
|
378
|
+
)
|
|
323
379
|
if _response.status_code == 500:
|
|
324
380
|
raise InternalServerError(
|
|
325
381
|
headers=dict(_response.headers),
|
|
326
382
|
body=typing.cast(
|
|
327
|
-
|
|
383
|
+
typing.Optional[typing.Any],
|
|
328
384
|
parse_obj_as(
|
|
329
|
-
type_=
|
|
385
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
386
|
+
object_=_response.json(),
|
|
387
|
+
),
|
|
388
|
+
),
|
|
389
|
+
)
|
|
390
|
+
if _response.status_code == 503:
|
|
391
|
+
raise ServiceUnavailableError(
|
|
392
|
+
headers=dict(_response.headers),
|
|
393
|
+
body=typing.cast(
|
|
394
|
+
typing.Optional[typing.Any],
|
|
395
|
+
parse_obj_as(
|
|
396
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
330
397
|
object_=_response.json(),
|
|
331
398
|
),
|
|
332
399
|
),
|
|
@@ -404,9 +471,9 @@ class RawEnvironmentsClient:
|
|
|
404
471
|
raise BadRequestError(
|
|
405
472
|
headers=dict(_response.headers),
|
|
406
473
|
body=typing.cast(
|
|
407
|
-
|
|
474
|
+
typing.Optional[typing.Any],
|
|
408
475
|
parse_obj_as(
|
|
409
|
-
type_=
|
|
476
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
410
477
|
object_=_response.json(),
|
|
411
478
|
),
|
|
412
479
|
),
|
|
@@ -437,9 +504,20 @@ class RawEnvironmentsClient:
|
|
|
437
504
|
raise ConflictError(
|
|
438
505
|
headers=dict(_response.headers),
|
|
439
506
|
body=typing.cast(
|
|
440
|
-
|
|
507
|
+
typing.Optional[typing.Any],
|
|
441
508
|
parse_obj_as(
|
|
442
|
-
type_=
|
|
509
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
510
|
+
object_=_response.json(),
|
|
511
|
+
),
|
|
512
|
+
),
|
|
513
|
+
)
|
|
514
|
+
if _response.status_code == 429:
|
|
515
|
+
raise TooManyRequestsError(
|
|
516
|
+
headers=dict(_response.headers),
|
|
517
|
+
body=typing.cast(
|
|
518
|
+
RateLimitError,
|
|
519
|
+
parse_obj_as(
|
|
520
|
+
type_=RateLimitError, # type: ignore
|
|
443
521
|
object_=_response.json(),
|
|
444
522
|
),
|
|
445
523
|
),
|
|
@@ -448,9 +526,20 @@ class RawEnvironmentsClient:
|
|
|
448
526
|
raise InternalServerError(
|
|
449
527
|
headers=dict(_response.headers),
|
|
450
528
|
body=typing.cast(
|
|
451
|
-
|
|
529
|
+
typing.Optional[typing.Any],
|
|
530
|
+
parse_obj_as(
|
|
531
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
532
|
+
object_=_response.json(),
|
|
533
|
+
),
|
|
534
|
+
),
|
|
535
|
+
)
|
|
536
|
+
if _response.status_code == 503:
|
|
537
|
+
raise ServiceUnavailableError(
|
|
538
|
+
headers=dict(_response.headers),
|
|
539
|
+
body=typing.cast(
|
|
540
|
+
typing.Optional[typing.Any],
|
|
452
541
|
parse_obj_as(
|
|
453
|
-
type_=
|
|
542
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
454
543
|
object_=_response.json(),
|
|
455
544
|
),
|
|
456
545
|
),
|
|
@@ -504,9 +593,138 @@ class RawEnvironmentsClient:
|
|
|
504
593
|
raise BadRequestError(
|
|
505
594
|
headers=dict(_response.headers),
|
|
506
595
|
body=typing.cast(
|
|
507
|
-
|
|
596
|
+
typing.Optional[typing.Any],
|
|
597
|
+
parse_obj_as(
|
|
598
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
599
|
+
object_=_response.json(),
|
|
600
|
+
),
|
|
601
|
+
),
|
|
602
|
+
)
|
|
603
|
+
if _response.status_code == 403:
|
|
604
|
+
raise ForbiddenError(
|
|
605
|
+
headers=dict(_response.headers),
|
|
606
|
+
body=typing.cast(
|
|
607
|
+
PermissionDeniedError,
|
|
608
|
+
parse_obj_as(
|
|
609
|
+
type_=PermissionDeniedError, # type: ignore
|
|
610
|
+
object_=_response.json(),
|
|
611
|
+
),
|
|
612
|
+
),
|
|
613
|
+
)
|
|
614
|
+
if _response.status_code == 404:
|
|
615
|
+
raise NotFoundError(
|
|
616
|
+
headers=dict(_response.headers),
|
|
617
|
+
body=typing.cast(
|
|
618
|
+
NotFoundErrorBody,
|
|
619
|
+
parse_obj_as(
|
|
620
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
621
|
+
object_=_response.json(),
|
|
622
|
+
),
|
|
623
|
+
),
|
|
624
|
+
)
|
|
625
|
+
if _response.status_code == 429:
|
|
626
|
+
raise TooManyRequestsError(
|
|
627
|
+
headers=dict(_response.headers),
|
|
628
|
+
body=typing.cast(
|
|
629
|
+
RateLimitError,
|
|
630
|
+
parse_obj_as(
|
|
631
|
+
type_=RateLimitError, # type: ignore
|
|
632
|
+
object_=_response.json(),
|
|
633
|
+
),
|
|
634
|
+
),
|
|
635
|
+
)
|
|
636
|
+
if _response.status_code == 500:
|
|
637
|
+
raise InternalServerError(
|
|
638
|
+
headers=dict(_response.headers),
|
|
639
|
+
body=typing.cast(
|
|
640
|
+
typing.Optional[typing.Any],
|
|
641
|
+
parse_obj_as(
|
|
642
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
643
|
+
object_=_response.json(),
|
|
644
|
+
),
|
|
645
|
+
),
|
|
646
|
+
)
|
|
647
|
+
if _response.status_code == 503:
|
|
648
|
+
raise ServiceUnavailableError(
|
|
649
|
+
headers=dict(_response.headers),
|
|
650
|
+
body=typing.cast(
|
|
651
|
+
typing.Optional[typing.Any],
|
|
652
|
+
parse_obj_as(
|
|
653
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
654
|
+
object_=_response.json(),
|
|
655
|
+
),
|
|
656
|
+
),
|
|
657
|
+
)
|
|
658
|
+
_response_json = _response.json()
|
|
659
|
+
except JSONDecodeError:
|
|
660
|
+
raise ApiError(
|
|
661
|
+
status_code=_response.status_code,
|
|
662
|
+
headers=dict(_response.headers),
|
|
663
|
+
body=_response.text,
|
|
664
|
+
)
|
|
665
|
+
raise ApiError(
|
|
666
|
+
status_code=_response.status_code,
|
|
667
|
+
headers=dict(_response.headers),
|
|
668
|
+
body=_response_json,
|
|
669
|
+
)
|
|
670
|
+
|
|
671
|
+
def getanalytics(
|
|
672
|
+
self,
|
|
673
|
+
organization_id: str,
|
|
674
|
+
project_id: str,
|
|
675
|
+
environment_id: str,
|
|
676
|
+
*,
|
|
677
|
+
start_time: str,
|
|
678
|
+
end_time: str,
|
|
679
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
680
|
+
) -> HttpResponse[EnvironmentsGetAnalyticsResponse]:
|
|
681
|
+
"""
|
|
682
|
+
Parameters
|
|
683
|
+
----------
|
|
684
|
+
organization_id : str
|
|
685
|
+
|
|
686
|
+
project_id : str
|
|
687
|
+
|
|
688
|
+
environment_id : str
|
|
689
|
+
|
|
690
|
+
start_time : str
|
|
691
|
+
|
|
692
|
+
end_time : str
|
|
693
|
+
|
|
694
|
+
request_options : typing.Optional[RequestOptions]
|
|
695
|
+
Request-specific configuration.
|
|
696
|
+
|
|
697
|
+
Returns
|
|
698
|
+
-------
|
|
699
|
+
HttpResponse[EnvironmentsGetAnalyticsResponse]
|
|
700
|
+
Success
|
|
701
|
+
"""
|
|
702
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
703
|
+
f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/analytics",
|
|
704
|
+
method="GET",
|
|
705
|
+
params={
|
|
706
|
+
"startTime": start_time,
|
|
707
|
+
"endTime": end_time,
|
|
708
|
+
},
|
|
709
|
+
request_options=request_options,
|
|
710
|
+
)
|
|
711
|
+
try:
|
|
712
|
+
if 200 <= _response.status_code < 300:
|
|
713
|
+
_data = typing.cast(
|
|
714
|
+
EnvironmentsGetAnalyticsResponse,
|
|
715
|
+
parse_obj_as(
|
|
716
|
+
type_=EnvironmentsGetAnalyticsResponse, # type: ignore
|
|
717
|
+
object_=_response.json(),
|
|
718
|
+
),
|
|
719
|
+
)
|
|
720
|
+
return HttpResponse(response=_response, data=_data)
|
|
721
|
+
if _response.status_code == 400:
|
|
722
|
+
raise BadRequestError(
|
|
723
|
+
headers=dict(_response.headers),
|
|
724
|
+
body=typing.cast(
|
|
725
|
+
typing.Optional[typing.Any],
|
|
508
726
|
parse_obj_as(
|
|
509
|
-
type_=
|
|
727
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
510
728
|
object_=_response.json(),
|
|
511
729
|
),
|
|
512
730
|
),
|
|
@@ -533,13 +751,35 @@ class RawEnvironmentsClient:
|
|
|
533
751
|
),
|
|
534
752
|
),
|
|
535
753
|
)
|
|
754
|
+
if _response.status_code == 429:
|
|
755
|
+
raise TooManyRequestsError(
|
|
756
|
+
headers=dict(_response.headers),
|
|
757
|
+
body=typing.cast(
|
|
758
|
+
RateLimitError,
|
|
759
|
+
parse_obj_as(
|
|
760
|
+
type_=RateLimitError, # type: ignore
|
|
761
|
+
object_=_response.json(),
|
|
762
|
+
),
|
|
763
|
+
),
|
|
764
|
+
)
|
|
536
765
|
if _response.status_code == 500:
|
|
537
766
|
raise InternalServerError(
|
|
538
767
|
headers=dict(_response.headers),
|
|
539
768
|
body=typing.cast(
|
|
540
|
-
|
|
769
|
+
typing.Optional[typing.Any],
|
|
770
|
+
parse_obj_as(
|
|
771
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
772
|
+
object_=_response.json(),
|
|
773
|
+
),
|
|
774
|
+
),
|
|
775
|
+
)
|
|
776
|
+
if _response.status_code == 503:
|
|
777
|
+
raise ServiceUnavailableError(
|
|
778
|
+
headers=dict(_response.headers),
|
|
779
|
+
body=typing.cast(
|
|
780
|
+
typing.Optional[typing.Any],
|
|
541
781
|
parse_obj_as(
|
|
542
|
-
type_=
|
|
782
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
543
783
|
object_=_response.json(),
|
|
544
784
|
),
|
|
545
785
|
),
|
|
@@ -603,9 +843,9 @@ class AsyncRawEnvironmentsClient:
|
|
|
603
843
|
raise BadRequestError(
|
|
604
844
|
headers=dict(_response.headers),
|
|
605
845
|
body=typing.cast(
|
|
606
|
-
|
|
846
|
+
typing.Optional[typing.Any],
|
|
607
847
|
parse_obj_as(
|
|
608
|
-
type_=
|
|
848
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
609
849
|
object_=_response.json(),
|
|
610
850
|
),
|
|
611
851
|
),
|
|
@@ -632,13 +872,35 @@ class AsyncRawEnvironmentsClient:
|
|
|
632
872
|
),
|
|
633
873
|
),
|
|
634
874
|
)
|
|
875
|
+
if _response.status_code == 429:
|
|
876
|
+
raise TooManyRequestsError(
|
|
877
|
+
headers=dict(_response.headers),
|
|
878
|
+
body=typing.cast(
|
|
879
|
+
RateLimitError,
|
|
880
|
+
parse_obj_as(
|
|
881
|
+
type_=RateLimitError, # type: ignore
|
|
882
|
+
object_=_response.json(),
|
|
883
|
+
),
|
|
884
|
+
),
|
|
885
|
+
)
|
|
635
886
|
if _response.status_code == 500:
|
|
636
887
|
raise InternalServerError(
|
|
637
888
|
headers=dict(_response.headers),
|
|
638
889
|
body=typing.cast(
|
|
639
|
-
|
|
890
|
+
typing.Optional[typing.Any],
|
|
891
|
+
parse_obj_as(
|
|
892
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
893
|
+
object_=_response.json(),
|
|
894
|
+
),
|
|
895
|
+
),
|
|
896
|
+
)
|
|
897
|
+
if _response.status_code == 503:
|
|
898
|
+
raise ServiceUnavailableError(
|
|
899
|
+
headers=dict(_response.headers),
|
|
900
|
+
body=typing.cast(
|
|
901
|
+
typing.Optional[typing.Any],
|
|
640
902
|
parse_obj_as(
|
|
641
|
-
type_=
|
|
903
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
642
904
|
object_=_response.json(),
|
|
643
905
|
),
|
|
644
906
|
),
|
|
@@ -713,9 +975,9 @@ class AsyncRawEnvironmentsClient:
|
|
|
713
975
|
raise BadRequestError(
|
|
714
976
|
headers=dict(_response.headers),
|
|
715
977
|
body=typing.cast(
|
|
716
|
-
|
|
978
|
+
typing.Optional[typing.Any],
|
|
717
979
|
parse_obj_as(
|
|
718
|
-
type_=
|
|
980
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
719
981
|
object_=_response.json(),
|
|
720
982
|
),
|
|
721
983
|
),
|
|
@@ -746,9 +1008,20 @@ class AsyncRawEnvironmentsClient:
|
|
|
746
1008
|
raise ConflictError(
|
|
747
1009
|
headers=dict(_response.headers),
|
|
748
1010
|
body=typing.cast(
|
|
749
|
-
|
|
1011
|
+
typing.Optional[typing.Any],
|
|
750
1012
|
parse_obj_as(
|
|
751
|
-
type_=
|
|
1013
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1014
|
+
object_=_response.json(),
|
|
1015
|
+
),
|
|
1016
|
+
),
|
|
1017
|
+
)
|
|
1018
|
+
if _response.status_code == 429:
|
|
1019
|
+
raise TooManyRequestsError(
|
|
1020
|
+
headers=dict(_response.headers),
|
|
1021
|
+
body=typing.cast(
|
|
1022
|
+
RateLimitError,
|
|
1023
|
+
parse_obj_as(
|
|
1024
|
+
type_=RateLimitError, # type: ignore
|
|
752
1025
|
object_=_response.json(),
|
|
753
1026
|
),
|
|
754
1027
|
),
|
|
@@ -757,9 +1030,20 @@ class AsyncRawEnvironmentsClient:
|
|
|
757
1030
|
raise InternalServerError(
|
|
758
1031
|
headers=dict(_response.headers),
|
|
759
1032
|
body=typing.cast(
|
|
760
|
-
|
|
1033
|
+
typing.Optional[typing.Any],
|
|
1034
|
+
parse_obj_as(
|
|
1035
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1036
|
+
object_=_response.json(),
|
|
1037
|
+
),
|
|
1038
|
+
),
|
|
1039
|
+
)
|
|
1040
|
+
if _response.status_code == 503:
|
|
1041
|
+
raise ServiceUnavailableError(
|
|
1042
|
+
headers=dict(_response.headers),
|
|
1043
|
+
body=typing.cast(
|
|
1044
|
+
typing.Optional[typing.Any],
|
|
761
1045
|
parse_obj_as(
|
|
762
|
-
type_=
|
|
1046
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
763
1047
|
object_=_response.json(),
|
|
764
1048
|
),
|
|
765
1049
|
),
|
|
@@ -821,9 +1105,9 @@ class AsyncRawEnvironmentsClient:
|
|
|
821
1105
|
raise BadRequestError(
|
|
822
1106
|
headers=dict(_response.headers),
|
|
823
1107
|
body=typing.cast(
|
|
824
|
-
|
|
1108
|
+
typing.Optional[typing.Any],
|
|
825
1109
|
parse_obj_as(
|
|
826
|
-
type_=
|
|
1110
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
827
1111
|
object_=_response.json(),
|
|
828
1112
|
),
|
|
829
1113
|
),
|
|
@@ -850,13 +1134,35 @@ class AsyncRawEnvironmentsClient:
|
|
|
850
1134
|
),
|
|
851
1135
|
),
|
|
852
1136
|
)
|
|
1137
|
+
if _response.status_code == 429:
|
|
1138
|
+
raise TooManyRequestsError(
|
|
1139
|
+
headers=dict(_response.headers),
|
|
1140
|
+
body=typing.cast(
|
|
1141
|
+
RateLimitError,
|
|
1142
|
+
parse_obj_as(
|
|
1143
|
+
type_=RateLimitError, # type: ignore
|
|
1144
|
+
object_=_response.json(),
|
|
1145
|
+
),
|
|
1146
|
+
),
|
|
1147
|
+
)
|
|
853
1148
|
if _response.status_code == 500:
|
|
854
1149
|
raise InternalServerError(
|
|
855
1150
|
headers=dict(_response.headers),
|
|
856
1151
|
body=typing.cast(
|
|
857
|
-
|
|
1152
|
+
typing.Optional[typing.Any],
|
|
858
1153
|
parse_obj_as(
|
|
859
|
-
type_=
|
|
1154
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1155
|
+
object_=_response.json(),
|
|
1156
|
+
),
|
|
1157
|
+
),
|
|
1158
|
+
)
|
|
1159
|
+
if _response.status_code == 503:
|
|
1160
|
+
raise ServiceUnavailableError(
|
|
1161
|
+
headers=dict(_response.headers),
|
|
1162
|
+
body=typing.cast(
|
|
1163
|
+
typing.Optional[typing.Any],
|
|
1164
|
+
parse_obj_as(
|
|
1165
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
860
1166
|
object_=_response.json(),
|
|
861
1167
|
),
|
|
862
1168
|
),
|
|
@@ -934,9 +1240,9 @@ class AsyncRawEnvironmentsClient:
|
|
|
934
1240
|
raise BadRequestError(
|
|
935
1241
|
headers=dict(_response.headers),
|
|
936
1242
|
body=typing.cast(
|
|
937
|
-
|
|
1243
|
+
typing.Optional[typing.Any],
|
|
938
1244
|
parse_obj_as(
|
|
939
|
-
type_=
|
|
1245
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
940
1246
|
object_=_response.json(),
|
|
941
1247
|
),
|
|
942
1248
|
),
|
|
@@ -967,9 +1273,20 @@ class AsyncRawEnvironmentsClient:
|
|
|
967
1273
|
raise ConflictError(
|
|
968
1274
|
headers=dict(_response.headers),
|
|
969
1275
|
body=typing.cast(
|
|
970
|
-
|
|
1276
|
+
typing.Optional[typing.Any],
|
|
971
1277
|
parse_obj_as(
|
|
972
|
-
type_=
|
|
1278
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1279
|
+
object_=_response.json(),
|
|
1280
|
+
),
|
|
1281
|
+
),
|
|
1282
|
+
)
|
|
1283
|
+
if _response.status_code == 429:
|
|
1284
|
+
raise TooManyRequestsError(
|
|
1285
|
+
headers=dict(_response.headers),
|
|
1286
|
+
body=typing.cast(
|
|
1287
|
+
RateLimitError,
|
|
1288
|
+
parse_obj_as(
|
|
1289
|
+
type_=RateLimitError, # type: ignore
|
|
973
1290
|
object_=_response.json(),
|
|
974
1291
|
),
|
|
975
1292
|
),
|
|
@@ -978,9 +1295,20 @@ class AsyncRawEnvironmentsClient:
|
|
|
978
1295
|
raise InternalServerError(
|
|
979
1296
|
headers=dict(_response.headers),
|
|
980
1297
|
body=typing.cast(
|
|
981
|
-
|
|
1298
|
+
typing.Optional[typing.Any],
|
|
1299
|
+
parse_obj_as(
|
|
1300
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1301
|
+
object_=_response.json(),
|
|
1302
|
+
),
|
|
1303
|
+
),
|
|
1304
|
+
)
|
|
1305
|
+
if _response.status_code == 503:
|
|
1306
|
+
raise ServiceUnavailableError(
|
|
1307
|
+
headers=dict(_response.headers),
|
|
1308
|
+
body=typing.cast(
|
|
1309
|
+
typing.Optional[typing.Any],
|
|
982
1310
|
parse_obj_as(
|
|
983
|
-
type_=
|
|
1311
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
984
1312
|
object_=_response.json(),
|
|
985
1313
|
),
|
|
986
1314
|
),
|
|
@@ -1034,9 +1362,138 @@ class AsyncRawEnvironmentsClient:
|
|
|
1034
1362
|
raise BadRequestError(
|
|
1035
1363
|
headers=dict(_response.headers),
|
|
1036
1364
|
body=typing.cast(
|
|
1037
|
-
|
|
1365
|
+
typing.Optional[typing.Any],
|
|
1366
|
+
parse_obj_as(
|
|
1367
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1368
|
+
object_=_response.json(),
|
|
1369
|
+
),
|
|
1370
|
+
),
|
|
1371
|
+
)
|
|
1372
|
+
if _response.status_code == 403:
|
|
1373
|
+
raise ForbiddenError(
|
|
1374
|
+
headers=dict(_response.headers),
|
|
1375
|
+
body=typing.cast(
|
|
1376
|
+
PermissionDeniedError,
|
|
1377
|
+
parse_obj_as(
|
|
1378
|
+
type_=PermissionDeniedError, # type: ignore
|
|
1379
|
+
object_=_response.json(),
|
|
1380
|
+
),
|
|
1381
|
+
),
|
|
1382
|
+
)
|
|
1383
|
+
if _response.status_code == 404:
|
|
1384
|
+
raise NotFoundError(
|
|
1385
|
+
headers=dict(_response.headers),
|
|
1386
|
+
body=typing.cast(
|
|
1387
|
+
NotFoundErrorBody,
|
|
1388
|
+
parse_obj_as(
|
|
1389
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
1390
|
+
object_=_response.json(),
|
|
1391
|
+
),
|
|
1392
|
+
),
|
|
1393
|
+
)
|
|
1394
|
+
if _response.status_code == 429:
|
|
1395
|
+
raise TooManyRequestsError(
|
|
1396
|
+
headers=dict(_response.headers),
|
|
1397
|
+
body=typing.cast(
|
|
1398
|
+
RateLimitError,
|
|
1399
|
+
parse_obj_as(
|
|
1400
|
+
type_=RateLimitError, # type: ignore
|
|
1401
|
+
object_=_response.json(),
|
|
1402
|
+
),
|
|
1403
|
+
),
|
|
1404
|
+
)
|
|
1405
|
+
if _response.status_code == 500:
|
|
1406
|
+
raise InternalServerError(
|
|
1407
|
+
headers=dict(_response.headers),
|
|
1408
|
+
body=typing.cast(
|
|
1409
|
+
typing.Optional[typing.Any],
|
|
1410
|
+
parse_obj_as(
|
|
1411
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1412
|
+
object_=_response.json(),
|
|
1413
|
+
),
|
|
1414
|
+
),
|
|
1415
|
+
)
|
|
1416
|
+
if _response.status_code == 503:
|
|
1417
|
+
raise ServiceUnavailableError(
|
|
1418
|
+
headers=dict(_response.headers),
|
|
1419
|
+
body=typing.cast(
|
|
1420
|
+
typing.Optional[typing.Any],
|
|
1421
|
+
parse_obj_as(
|
|
1422
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1423
|
+
object_=_response.json(),
|
|
1424
|
+
),
|
|
1425
|
+
),
|
|
1426
|
+
)
|
|
1427
|
+
_response_json = _response.json()
|
|
1428
|
+
except JSONDecodeError:
|
|
1429
|
+
raise ApiError(
|
|
1430
|
+
status_code=_response.status_code,
|
|
1431
|
+
headers=dict(_response.headers),
|
|
1432
|
+
body=_response.text,
|
|
1433
|
+
)
|
|
1434
|
+
raise ApiError(
|
|
1435
|
+
status_code=_response.status_code,
|
|
1436
|
+
headers=dict(_response.headers),
|
|
1437
|
+
body=_response_json,
|
|
1438
|
+
)
|
|
1439
|
+
|
|
1440
|
+
async def getanalytics(
|
|
1441
|
+
self,
|
|
1442
|
+
organization_id: str,
|
|
1443
|
+
project_id: str,
|
|
1444
|
+
environment_id: str,
|
|
1445
|
+
*,
|
|
1446
|
+
start_time: str,
|
|
1447
|
+
end_time: str,
|
|
1448
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1449
|
+
) -> AsyncHttpResponse[EnvironmentsGetAnalyticsResponse]:
|
|
1450
|
+
"""
|
|
1451
|
+
Parameters
|
|
1452
|
+
----------
|
|
1453
|
+
organization_id : str
|
|
1454
|
+
|
|
1455
|
+
project_id : str
|
|
1456
|
+
|
|
1457
|
+
environment_id : str
|
|
1458
|
+
|
|
1459
|
+
start_time : str
|
|
1460
|
+
|
|
1461
|
+
end_time : str
|
|
1462
|
+
|
|
1463
|
+
request_options : typing.Optional[RequestOptions]
|
|
1464
|
+
Request-specific configuration.
|
|
1465
|
+
|
|
1466
|
+
Returns
|
|
1467
|
+
-------
|
|
1468
|
+
AsyncHttpResponse[EnvironmentsGetAnalyticsResponse]
|
|
1469
|
+
Success
|
|
1470
|
+
"""
|
|
1471
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1472
|
+
f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/analytics",
|
|
1473
|
+
method="GET",
|
|
1474
|
+
params={
|
|
1475
|
+
"startTime": start_time,
|
|
1476
|
+
"endTime": end_time,
|
|
1477
|
+
},
|
|
1478
|
+
request_options=request_options,
|
|
1479
|
+
)
|
|
1480
|
+
try:
|
|
1481
|
+
if 200 <= _response.status_code < 300:
|
|
1482
|
+
_data = typing.cast(
|
|
1483
|
+
EnvironmentsGetAnalyticsResponse,
|
|
1484
|
+
parse_obj_as(
|
|
1485
|
+
type_=EnvironmentsGetAnalyticsResponse, # type: ignore
|
|
1486
|
+
object_=_response.json(),
|
|
1487
|
+
),
|
|
1488
|
+
)
|
|
1489
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1490
|
+
if _response.status_code == 400:
|
|
1491
|
+
raise BadRequestError(
|
|
1492
|
+
headers=dict(_response.headers),
|
|
1493
|
+
body=typing.cast(
|
|
1494
|
+
typing.Optional[typing.Any],
|
|
1038
1495
|
parse_obj_as(
|
|
1039
|
-
type_=
|
|
1496
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1040
1497
|
object_=_response.json(),
|
|
1041
1498
|
),
|
|
1042
1499
|
),
|
|
@@ -1063,13 +1520,35 @@ class AsyncRawEnvironmentsClient:
|
|
|
1063
1520
|
),
|
|
1064
1521
|
),
|
|
1065
1522
|
)
|
|
1523
|
+
if _response.status_code == 429:
|
|
1524
|
+
raise TooManyRequestsError(
|
|
1525
|
+
headers=dict(_response.headers),
|
|
1526
|
+
body=typing.cast(
|
|
1527
|
+
RateLimitError,
|
|
1528
|
+
parse_obj_as(
|
|
1529
|
+
type_=RateLimitError, # type: ignore
|
|
1530
|
+
object_=_response.json(),
|
|
1531
|
+
),
|
|
1532
|
+
),
|
|
1533
|
+
)
|
|
1066
1534
|
if _response.status_code == 500:
|
|
1067
1535
|
raise InternalServerError(
|
|
1068
1536
|
headers=dict(_response.headers),
|
|
1069
1537
|
body=typing.cast(
|
|
1070
|
-
|
|
1538
|
+
typing.Optional[typing.Any],
|
|
1539
|
+
parse_obj_as(
|
|
1540
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1541
|
+
object_=_response.json(),
|
|
1542
|
+
),
|
|
1543
|
+
),
|
|
1544
|
+
)
|
|
1545
|
+
if _response.status_code == 503:
|
|
1546
|
+
raise ServiceUnavailableError(
|
|
1547
|
+
headers=dict(_response.headers),
|
|
1548
|
+
body=typing.cast(
|
|
1549
|
+
typing.Optional[typing.Any],
|
|
1071
1550
|
parse_obj_as(
|
|
1072
|
-
type_=
|
|
1551
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1073
1552
|
object_=_response.json(),
|
|
1074
1553
|
),
|
|
1075
1554
|
),
|