blaxel 0.64.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.
- blaxel/__init__.py +8 -0
- blaxel/agents/__init__.py +5 -0
- blaxel/agents/chain.py +153 -0
- blaxel/agents/chat.py +286 -0
- blaxel/agents/decorator.py +208 -0
- blaxel/agents/thread.py +24 -0
- blaxel/agents/voice/openai.py +255 -0
- blaxel/agents/voice/utils.py +25 -0
- blaxel/api/__init__.py +1 -0
- blaxel/api/agents/__init__.py +0 -0
- blaxel/api/agents/create_agent.py +155 -0
- blaxel/api/agents/delete_agent.py +146 -0
- blaxel/api/agents/get_agent.py +146 -0
- blaxel/api/agents/get_agent_logs.py +151 -0
- blaxel/api/agents/get_agent_metrics.py +150 -0
- blaxel/api/agents/get_agent_trace_ids.py +201 -0
- blaxel/api/agents/list_agent_revisions.py +155 -0
- blaxel/api/agents/list_agents.py +127 -0
- blaxel/api/agents/update_agent.py +168 -0
- blaxel/api/configurations/__init__.py +0 -0
- blaxel/api/configurations/get_configuration.py +122 -0
- blaxel/api/default/__init__.py +0 -0
- blaxel/api/default/get_trace.py +150 -0
- blaxel/api/default/get_trace_ids.py +218 -0
- blaxel/api/default/get_trace_logs.py +186 -0
- blaxel/api/default/list_mcp_hub_definitions.py +127 -0
- blaxel/api/functions/__init__.py +0 -0
- blaxel/api/functions/create_function.py +155 -0
- blaxel/api/functions/delete_function.py +146 -0
- blaxel/api/functions/get_function.py +146 -0
- blaxel/api/functions/get_function_logs.py +151 -0
- blaxel/api/functions/get_function_metrics.py +150 -0
- blaxel/api/functions/get_function_trace_ids.py +201 -0
- blaxel/api/functions/list_function_revisions.py +158 -0
- blaxel/api/functions/list_functions.py +131 -0
- blaxel/api/functions/update_function.py +168 -0
- blaxel/api/integrations/__init__.py +0 -0
- blaxel/api/integrations/create_integration_connection.py +167 -0
- blaxel/api/integrations/delete_integration_connection.py +158 -0
- blaxel/api/integrations/get_integration.py +97 -0
- blaxel/api/integrations/get_integration_connection.py +158 -0
- blaxel/api/integrations/get_integration_connection_model.py +104 -0
- blaxel/api/integrations/get_integration_connection_model_endpoint_configurations.py +97 -0
- blaxel/api/integrations/list_integration_connection_models.py +97 -0
- blaxel/api/integrations/list_integration_connections.py +139 -0
- blaxel/api/integrations/update_integration_connection.py +180 -0
- blaxel/api/invitations/__init__.py +0 -0
- blaxel/api/invitations/list_all_pending_invitations.py +142 -0
- blaxel/api/knowledgebases/__init__.py +0 -0
- blaxel/api/knowledgebases/create_knowledgebase.py +163 -0
- blaxel/api/knowledgebases/delete_knowledgebase.py +154 -0
- blaxel/api/knowledgebases/get_knowledgebase.py +154 -0
- blaxel/api/knowledgebases/list_knowledgebase_revisions.py +158 -0
- blaxel/api/knowledgebases/list_knowledgebases.py +139 -0
- blaxel/api/knowledgebases/update_knowledgebase.py +176 -0
- blaxel/api/locations/__init__.py +0 -0
- blaxel/api/locations/list_locations.py +139 -0
- blaxel/api/metrics/__init__.py +0 -0
- blaxel/api/metrics/get_metrics.py +130 -0
- blaxel/api/models/__init__.py +0 -0
- blaxel/api/models/create_model.py +163 -0
- blaxel/api/models/delete_model.py +154 -0
- blaxel/api/models/get_model.py +154 -0
- blaxel/api/models/get_model_logs.py +155 -0
- blaxel/api/models/get_model_metrics.py +158 -0
- blaxel/api/models/get_model_trace_ids.py +201 -0
- blaxel/api/models/list_model_revisions.py +158 -0
- blaxel/api/models/list_models.py +135 -0
- blaxel/api/models/update_model.py +176 -0
- blaxel/api/policies/__init__.py +0 -0
- blaxel/api/policies/create_policy.py +167 -0
- blaxel/api/policies/delete_policy.py +154 -0
- blaxel/api/policies/get_policy.py +154 -0
- blaxel/api/policies/list_policies.py +139 -0
- blaxel/api/policies/update_policy.py +180 -0
- blaxel/api/privateclusters/__init__.py +0 -0
- blaxel/api/privateclusters/create_private_cluster.py +132 -0
- blaxel/api/privateclusters/delete_private_cluster.py +156 -0
- blaxel/api/privateclusters/get_private_cluster.py +159 -0
- blaxel/api/privateclusters/get_private_cluster_health.py +97 -0
- blaxel/api/privateclusters/list_private_clusters.py +140 -0
- blaxel/api/privateclusters/update_private_cluster.py +156 -0
- blaxel/api/privateclusters/update_private_cluster_health.py +97 -0
- blaxel/api/service_accounts/__init__.py +0 -0
- blaxel/api/service_accounts/create_api_key_for_service_account.py +177 -0
- blaxel/api/service_accounts/create_workspace_service_account.py +170 -0
- blaxel/api/service_accounts/delete_api_key_for_service_account.py +104 -0
- blaxel/api/service_accounts/delete_workspace_service_account.py +160 -0
- blaxel/api/service_accounts/get_workspace_service_accounts.py +141 -0
- blaxel/api/service_accounts/list_api_keys_for_service_account.py +163 -0
- blaxel/api/service_accounts/update_workspace_service_account.py +183 -0
- blaxel/api/store/__init__.py +0 -0
- blaxel/api/store/get_store_agent.py +146 -0
- blaxel/api/store/get_store_function.py +146 -0
- blaxel/api/store/list_store_agents.py +131 -0
- blaxel/api/store/list_store_functions.py +131 -0
- blaxel/api/workspaces/__init__.py +0 -0
- blaxel/api/workspaces/accept_workspace_invitation.py +161 -0
- blaxel/api/workspaces/create_worspace.py +163 -0
- blaxel/api/workspaces/decline_workspace_invitation.py +158 -0
- blaxel/api/workspaces/delete_workspace.py +154 -0
- blaxel/api/workspaces/get_workspace.py +154 -0
- blaxel/api/workspaces/invite_workspace_user.py +174 -0
- blaxel/api/workspaces/leave_workspace.py +161 -0
- blaxel/api/workspaces/list_workspace_users.py +139 -0
- blaxel/api/workspaces/list_workspaces.py +139 -0
- blaxel/api/workspaces/remove_workspace_user.py +101 -0
- blaxel/api/workspaces/update_workspace.py +176 -0
- blaxel/api/workspaces/update_workspace_user_role.py +187 -0
- blaxel/authentication/__init__.py +45 -0
- blaxel/authentication/apikey.py +50 -0
- blaxel/authentication/authentication.py +176 -0
- blaxel/authentication/clientcredentials.py +103 -0
- blaxel/authentication/credentials.py +295 -0
- blaxel/authentication/device_mode.py +197 -0
- blaxel/client.py +281 -0
- blaxel/common/__init__.py +17 -0
- blaxel/common/error.py +27 -0
- blaxel/common/instrumentation.py +317 -0
- blaxel/common/logger.py +60 -0
- blaxel/common/secrets.py +39 -0
- blaxel/common/settings.py +150 -0
- blaxel/common/slugify.py +18 -0
- blaxel/common/utils.py +34 -0
- blaxel/deploy/__init__.py +8 -0
- blaxel/deploy/deploy.py +316 -0
- blaxel/deploy/format.py +46 -0
- blaxel/deploy/parser.py +192 -0
- blaxel/errors.py +16 -0
- blaxel/functions/__init__.py +7 -0
- blaxel/functions/common.py +228 -0
- blaxel/functions/decorator.py +64 -0
- blaxel/functions/local/local.py +48 -0
- blaxel/functions/mcp/client.py +96 -0
- blaxel/functions/mcp/mcp.py +168 -0
- blaxel/functions/mcp/utils.py +56 -0
- blaxel/functions/remote/remote.py +183 -0
- blaxel/models/__init__.py +233 -0
- blaxel/models/acl.py +133 -0
- blaxel/models/agent.py +126 -0
- blaxel/models/agent_chain.py +88 -0
- blaxel/models/agent_spec.py +346 -0
- blaxel/models/api_key.py +142 -0
- blaxel/models/configuration.py +85 -0
- blaxel/models/continent.py +70 -0
- blaxel/models/core_event.py +97 -0
- blaxel/models/core_spec.py +249 -0
- blaxel/models/core_spec_configurations.py +77 -0
- blaxel/models/country.py +70 -0
- blaxel/models/create_api_key_for_service_account_body.py +69 -0
- blaxel/models/create_workspace_service_account_body.py +71 -0
- blaxel/models/create_workspace_service_account_response_200.py +105 -0
- blaxel/models/delete_workspace_service_account_response_200.py +96 -0
- blaxel/models/entrypoint.py +96 -0
- blaxel/models/entrypoint_env.py +45 -0
- blaxel/models/flavor.py +70 -0
- blaxel/models/form.py +120 -0
- blaxel/models/form_config.py +45 -0
- blaxel/models/form_oauthomitempty.py +45 -0
- blaxel/models/form_secrets.py +45 -0
- blaxel/models/function.py +126 -0
- blaxel/models/function_kit.py +97 -0
- blaxel/models/function_spec.py +310 -0
- blaxel/models/get_trace_ids_response_200.py +45 -0
- blaxel/models/get_trace_logs_response_200.py +45 -0
- blaxel/models/get_trace_response_200.py +45 -0
- blaxel/models/get_workspace_service_accounts_response_200_item.py +96 -0
- blaxel/models/histogram_bucket.py +79 -0
- blaxel/models/histogram_stats.py +88 -0
- blaxel/models/integration_connection.py +96 -0
- blaxel/models/integration_connection_spec.py +114 -0
- blaxel/models/integration_connection_spec_config.py +45 -0
- blaxel/models/integration_connection_spec_secret.py +45 -0
- blaxel/models/integration_model.py +162 -0
- blaxel/models/integration_repository.py +88 -0
- blaxel/models/invite_workspace_user_body.py +60 -0
- blaxel/models/knowledgebase.py +126 -0
- blaxel/models/knowledgebase_spec.py +163 -0
- blaxel/models/knowledgebase_spec_options.py +45 -0
- blaxel/models/last_n_requests_metric.py +79 -0
- blaxel/models/latency_metric.py +144 -0
- blaxel/models/location_response.py +113 -0
- blaxel/models/mcp_definition.py +188 -0
- blaxel/models/mcp_definition_entrypoint.py +45 -0
- blaxel/models/mcp_definition_form.py +45 -0
- blaxel/models/metadata.py +139 -0
- blaxel/models/metadata_labels.py +45 -0
- blaxel/models/metric.py +79 -0
- blaxel/models/metrics.py +169 -0
- blaxel/models/metrics_models.py +45 -0
- blaxel/models/metrics_request_total_per_code.py +45 -0
- blaxel/models/metrics_rps_per_code.py +45 -0
- blaxel/models/model.py +126 -0
- blaxel/models/model_private_cluster.py +79 -0
- blaxel/models/model_spec.py +249 -0
- blaxel/models/o_auth.py +72 -0
- blaxel/models/owner_fields.py +70 -0
- blaxel/models/pending_invitation.py +124 -0
- blaxel/models/pending_invitation_accept.py +85 -0
- blaxel/models/pending_invitation_render.py +147 -0
- blaxel/models/pending_invitation_render_invited_by.py +88 -0
- blaxel/models/pending_invitation_render_workspace.py +70 -0
- blaxel/models/pending_invitation_workspace_details.py +72 -0
- blaxel/models/pod_template_spec.py +45 -0
- blaxel/models/policy.py +96 -0
- blaxel/models/policy_location.py +70 -0
- blaxel/models/policy_max_tokens.py +106 -0
- blaxel/models/policy_spec.py +151 -0
- blaxel/models/private_cluster.py +183 -0
- blaxel/models/private_location.py +61 -0
- blaxel/models/repository.py +70 -0
- blaxel/models/request_duration_over_time_metric.py +97 -0
- blaxel/models/request_duration_over_time_metrics.py +80 -0
- blaxel/models/request_total_by_origin_metric.py +115 -0
- blaxel/models/request_total_by_origin_metric_request_total_by_origin.py +45 -0
- blaxel/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +45 -0
- blaxel/models/request_total_metric.py +123 -0
- blaxel/models/request_total_metric_request_total_per_code.py +45 -0
- blaxel/models/request_total_metric_rps_per_code.py +45 -0
- blaxel/models/resource_log.py +79 -0
- blaxel/models/resource_metrics.py +270 -0
- blaxel/models/resource_metrics_request_total_per_code.py +45 -0
- blaxel/models/resource_metrics_rps_per_code.py +45 -0
- blaxel/models/revision_configuration.py +97 -0
- blaxel/models/revision_metadata.py +124 -0
- blaxel/models/runtime.py +196 -0
- blaxel/models/runtime_startup_probe.py +45 -0
- blaxel/models/serverless_config.py +80 -0
- blaxel/models/spec_configuration.py +70 -0
- blaxel/models/store_agent.py +178 -0
- blaxel/models/store_agent_labels.py +45 -0
- blaxel/models/store_configuration.py +151 -0
- blaxel/models/store_configuration_option.py +79 -0
- blaxel/models/store_function.py +211 -0
- blaxel/models/store_function_kit.py +97 -0
- blaxel/models/store_function_labels.py +45 -0
- blaxel/models/store_function_parameter.py +88 -0
- blaxel/models/time_fields.py +70 -0
- blaxel/models/token_rate_metric.py +88 -0
- blaxel/models/token_rate_metrics.py +120 -0
- blaxel/models/token_total_metric.py +106 -0
- blaxel/models/trace_ids_response.py +45 -0
- blaxel/models/update_workspace_service_account_body.py +69 -0
- blaxel/models/update_workspace_service_account_response_200.py +96 -0
- blaxel/models/update_workspace_user_role_body.py +60 -0
- blaxel/models/websocket_channel.py +88 -0
- blaxel/models/workspace.py +148 -0
- blaxel/models/workspace_labels.py +45 -0
- blaxel/models/workspace_user.py +115 -0
- blaxel/py.typed +1 -0
- blaxel/run.py +108 -0
- blaxel/serve/app.py +131 -0
- blaxel/serve/middlewares/__init__.py +10 -0
- blaxel/serve/middlewares/accesslog.py +32 -0
- blaxel/serve/middlewares/processtime.py +28 -0
- blaxel/types.py +46 -0
- blaxel-0.64.0.dist-info/METADATA +96 -0
- blaxel-0.64.0.dist-info/RECORD +261 -0
- blaxel-0.64.0.dist-info/WHEEL +4 -0
- blaxel-0.64.0.dist-info/entry_points.txt +2 -0
- blaxel-0.64.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,270 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
if TYPE_CHECKING:
|
9
|
+
from ..models.latency_metric import LatencyMetric
|
10
|
+
from ..models.metric import Metric
|
11
|
+
from ..models.request_duration_over_time_metrics import RequestDurationOverTimeMetrics
|
12
|
+
from ..models.request_total_by_origin_metric import RequestTotalByOriginMetric
|
13
|
+
from ..models.resource_metrics_request_total_per_code import ResourceMetricsRequestTotalPerCode
|
14
|
+
from ..models.resource_metrics_rps_per_code import ResourceMetricsRpsPerCode
|
15
|
+
from ..models.token_rate_metrics import TokenRateMetrics
|
16
|
+
from ..models.token_total_metric import TokenTotalMetric
|
17
|
+
|
18
|
+
|
19
|
+
T = TypeVar("T", bound="ResourceMetrics")
|
20
|
+
|
21
|
+
|
22
|
+
@_attrs_define
|
23
|
+
class ResourceMetrics:
|
24
|
+
"""Metrics for a single resource deployment (eg. model deployment, function deployment)
|
25
|
+
|
26
|
+
Attributes:
|
27
|
+
inference_global (Union[Unset, list['Metric']]): Array of metrics
|
28
|
+
last_n_requests (Union[Unset, list['Metric']]): Array of metrics
|
29
|
+
latency (Union[Unset, LatencyMetric]): Latency metrics
|
30
|
+
request_duration_over_time (Union[Unset, RequestDurationOverTimeMetrics]): Request duration over time metrics
|
31
|
+
request_total (Union[Unset, float]): Number of requests for the resource globally
|
32
|
+
request_total_by_origin (Union[Unset, RequestTotalByOriginMetric]): Request total by origin metric
|
33
|
+
request_total_per_code (Union[Unset, ResourceMetricsRequestTotalPerCode]): Number of requests for the resource
|
34
|
+
globally per code
|
35
|
+
rps (Union[Unset, float]): Number of requests per second for the resource globally
|
36
|
+
rps_per_code (Union[Unset, ResourceMetricsRpsPerCode]): Number of requests per second for the resource globally
|
37
|
+
per code
|
38
|
+
token_rate (Union[Unset, TokenRateMetrics]): Token rate metrics
|
39
|
+
token_total (Union[Unset, TokenTotalMetric]): Token total metric
|
40
|
+
"""
|
41
|
+
|
42
|
+
inference_global: Union[Unset, list["Metric"]] = UNSET
|
43
|
+
last_n_requests: Union[Unset, list["Metric"]] = UNSET
|
44
|
+
latency: Union[Unset, "LatencyMetric"] = UNSET
|
45
|
+
request_duration_over_time: Union[Unset, "RequestDurationOverTimeMetrics"] = UNSET
|
46
|
+
request_total: Union[Unset, float] = UNSET
|
47
|
+
request_total_by_origin: Union[Unset, "RequestTotalByOriginMetric"] = UNSET
|
48
|
+
request_total_per_code: Union[Unset, "ResourceMetricsRequestTotalPerCode"] = UNSET
|
49
|
+
rps: Union[Unset, float] = UNSET
|
50
|
+
rps_per_code: Union[Unset, "ResourceMetricsRpsPerCode"] = UNSET
|
51
|
+
token_rate: Union[Unset, "TokenRateMetrics"] = UNSET
|
52
|
+
token_total: Union[Unset, "TokenTotalMetric"] = UNSET
|
53
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
54
|
+
|
55
|
+
def to_dict(self) -> dict[str, Any]:
|
56
|
+
inference_global: Union[Unset, list[dict[str, Any]]] = UNSET
|
57
|
+
if not isinstance(self.inference_global, Unset):
|
58
|
+
inference_global = []
|
59
|
+
for componentsschemas_array_metric_item_data in self.inference_global:
|
60
|
+
componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
|
61
|
+
inference_global.append(componentsschemas_array_metric_item)
|
62
|
+
|
63
|
+
last_n_requests: Union[Unset, list[dict[str, Any]]] = UNSET
|
64
|
+
if not isinstance(self.last_n_requests, Unset):
|
65
|
+
last_n_requests = []
|
66
|
+
for componentsschemas_array_metric_item_data in self.last_n_requests:
|
67
|
+
componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
|
68
|
+
last_n_requests.append(componentsschemas_array_metric_item)
|
69
|
+
|
70
|
+
latency: Union[Unset, dict[str, Any]] = UNSET
|
71
|
+
if self.latency and not isinstance(self.latency, Unset) and not isinstance(self.latency, dict):
|
72
|
+
latency = self.latency.to_dict()
|
73
|
+
elif self.latency and isinstance(self.latency, dict):
|
74
|
+
latency = self.latency
|
75
|
+
|
76
|
+
request_duration_over_time: Union[Unset, dict[str, Any]] = UNSET
|
77
|
+
if (
|
78
|
+
self.request_duration_over_time
|
79
|
+
and not isinstance(self.request_duration_over_time, Unset)
|
80
|
+
and not isinstance(self.request_duration_over_time, dict)
|
81
|
+
):
|
82
|
+
request_duration_over_time = self.request_duration_over_time.to_dict()
|
83
|
+
elif self.request_duration_over_time and isinstance(self.request_duration_over_time, dict):
|
84
|
+
request_duration_over_time = self.request_duration_over_time
|
85
|
+
|
86
|
+
request_total = self.request_total
|
87
|
+
|
88
|
+
request_total_by_origin: Union[Unset, dict[str, Any]] = UNSET
|
89
|
+
if (
|
90
|
+
self.request_total_by_origin
|
91
|
+
and not isinstance(self.request_total_by_origin, Unset)
|
92
|
+
and not isinstance(self.request_total_by_origin, dict)
|
93
|
+
):
|
94
|
+
request_total_by_origin = self.request_total_by_origin.to_dict()
|
95
|
+
elif self.request_total_by_origin and isinstance(self.request_total_by_origin, dict):
|
96
|
+
request_total_by_origin = self.request_total_by_origin
|
97
|
+
|
98
|
+
request_total_per_code: Union[Unset, dict[str, Any]] = UNSET
|
99
|
+
if (
|
100
|
+
self.request_total_per_code
|
101
|
+
and not isinstance(self.request_total_per_code, Unset)
|
102
|
+
and not isinstance(self.request_total_per_code, dict)
|
103
|
+
):
|
104
|
+
request_total_per_code = self.request_total_per_code.to_dict()
|
105
|
+
elif self.request_total_per_code and isinstance(self.request_total_per_code, dict):
|
106
|
+
request_total_per_code = self.request_total_per_code
|
107
|
+
|
108
|
+
rps = self.rps
|
109
|
+
|
110
|
+
rps_per_code: Union[Unset, dict[str, Any]] = UNSET
|
111
|
+
if self.rps_per_code and not isinstance(self.rps_per_code, Unset) and not isinstance(self.rps_per_code, dict):
|
112
|
+
rps_per_code = self.rps_per_code.to_dict()
|
113
|
+
elif self.rps_per_code and isinstance(self.rps_per_code, dict):
|
114
|
+
rps_per_code = self.rps_per_code
|
115
|
+
|
116
|
+
token_rate: Union[Unset, dict[str, Any]] = UNSET
|
117
|
+
if self.token_rate and not isinstance(self.token_rate, Unset) and not isinstance(self.token_rate, dict):
|
118
|
+
token_rate = self.token_rate.to_dict()
|
119
|
+
elif self.token_rate and isinstance(self.token_rate, dict):
|
120
|
+
token_rate = self.token_rate
|
121
|
+
|
122
|
+
token_total: Union[Unset, dict[str, Any]] = UNSET
|
123
|
+
if self.token_total and not isinstance(self.token_total, Unset) and not isinstance(self.token_total, dict):
|
124
|
+
token_total = self.token_total.to_dict()
|
125
|
+
elif self.token_total and isinstance(self.token_total, dict):
|
126
|
+
token_total = self.token_total
|
127
|
+
|
128
|
+
field_dict: dict[str, Any] = {}
|
129
|
+
field_dict.update(self.additional_properties)
|
130
|
+
field_dict.update({})
|
131
|
+
if inference_global is not UNSET:
|
132
|
+
field_dict["inferenceGlobal"] = inference_global
|
133
|
+
if last_n_requests is not UNSET:
|
134
|
+
field_dict["lastNRequests"] = last_n_requests
|
135
|
+
if latency is not UNSET:
|
136
|
+
field_dict["latency"] = latency
|
137
|
+
if request_duration_over_time is not UNSET:
|
138
|
+
field_dict["requestDurationOverTime"] = request_duration_over_time
|
139
|
+
if request_total is not UNSET:
|
140
|
+
field_dict["requestTotal"] = request_total
|
141
|
+
if request_total_by_origin is not UNSET:
|
142
|
+
field_dict["requestTotalByOrigin"] = request_total_by_origin
|
143
|
+
if request_total_per_code is not UNSET:
|
144
|
+
field_dict["requestTotalPerCode"] = request_total_per_code
|
145
|
+
if rps is not UNSET:
|
146
|
+
field_dict["rps"] = rps
|
147
|
+
if rps_per_code is not UNSET:
|
148
|
+
field_dict["rpsPerCode"] = rps_per_code
|
149
|
+
if token_rate is not UNSET:
|
150
|
+
field_dict["tokenRate"] = token_rate
|
151
|
+
if token_total is not UNSET:
|
152
|
+
field_dict["tokenTotal"] = token_total
|
153
|
+
|
154
|
+
return field_dict
|
155
|
+
|
156
|
+
@classmethod
|
157
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
158
|
+
from ..models.latency_metric import LatencyMetric
|
159
|
+
from ..models.metric import Metric
|
160
|
+
from ..models.request_duration_over_time_metrics import RequestDurationOverTimeMetrics
|
161
|
+
from ..models.request_total_by_origin_metric import RequestTotalByOriginMetric
|
162
|
+
from ..models.resource_metrics_request_total_per_code import (
|
163
|
+
ResourceMetricsRequestTotalPerCode,
|
164
|
+
)
|
165
|
+
from ..models.resource_metrics_rps_per_code import ResourceMetricsRpsPerCode
|
166
|
+
from ..models.token_rate_metrics import TokenRateMetrics
|
167
|
+
from ..models.token_total_metric import TokenTotalMetric
|
168
|
+
|
169
|
+
if not src_dict:
|
170
|
+
return None
|
171
|
+
d = src_dict.copy()
|
172
|
+
inference_global = []
|
173
|
+
_inference_global = d.pop("inferenceGlobal", UNSET)
|
174
|
+
for componentsschemas_array_metric_item_data in _inference_global or []:
|
175
|
+
componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
|
176
|
+
|
177
|
+
inference_global.append(componentsschemas_array_metric_item)
|
178
|
+
|
179
|
+
last_n_requests = []
|
180
|
+
_last_n_requests = d.pop("lastNRequests", UNSET)
|
181
|
+
for componentsschemas_array_metric_item_data in _last_n_requests or []:
|
182
|
+
componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
|
183
|
+
|
184
|
+
last_n_requests.append(componentsschemas_array_metric_item)
|
185
|
+
|
186
|
+
_latency = d.pop("latency", UNSET)
|
187
|
+
latency: Union[Unset, LatencyMetric]
|
188
|
+
if isinstance(_latency, Unset):
|
189
|
+
latency = UNSET
|
190
|
+
else:
|
191
|
+
latency = LatencyMetric.from_dict(_latency)
|
192
|
+
|
193
|
+
_request_duration_over_time = d.pop("requestDurationOverTime", UNSET)
|
194
|
+
request_duration_over_time: Union[Unset, RequestDurationOverTimeMetrics]
|
195
|
+
if isinstance(_request_duration_over_time, Unset):
|
196
|
+
request_duration_over_time = UNSET
|
197
|
+
else:
|
198
|
+
request_duration_over_time = RequestDurationOverTimeMetrics.from_dict(_request_duration_over_time)
|
199
|
+
|
200
|
+
request_total = d.pop("requestTotal", UNSET)
|
201
|
+
|
202
|
+
_request_total_by_origin = d.pop("requestTotalByOrigin", UNSET)
|
203
|
+
request_total_by_origin: Union[Unset, RequestTotalByOriginMetric]
|
204
|
+
if isinstance(_request_total_by_origin, Unset):
|
205
|
+
request_total_by_origin = UNSET
|
206
|
+
else:
|
207
|
+
request_total_by_origin = RequestTotalByOriginMetric.from_dict(_request_total_by_origin)
|
208
|
+
|
209
|
+
_request_total_per_code = d.pop("requestTotalPerCode", UNSET)
|
210
|
+
request_total_per_code: Union[Unset, ResourceMetricsRequestTotalPerCode]
|
211
|
+
if isinstance(_request_total_per_code, Unset):
|
212
|
+
request_total_per_code = UNSET
|
213
|
+
else:
|
214
|
+
request_total_per_code = ResourceMetricsRequestTotalPerCode.from_dict(_request_total_per_code)
|
215
|
+
|
216
|
+
rps = d.pop("rps", UNSET)
|
217
|
+
|
218
|
+
_rps_per_code = d.pop("rpsPerCode", UNSET)
|
219
|
+
rps_per_code: Union[Unset, ResourceMetricsRpsPerCode]
|
220
|
+
if isinstance(_rps_per_code, Unset):
|
221
|
+
rps_per_code = UNSET
|
222
|
+
else:
|
223
|
+
rps_per_code = ResourceMetricsRpsPerCode.from_dict(_rps_per_code)
|
224
|
+
|
225
|
+
_token_rate = d.pop("tokenRate", UNSET)
|
226
|
+
token_rate: Union[Unset, TokenRateMetrics]
|
227
|
+
if isinstance(_token_rate, Unset):
|
228
|
+
token_rate = UNSET
|
229
|
+
else:
|
230
|
+
token_rate = TokenRateMetrics.from_dict(_token_rate)
|
231
|
+
|
232
|
+
_token_total = d.pop("tokenTotal", UNSET)
|
233
|
+
token_total: Union[Unset, TokenTotalMetric]
|
234
|
+
if isinstance(_token_total, Unset):
|
235
|
+
token_total = UNSET
|
236
|
+
else:
|
237
|
+
token_total = TokenTotalMetric.from_dict(_token_total)
|
238
|
+
|
239
|
+
resource_metrics = cls(
|
240
|
+
inference_global=inference_global,
|
241
|
+
last_n_requests=last_n_requests,
|
242
|
+
latency=latency,
|
243
|
+
request_duration_over_time=request_duration_over_time,
|
244
|
+
request_total=request_total,
|
245
|
+
request_total_by_origin=request_total_by_origin,
|
246
|
+
request_total_per_code=request_total_per_code,
|
247
|
+
rps=rps,
|
248
|
+
rps_per_code=rps_per_code,
|
249
|
+
token_rate=token_rate,
|
250
|
+
token_total=token_total,
|
251
|
+
)
|
252
|
+
|
253
|
+
resource_metrics.additional_properties = d
|
254
|
+
return resource_metrics
|
255
|
+
|
256
|
+
@property
|
257
|
+
def additional_keys(self) -> list[str]:
|
258
|
+
return list(self.additional_properties.keys())
|
259
|
+
|
260
|
+
def __getitem__(self, key: str) -> Any:
|
261
|
+
return self.additional_properties[key]
|
262
|
+
|
263
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
264
|
+
self.additional_properties[key] = value
|
265
|
+
|
266
|
+
def __delitem__(self, key: str) -> None:
|
267
|
+
del self.additional_properties[key]
|
268
|
+
|
269
|
+
def __contains__(self, key: str) -> bool:
|
270
|
+
return key in self.additional_properties
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Any, TypeVar
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
T = TypeVar("T", bound="ResourceMetricsRequestTotalPerCode")
|
7
|
+
|
8
|
+
|
9
|
+
@_attrs_define
|
10
|
+
class ResourceMetricsRequestTotalPerCode:
|
11
|
+
"""Number of requests for the resource globally per code"""
|
12
|
+
|
13
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
14
|
+
|
15
|
+
def to_dict(self) -> dict[str, Any]:
|
16
|
+
field_dict: dict[str, Any] = {}
|
17
|
+
field_dict.update(self.additional_properties)
|
18
|
+
|
19
|
+
return field_dict
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
23
|
+
if not src_dict:
|
24
|
+
return None
|
25
|
+
d = src_dict.copy()
|
26
|
+
resource_metrics_request_total_per_code = cls()
|
27
|
+
|
28
|
+
resource_metrics_request_total_per_code.additional_properties = d
|
29
|
+
return resource_metrics_request_total_per_code
|
30
|
+
|
31
|
+
@property
|
32
|
+
def additional_keys(self) -> list[str]:
|
33
|
+
return list(self.additional_properties.keys())
|
34
|
+
|
35
|
+
def __getitem__(self, key: str) -> Any:
|
36
|
+
return self.additional_properties[key]
|
37
|
+
|
38
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
39
|
+
self.additional_properties[key] = value
|
40
|
+
|
41
|
+
def __delitem__(self, key: str) -> None:
|
42
|
+
del self.additional_properties[key]
|
43
|
+
|
44
|
+
def __contains__(self, key: str) -> bool:
|
45
|
+
return key in self.additional_properties
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Any, TypeVar
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
T = TypeVar("T", bound="ResourceMetricsRpsPerCode")
|
7
|
+
|
8
|
+
|
9
|
+
@_attrs_define
|
10
|
+
class ResourceMetricsRpsPerCode:
|
11
|
+
"""Number of requests per second for the resource globally per code"""
|
12
|
+
|
13
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
14
|
+
|
15
|
+
def to_dict(self) -> dict[str, Any]:
|
16
|
+
field_dict: dict[str, Any] = {}
|
17
|
+
field_dict.update(self.additional_properties)
|
18
|
+
|
19
|
+
return field_dict
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
23
|
+
if not src_dict:
|
24
|
+
return None
|
25
|
+
d = src_dict.copy()
|
26
|
+
resource_metrics_rps_per_code = cls()
|
27
|
+
|
28
|
+
resource_metrics_rps_per_code.additional_properties = d
|
29
|
+
return resource_metrics_rps_per_code
|
30
|
+
|
31
|
+
@property
|
32
|
+
def additional_keys(self) -> list[str]:
|
33
|
+
return list(self.additional_properties.keys())
|
34
|
+
|
35
|
+
def __getitem__(self, key: str) -> Any:
|
36
|
+
return self.additional_properties[key]
|
37
|
+
|
38
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
39
|
+
self.additional_properties[key] = value
|
40
|
+
|
41
|
+
def __delitem__(self, key: str) -> None:
|
42
|
+
del self.additional_properties[key]
|
43
|
+
|
44
|
+
def __contains__(self, key: str) -> bool:
|
45
|
+
return key in self.additional_properties
|
@@ -0,0 +1,97 @@
|
|
1
|
+
from typing import Any, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="RevisionConfiguration")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class RevisionConfiguration:
|
13
|
+
"""Revision configuration
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
active (Union[Unset, str]): Active revision id
|
17
|
+
canary (Union[Unset, str]): Canary revision id
|
18
|
+
canary_percent (Union[Unset, int]): Canary revision percent
|
19
|
+
previous_active (Union[Unset, str]): Previous active revision id
|
20
|
+
traffic (Union[Unset, int]): Traffic percentage
|
21
|
+
"""
|
22
|
+
|
23
|
+
active: Union[Unset, str] = UNSET
|
24
|
+
canary: Union[Unset, str] = UNSET
|
25
|
+
canary_percent: Union[Unset, int] = UNSET
|
26
|
+
previous_active: Union[Unset, str] = UNSET
|
27
|
+
traffic: Union[Unset, int] = UNSET
|
28
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
29
|
+
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
31
|
+
active = self.active
|
32
|
+
|
33
|
+
canary = self.canary
|
34
|
+
|
35
|
+
canary_percent = self.canary_percent
|
36
|
+
|
37
|
+
previous_active = self.previous_active
|
38
|
+
|
39
|
+
traffic = self.traffic
|
40
|
+
|
41
|
+
field_dict: dict[str, Any] = {}
|
42
|
+
field_dict.update(self.additional_properties)
|
43
|
+
field_dict.update({})
|
44
|
+
if active is not UNSET:
|
45
|
+
field_dict["active"] = active
|
46
|
+
if canary is not UNSET:
|
47
|
+
field_dict["canary"] = canary
|
48
|
+
if canary_percent is not UNSET:
|
49
|
+
field_dict["canaryPercent"] = canary_percent
|
50
|
+
if previous_active is not UNSET:
|
51
|
+
field_dict["previousActive"] = previous_active
|
52
|
+
if traffic is not UNSET:
|
53
|
+
field_dict["traffic"] = traffic
|
54
|
+
|
55
|
+
return field_dict
|
56
|
+
|
57
|
+
@classmethod
|
58
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
59
|
+
if not src_dict:
|
60
|
+
return None
|
61
|
+
d = src_dict.copy()
|
62
|
+
active = d.pop("active", UNSET)
|
63
|
+
|
64
|
+
canary = d.pop("canary", UNSET)
|
65
|
+
|
66
|
+
canary_percent = d.pop("canaryPercent", UNSET)
|
67
|
+
|
68
|
+
previous_active = d.pop("previousActive", UNSET)
|
69
|
+
|
70
|
+
traffic = d.pop("traffic", UNSET)
|
71
|
+
|
72
|
+
revision_configuration = cls(
|
73
|
+
active=active,
|
74
|
+
canary=canary,
|
75
|
+
canary_percent=canary_percent,
|
76
|
+
previous_active=previous_active,
|
77
|
+
traffic=traffic,
|
78
|
+
)
|
79
|
+
|
80
|
+
revision_configuration.additional_properties = d
|
81
|
+
return revision_configuration
|
82
|
+
|
83
|
+
@property
|
84
|
+
def additional_keys(self) -> list[str]:
|
85
|
+
return list(self.additional_properties.keys())
|
86
|
+
|
87
|
+
def __getitem__(self, key: str) -> Any:
|
88
|
+
return self.additional_properties[key]
|
89
|
+
|
90
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
91
|
+
self.additional_properties[key] = value
|
92
|
+
|
93
|
+
def __delitem__(self, key: str) -> None:
|
94
|
+
del self.additional_properties[key]
|
95
|
+
|
96
|
+
def __contains__(self, key: str) -> bool:
|
97
|
+
return key in self.additional_properties
|
@@ -0,0 +1,124 @@
|
|
1
|
+
from typing import Any, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="RevisionMetadata")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class RevisionMetadata:
|
13
|
+
"""Revision metadata
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
active (Union[Unset, bool]): Is the revision active
|
17
|
+
canary (Union[Unset, bool]): Is the revision canary
|
18
|
+
created_at (Union[Unset, str]): Revision created at
|
19
|
+
created_by (Union[Unset, str]): Revision created by
|
20
|
+
id (Union[Unset, str]): Revision ID
|
21
|
+
previous_active (Union[Unset, bool]): Is the revision previous active
|
22
|
+
status (Union[Unset, str]): Status of the revision
|
23
|
+
traffic_percent (Union[Unset, int]): Percent of traffic to the revision
|
24
|
+
"""
|
25
|
+
|
26
|
+
active: Union[Unset, bool] = UNSET
|
27
|
+
canary: Union[Unset, bool] = UNSET
|
28
|
+
created_at: Union[Unset, str] = UNSET
|
29
|
+
created_by: Union[Unset, str] = UNSET
|
30
|
+
id: Union[Unset, str] = UNSET
|
31
|
+
previous_active: Union[Unset, bool] = UNSET
|
32
|
+
status: Union[Unset, str] = UNSET
|
33
|
+
traffic_percent: Union[Unset, int] = UNSET
|
34
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
35
|
+
|
36
|
+
def to_dict(self) -> dict[str, Any]:
|
37
|
+
active = self.active
|
38
|
+
|
39
|
+
canary = self.canary
|
40
|
+
|
41
|
+
created_at = self.created_at
|
42
|
+
|
43
|
+
created_by = self.created_by
|
44
|
+
|
45
|
+
id = self.id
|
46
|
+
|
47
|
+
previous_active = self.previous_active
|
48
|
+
|
49
|
+
status = self.status
|
50
|
+
|
51
|
+
traffic_percent = self.traffic_percent
|
52
|
+
|
53
|
+
field_dict: dict[str, Any] = {}
|
54
|
+
field_dict.update(self.additional_properties)
|
55
|
+
field_dict.update({})
|
56
|
+
if active is not UNSET:
|
57
|
+
field_dict["active"] = active
|
58
|
+
if canary is not UNSET:
|
59
|
+
field_dict["canary"] = canary
|
60
|
+
if created_at is not UNSET:
|
61
|
+
field_dict["createdAt"] = created_at
|
62
|
+
if created_by is not UNSET:
|
63
|
+
field_dict["createdBy"] = created_by
|
64
|
+
if id is not UNSET:
|
65
|
+
field_dict["id"] = id
|
66
|
+
if previous_active is not UNSET:
|
67
|
+
field_dict["previousActive"] = previous_active
|
68
|
+
if status is not UNSET:
|
69
|
+
field_dict["status"] = status
|
70
|
+
if traffic_percent is not UNSET:
|
71
|
+
field_dict["trafficPercent"] = traffic_percent
|
72
|
+
|
73
|
+
return field_dict
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
77
|
+
if not src_dict:
|
78
|
+
return None
|
79
|
+
d = src_dict.copy()
|
80
|
+
active = d.pop("active", UNSET)
|
81
|
+
|
82
|
+
canary = d.pop("canary", UNSET)
|
83
|
+
|
84
|
+
created_at = d.pop("createdAt", UNSET)
|
85
|
+
|
86
|
+
created_by = d.pop("createdBy", UNSET)
|
87
|
+
|
88
|
+
id = d.pop("id", UNSET)
|
89
|
+
|
90
|
+
previous_active = d.pop("previousActive", UNSET)
|
91
|
+
|
92
|
+
status = d.pop("status", UNSET)
|
93
|
+
|
94
|
+
traffic_percent = d.pop("trafficPercent", UNSET)
|
95
|
+
|
96
|
+
revision_metadata = cls(
|
97
|
+
active=active,
|
98
|
+
canary=canary,
|
99
|
+
created_at=created_at,
|
100
|
+
created_by=created_by,
|
101
|
+
id=id,
|
102
|
+
previous_active=previous_active,
|
103
|
+
status=status,
|
104
|
+
traffic_percent=traffic_percent,
|
105
|
+
)
|
106
|
+
|
107
|
+
revision_metadata.additional_properties = d
|
108
|
+
return revision_metadata
|
109
|
+
|
110
|
+
@property
|
111
|
+
def additional_keys(self) -> list[str]:
|
112
|
+
return list(self.additional_properties.keys())
|
113
|
+
|
114
|
+
def __getitem__(self, key: str) -> Any:
|
115
|
+
return self.additional_properties[key]
|
116
|
+
|
117
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
118
|
+
self.additional_properties[key] = value
|
119
|
+
|
120
|
+
def __delitem__(self, key: str) -> None:
|
121
|
+
del self.additional_properties[key]
|
122
|
+
|
123
|
+
def __contains__(self, key: str) -> bool:
|
124
|
+
return key in self.additional_properties
|