beamlit 0.0.20rc3__py3-none-any.whl → 0.0.20rc5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. beamlit/api/agents/delete_agent_history.py +155 -0
  2. beamlit/api/agents/get_agent_deployment.py +1 -22
  3. beamlit/api/agents/get_agent_environment_logs.py +151 -0
  4. beamlit/api/agents/get_agent_history.py +155 -0
  5. beamlit/api/agents/list_agent_history.py +151 -0
  6. beamlit/api/agents/put_agent_history.py +181 -0
  7. beamlit/api/functions/get_function_environment_logs.py +151 -0
  8. beamlit/api/models/get_model_environment_logs.py +155 -0
  9. beamlit/authentication/__init__.py +4 -0
  10. beamlit/authentication/apikey.py +6 -0
  11. beamlit/authentication/authentication.py +31 -2
  12. beamlit/authentication/clientcredentials.py +20 -9
  13. beamlit/authentication/credentials.py +1 -0
  14. beamlit/authentication/device_mode.py +10 -1
  15. beamlit/common/generate.py +8 -3
  16. beamlit/common/logger.py +2 -0
  17. beamlit/common/settings.py +1 -5
  18. beamlit/models/__init__.py +28 -30
  19. beamlit/models/acl.py +2 -0
  20. beamlit/models/agent.py +2 -0
  21. beamlit/models/agent_chain.py +2 -0
  22. beamlit/models/agent_configuration.py +2 -0
  23. beamlit/models/agent_deployment.py +44 -99
  24. beamlit/models/agent_deployment_configuration.py +45 -0
  25. beamlit/models/agent_deployment_history.py +15 -46
  26. beamlit/models/agent_deployment_history_event.py +24 -78
  27. beamlit/models/agent_deployment_pod_template.py +45 -0
  28. beamlit/models/agent_history.py +165 -0
  29. beamlit/models/agent_history_event.py +131 -0
  30. beamlit/models/agent_metadata.py +144 -0
  31. beamlit/models/agent_release.py +2 -0
  32. beamlit/models/agent_spec.py +238 -0
  33. beamlit/models/agent_with_deployments.py +2 -0
  34. beamlit/models/api_key.py +2 -0
  35. beamlit/models/authentication_provider_model.py +2 -0
  36. beamlit/models/authentication_provider_organization.py +2 -0
  37. beamlit/models/configuration.py +2 -0
  38. beamlit/models/continent.py +2 -0
  39. beamlit/models/core_spec.py +179 -0
  40. beamlit/models/country.py +2 -0
  41. beamlit/models/create_api_key_for_service_account_body.py +2 -0
  42. beamlit/models/create_workspace_service_account_body.py +2 -0
  43. beamlit/models/create_workspace_service_account_response_200.py +2 -0
  44. beamlit/models/delete_workspace_service_account_response_200.py +2 -0
  45. beamlit/models/deployment_configuration.py +2 -0
  46. beamlit/models/deployment_configurations.py +2 -0
  47. beamlit/models/deployment_serverless_config.py +131 -0
  48. beamlit/models/environment.py +2 -0
  49. beamlit/models/environment_metrics.py +2 -0
  50. beamlit/models/environment_spec.py +61 -0
  51. beamlit/models/flavor.py +2 -0
  52. beamlit/models/function.py +2 -0
  53. beamlit/models/function_configuration.py +2 -0
  54. beamlit/models/function_deployment.py +44 -99
  55. beamlit/models/function_deployment_configuration.py +45 -0
  56. beamlit/models/function_deployment_pod_template.py +45 -0
  57. beamlit/models/function_kit.py +2 -0
  58. beamlit/models/function_metadata.py +144 -0
  59. beamlit/models/function_provider_ref.py +2 -0
  60. beamlit/models/function_release.py +2 -0
  61. beamlit/models/function_spec.py +240 -0
  62. beamlit/models/function_with_deployments.py +2 -0
  63. beamlit/models/get_workspace_service_accounts_response_200_item.py +2 -0
  64. beamlit/models/increase_and_rate_metric.py +2 -0
  65. beamlit/models/integration.py +2 -0
  66. beamlit/models/integration_config.py +2 -0
  67. beamlit/models/integration_connection.py +2 -0
  68. beamlit/models/integration_connection_config.py +2 -0
  69. beamlit/models/integration_connection_secret.py +2 -0
  70. beamlit/models/integration_connection_spec.py +99 -0
  71. beamlit/models/integration_model.py +2 -0
  72. beamlit/models/integration_secret.py +2 -0
  73. beamlit/models/invite_workspace_user_body.py +2 -0
  74. beamlit/models/labels_type_0.py +2 -0
  75. beamlit/models/location.py +2 -0
  76. beamlit/models/location_response.py +2 -0
  77. beamlit/models/metadata.py +135 -0
  78. beamlit/models/metadata_labels.py +43 -0
  79. beamlit/models/metric.py +2 -0
  80. beamlit/models/metrics.py +2 -0
  81. beamlit/models/model.py +2 -0
  82. beamlit/models/model_deployment.py +66 -85
  83. beamlit/models/model_deployment_log.py +2 -0
  84. beamlit/models/model_deployment_metrics.py +2 -0
  85. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +2 -0
  86. beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +2 -0
  87. beamlit/models/model_deployment_pod_template.py +45 -0
  88. beamlit/models/model_metadata.py +144 -0
  89. beamlit/models/model_metrics.py +2 -0
  90. beamlit/models/model_provider.py +2 -0
  91. beamlit/models/model_provider_ref.py +2 -0
  92. beamlit/models/model_release.py +2 -0
  93. beamlit/models/model_spec.py +188 -0
  94. beamlit/models/model_with_deployments.py +2 -0
  95. beamlit/models/owner_fields.py +68 -0
  96. beamlit/models/pending_invitation.py +2 -0
  97. beamlit/models/pending_invitation_accept.py +2 -0
  98. beamlit/models/pending_invitation_render.py +2 -0
  99. beamlit/models/pending_invitation_render_invited_by.py +2 -0
  100. beamlit/models/pending_invitation_render_workspace.py +2 -0
  101. beamlit/models/pending_invitation_workspace_details.py +2 -0
  102. beamlit/models/pod_template_spec.py +43 -0
  103. beamlit/models/policy.py +36 -8
  104. beamlit/models/policy_location.py +2 -0
  105. beamlit/models/policy_spec.py +119 -0
  106. beamlit/models/provider_config.py +2 -0
  107. beamlit/models/qps.py +2 -0
  108. beamlit/models/resource_deployment_log.py +2 -0
  109. beamlit/models/resource_deployment_metrics.py +70 -155
  110. beamlit/models/resource_deployment_metrics_inference_per_region.py +77 -0
  111. beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +77 -0
  112. beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +75 -0
  113. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +75 -0
  114. beamlit/models/resource_environment_metrics.py +172 -0
  115. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +75 -0
  116. beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +73 -0
  117. beamlit/models/resource_log.py +68 -0
  118. beamlit/models/resource_metrics.py +2 -0
  119. beamlit/models/runtime.py +14 -29
  120. beamlit/models/runtime_readiness_probe.py +45 -0
  121. beamlit/models/runtime_resources.py +2 -0
  122. beamlit/models/runtime_type_0.py +111 -0
  123. beamlit/models/runtime_type_0_readiness_probe.py +43 -0
  124. beamlit/models/runtime_type_0_readiness_probe_type_0.py +43 -0
  125. beamlit/models/runtime_type_0_resources.py +59 -0
  126. beamlit/models/serverless_config.py +2 -0
  127. beamlit/models/spec_configuration.py +68 -0
  128. beamlit/models/standard_fields_dynamo_db.py +2 -0
  129. beamlit/models/store_agent.py +15 -29
  130. beamlit/models/store_agent_configuration.py +2 -0
  131. beamlit/models/store_agent_labels.py +45 -0
  132. beamlit/models/store_configuration.py +6 -15
  133. beamlit/models/store_configuration_option.py +7 -18
  134. beamlit/models/store_function.py +15 -29
  135. beamlit/models/store_function_configuration.py +2 -0
  136. beamlit/models/store_function_kit.py +2 -0
  137. beamlit/models/store_function_labels.py +45 -0
  138. beamlit/models/store_function_parameter.py +2 -0
  139. beamlit/models/time_fields.py +68 -0
  140. beamlit/models/update_workspace_service_account_body.py +2 -0
  141. beamlit/models/update_workspace_service_account_response_200.py +2 -0
  142. beamlit/models/update_workspace_user_role_body.py +2 -0
  143. beamlit/models/websocket_channel.py +86 -0
  144. beamlit/models/workspace.py +2 -0
  145. beamlit/models/workspace_labels.py +2 -0
  146. beamlit/models/workspace_user.py +2 -0
  147. {beamlit-0.0.20rc3.dist-info → beamlit-0.0.20rc5.dist-info}/METADATA +1 -1
  148. {beamlit-0.0.20rc3.dist-info → beamlit-0.0.20rc5.dist-info}/RECORD +149 -102
  149. {beamlit-0.0.20rc3.dist-info → beamlit-0.0.20rc5.dist-info}/WHEEL +0 -0
@@ -0,0 +1,119 @@
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
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.flavor import Flavor
10
+ from ..models.policy_location import PolicyLocation
11
+
12
+
13
+ T = TypeVar("T", bound="PolicySpec")
14
+
15
+
16
+ @_attrs_define
17
+ class PolicySpec:
18
+ """Policy specification
19
+
20
+ Attributes:
21
+ flavors (Union[Unset, List['Flavor']]): Types of hardware available for deployments
22
+ locations (Union[Unset, List['PolicyLocation']]): PolicyLocations is a local type that wraps a slice of Location
23
+ resource_types (Union[Unset, List[str]]): PolicyResourceTypes is a local type that wraps a slice of
24
+ PolicyResourceType
25
+ type (Union[Unset, str]): Policy type, can be location or flavor
26
+ """
27
+
28
+ flavors: Union[Unset, List["Flavor"]] = UNSET
29
+ locations: Union[Unset, List["PolicyLocation"]] = UNSET
30
+ resource_types: Union[Unset, List[str]] = UNSET
31
+ type: Union[Unset, str] = UNSET
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ flavors: Union[Unset, List[Dict[str, Any]]] = UNSET
36
+ if not isinstance(self.flavors, Unset):
37
+ flavors = []
38
+ for componentsschemas_flavors_item_data in self.flavors:
39
+ componentsschemas_flavors_item = componentsschemas_flavors_item_data.to_dict()
40
+ flavors.append(componentsschemas_flavors_item)
41
+
42
+ locations: Union[Unset, List[Dict[str, Any]]] = UNSET
43
+ if not isinstance(self.locations, Unset):
44
+ locations = []
45
+ for componentsschemas_policy_locations_item_data in self.locations:
46
+ componentsschemas_policy_locations_item = componentsschemas_policy_locations_item_data.to_dict()
47
+ locations.append(componentsschemas_policy_locations_item)
48
+
49
+ resource_types: Union[Unset, List[str]] = UNSET
50
+ if not isinstance(self.resource_types, Unset):
51
+ resource_types = self.resource_types
52
+
53
+ type = self.type
54
+
55
+ field_dict: dict[str, Any] = {}
56
+ field_dict.update(self.additional_properties)
57
+ field_dict.update({})
58
+ if flavors is not UNSET:
59
+ field_dict["flavors"] = flavors
60
+ if locations is not UNSET:
61
+ field_dict["locations"] = locations
62
+ if resource_types is not UNSET:
63
+ field_dict["resourceTypes"] = resource_types
64
+ if type is not UNSET:
65
+ field_dict["type"] = type
66
+
67
+ return field_dict
68
+
69
+ @classmethod
70
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
71
+ from ..models.flavor import Flavor
72
+ from ..models.policy_location import PolicyLocation
73
+
74
+ d = src_dict.copy()
75
+ flavors = []
76
+ _flavors = d.pop("flavors", UNSET)
77
+ for componentsschemas_flavors_item_data in _flavors or []:
78
+ componentsschemas_flavors_item = Flavor.from_dict(componentsschemas_flavors_item_data)
79
+
80
+ flavors.append(componentsschemas_flavors_item)
81
+
82
+ locations = []
83
+ _locations = d.pop("locations", UNSET)
84
+ for componentsschemas_policy_locations_item_data in _locations or []:
85
+ componentsschemas_policy_locations_item = PolicyLocation.from_dict(
86
+ componentsschemas_policy_locations_item_data
87
+ )
88
+
89
+ locations.append(componentsschemas_policy_locations_item)
90
+
91
+ resource_types = cast(List[str], d.pop("resourceTypes", UNSET))
92
+
93
+ type = d.pop("type", UNSET)
94
+
95
+ policy_spec = cls(
96
+ flavors=flavors,
97
+ locations=locations,
98
+ resource_types=resource_types,
99
+ type=type,
100
+ )
101
+
102
+ policy_spec.additional_properties = d
103
+ return policy_spec
104
+
105
+ @property
106
+ def additional_keys(self) -> list[str]:
107
+ return list(self.additional_properties.keys())
108
+
109
+ def __getitem__(self, key: str) -> Any:
110
+ return self.additional_properties[key]
111
+
112
+ def __setitem__(self, key: str, value: Any) -> None:
113
+ self.additional_properties[key] = value
114
+
115
+ def __delitem__(self, key: str) -> None:
116
+ del self.additional_properties[key]
117
+
118
+ def __contains__(self, key: str) -> bool:
119
+ return key in self.additional_properties
@@ -54,6 +54,8 @@ class ProviderConfig:
54
54
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
55
55
  from ..models.runtime import Runtime
56
56
 
57
+ if not src_dict:
58
+ return None
57
59
  d = src_dict.copy()
58
60
  filename = d.pop("filename", UNSET)
59
61
 
beamlit/models/qps.py CHANGED
@@ -32,6 +32,8 @@ class QPS:
32
32
 
33
33
  @classmethod
34
34
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
35
+ if not src_dict:
36
+ return None
35
37
  d = src_dict.copy()
36
38
  region_code = d.pop("region_code", UNSET)
37
39
 
@@ -38,6 +38,8 @@ class ResourceDeploymentLog:
38
38
 
39
39
  @classmethod
40
40
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
41
+ if not src_dict:
42
+ return None
41
43
  d = src_dict.copy()
42
44
  message = d.pop("message", UNSET)
43
45
 
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -8,17 +8,15 @@ from ..types import UNSET, Unset
8
8
  if TYPE_CHECKING:
9
9
  from ..models.metric import Metric
10
10
  from ..models.qps import QPS
11
- from ..models.resource_deployment_metrics_inference_per_region_type_0 import (
12
- ResourceDeploymentMetricsInferencePerRegionType0,
11
+ from ..models.resource_deployment_metrics_inference_per_region import ResourceDeploymentMetricsInferencePerRegion
12
+ from ..models.resource_deployment_metrics_inference_per_second_per_region import (
13
+ ResourceDeploymentMetricsInferencePerSecondPerRegion,
13
14
  )
14
- from ..models.resource_deployment_metrics_inference_per_second_per_region_type_0 import (
15
- ResourceDeploymentMetricsInferencePerSecondPerRegionType0,
15
+ from ..models.resource_deployment_metrics_query_per_region_per_code import (
16
+ ResourceDeploymentMetricsQueryPerRegionPerCode,
16
17
  )
17
- from ..models.resource_deployment_metrics_query_per_region_per_code_type_0 import (
18
- ResourceDeploymentMetricsQueryPerRegionPerCodeType0,
19
- )
20
- from ..models.resource_deployment_metrics_query_per_second_per_region_per_code_type_0 import (
21
- ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0,
18
+ from ..models.resource_deployment_metrics_query_per_second_per_region_per_code import (
19
+ ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode,
22
20
  )
23
21
 
24
22
 
@@ -31,59 +29,44 @@ class ResourceDeploymentMetrics:
31
29
 
32
30
  Attributes:
33
31
  inference_global (Union[Unset, List['Metric']]): Array of metrics
34
- inference_per_region (Union['ResourceDeploymentMetricsInferencePerRegionType0', None, Unset]): Historical
35
- requests (in last 24 hours) per location, for the model deployment
32
+ inference_per_region (Union[Unset, ResourceDeploymentMetricsInferencePerRegion]): Historical requests (in last
33
+ 24 hours) per location, for the model deployment
36
34
  inference_per_second_global (Union[Unset, List['Metric']]): Array of metrics
37
- inference_per_second_per_region (Union['ResourceDeploymentMetricsInferencePerSecondPerRegionType0', None,
38
- Unset]): Historical requests per second (RPS) per location, for the model deployment
35
+ inference_per_second_per_region (Union[Unset, ResourceDeploymentMetricsInferencePerSecondPerRegion]): Historical
36
+ requests per second (RPS) per location, for the model deployment
39
37
  query_global (Union[Unset, float]): Number of requests done on the resource for the model deployment
40
38
  query_per_code_global (Union[Unset, QPS]): Query per second per element, can be per response status code (e.g.
41
39
  200, 400) or per location
42
40
  query_per_region (Union[Unset, QPS]): Query per second per element, can be per response status code (e.g. 200,
43
41
  400) or per location
44
- query_per_region_per_code (Union['ResourceDeploymentMetricsQueryPerRegionPerCodeType0', None, Unset]): Number of
45
- requests done on the resource for the model deployment
42
+ query_per_region_per_code (Union[Unset, ResourceDeploymentMetricsQueryPerRegionPerCode]): Number of requests
43
+ done on the resource for the model deployment
46
44
  query_per_second_global (Union[Unset, float]): RPS value (in last 24 hours) for the model deployment globally
47
45
  query_per_second_per_code_global (Union[Unset, QPS]): Query per second per element, can be per response status
48
46
  code (e.g. 200, 400) or per location
49
47
  query_per_second_per_region (Union[Unset, QPS]): Query per second per element, can be per response status code
50
48
  (e.g. 200, 400) or per location
51
- query_per_second_per_region_per_code (Union['ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0',
52
- None, Unset]): RPS value (in last 24 hours) per response status code per location, for the model deployment
49
+ query_per_second_per_region_per_code (Union[Unset, ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode]):
50
+ RPS value (in last 24 hours) per response status code per location, for the model deployment
53
51
  """
54
52
 
55
53
  inference_global: Union[Unset, List["Metric"]] = UNSET
56
- inference_per_region: Union["ResourceDeploymentMetricsInferencePerRegionType0", None, Unset] = UNSET
54
+ inference_per_region: Union[Unset, "ResourceDeploymentMetricsInferencePerRegion"] = UNSET
57
55
  inference_per_second_global: Union[Unset, List["Metric"]] = UNSET
58
- inference_per_second_per_region: Union["ResourceDeploymentMetricsInferencePerSecondPerRegionType0", None, Unset] = (
59
- UNSET
60
- )
56
+ inference_per_second_per_region: Union[Unset, "ResourceDeploymentMetricsInferencePerSecondPerRegion"] = UNSET
61
57
  query_global: Union[Unset, float] = UNSET
62
58
  query_per_code_global: Union[Unset, "QPS"] = UNSET
63
59
  query_per_region: Union[Unset, "QPS"] = UNSET
64
- query_per_region_per_code: Union["ResourceDeploymentMetricsQueryPerRegionPerCodeType0", None, Unset] = UNSET
60
+ query_per_region_per_code: Union[Unset, "ResourceDeploymentMetricsQueryPerRegionPerCode"] = UNSET
65
61
  query_per_second_global: Union[Unset, float] = UNSET
66
62
  query_per_second_per_code_global: Union[Unset, "QPS"] = UNSET
67
63
  query_per_second_per_region: Union[Unset, "QPS"] = UNSET
68
- query_per_second_per_region_per_code: Union[
69
- "ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0", None, Unset
70
- ] = UNSET
64
+ query_per_second_per_region_per_code: Union[Unset, "ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode"] = (
65
+ UNSET
66
+ )
71
67
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
72
68
 
73
69
  def to_dict(self) -> dict[str, Any]:
74
- from ..models.resource_deployment_metrics_inference_per_region_type_0 import (
75
- ResourceDeploymentMetricsInferencePerRegionType0,
76
- )
77
- from ..models.resource_deployment_metrics_inference_per_second_per_region_type_0 import (
78
- ResourceDeploymentMetricsInferencePerSecondPerRegionType0,
79
- )
80
- from ..models.resource_deployment_metrics_query_per_region_per_code_type_0 import (
81
- ResourceDeploymentMetricsQueryPerRegionPerCodeType0,
82
- )
83
- from ..models.resource_deployment_metrics_query_per_second_per_region_per_code_type_0 import (
84
- ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0,
85
- )
86
-
87
70
  inference_global: Union[Unset, List[Dict[str, Any]]] = UNSET
88
71
  if not isinstance(self.inference_global, Unset):
89
72
  inference_global = []
@@ -91,13 +74,9 @@ class ResourceDeploymentMetrics:
91
74
  componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
92
75
  inference_global.append(componentsschemas_array_metric_item)
93
76
 
94
- inference_per_region: Union[Dict[str, Any], None, Unset]
95
- if isinstance(self.inference_per_region, Unset):
96
- inference_per_region = UNSET
97
- elif isinstance(self.inference_per_region, ResourceDeploymentMetricsInferencePerRegionType0):
77
+ inference_per_region: Union[Unset, Dict[str, Any]] = UNSET
78
+ if not isinstance(self.inference_per_region, Unset):
98
79
  inference_per_region = self.inference_per_region.to_dict()
99
- else:
100
- inference_per_region = self.inference_per_region
101
80
 
102
81
  inference_per_second_global: Union[Unset, List[Dict[str, Any]]] = UNSET
103
82
  if not isinstance(self.inference_per_second_global, Unset):
@@ -106,15 +85,9 @@ class ResourceDeploymentMetrics:
106
85
  componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
107
86
  inference_per_second_global.append(componentsschemas_array_metric_item)
108
87
 
109
- inference_per_second_per_region: Union[Dict[str, Any], None, Unset]
110
- if isinstance(self.inference_per_second_per_region, Unset):
111
- inference_per_second_per_region = UNSET
112
- elif isinstance(
113
- self.inference_per_second_per_region, ResourceDeploymentMetricsInferencePerSecondPerRegionType0
114
- ):
88
+ inference_per_second_per_region: Union[Unset, Dict[str, Any]] = UNSET
89
+ if not isinstance(self.inference_per_second_per_region, Unset):
115
90
  inference_per_second_per_region = self.inference_per_second_per_region.to_dict()
116
- else:
117
- inference_per_second_per_region = self.inference_per_second_per_region
118
91
 
119
92
  query_global = self.query_global
120
93
 
@@ -126,13 +99,9 @@ class ResourceDeploymentMetrics:
126
99
  if not isinstance(self.query_per_region, Unset):
127
100
  query_per_region = self.query_per_region.to_dict()
128
101
 
129
- query_per_region_per_code: Union[Dict[str, Any], None, Unset]
130
- if isinstance(self.query_per_region_per_code, Unset):
131
- query_per_region_per_code = UNSET
132
- elif isinstance(self.query_per_region_per_code, ResourceDeploymentMetricsQueryPerRegionPerCodeType0):
102
+ query_per_region_per_code: Union[Unset, Dict[str, Any]] = UNSET
103
+ if not isinstance(self.query_per_region_per_code, Unset):
133
104
  query_per_region_per_code = self.query_per_region_per_code.to_dict()
134
- else:
135
- query_per_region_per_code = self.query_per_region_per_code
136
105
 
137
106
  query_per_second_global = self.query_per_second_global
138
107
 
@@ -144,15 +113,9 @@ class ResourceDeploymentMetrics:
144
113
  if not isinstance(self.query_per_second_per_region, Unset):
145
114
  query_per_second_per_region = self.query_per_second_per_region.to_dict()
146
115
 
147
- query_per_second_per_region_per_code: Union[Dict[str, Any], None, Unset]
148
- if isinstance(self.query_per_second_per_region_per_code, Unset):
149
- query_per_second_per_region_per_code = UNSET
150
- elif isinstance(
151
- self.query_per_second_per_region_per_code, ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0
152
- ):
116
+ query_per_second_per_region_per_code: Union[Unset, Dict[str, Any]] = UNSET
117
+ if not isinstance(self.query_per_second_per_region_per_code, Unset):
153
118
  query_per_second_per_region_per_code = self.query_per_second_per_region_per_code.to_dict()
154
- else:
155
- query_per_second_per_region_per_code = self.query_per_second_per_region_per_code
156
119
 
157
120
  field_dict: dict[str, Any] = {}
158
121
  field_dict.update(self.additional_properties)
@@ -188,19 +151,21 @@ class ResourceDeploymentMetrics:
188
151
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
189
152
  from ..models.metric import Metric
190
153
  from ..models.qps import QPS
191
- from ..models.resource_deployment_metrics_inference_per_region_type_0 import (
192
- ResourceDeploymentMetricsInferencePerRegionType0,
154
+ from ..models.resource_deployment_metrics_inference_per_region import (
155
+ ResourceDeploymentMetricsInferencePerRegion,
193
156
  )
194
- from ..models.resource_deployment_metrics_inference_per_second_per_region_type_0 import (
195
- ResourceDeploymentMetricsInferencePerSecondPerRegionType0,
157
+ from ..models.resource_deployment_metrics_inference_per_second_per_region import (
158
+ ResourceDeploymentMetricsInferencePerSecondPerRegion,
196
159
  )
197
- from ..models.resource_deployment_metrics_query_per_region_per_code_type_0 import (
198
- ResourceDeploymentMetricsQueryPerRegionPerCodeType0,
160
+ from ..models.resource_deployment_metrics_query_per_region_per_code import (
161
+ ResourceDeploymentMetricsQueryPerRegionPerCode,
199
162
  )
200
- from ..models.resource_deployment_metrics_query_per_second_per_region_per_code_type_0 import (
201
- ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0,
163
+ from ..models.resource_deployment_metrics_query_per_second_per_region_per_code import (
164
+ ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode,
202
165
  )
203
166
 
167
+ if not src_dict:
168
+ return None
204
169
  d = src_dict.copy()
205
170
  inference_global = []
206
171
  _inference_global = d.pop("inference_global", UNSET)
@@ -209,24 +174,12 @@ class ResourceDeploymentMetrics:
209
174
 
210
175
  inference_global.append(componentsschemas_array_metric_item)
211
176
 
212
- def _parse_inference_per_region(
213
- data: object,
214
- ) -> Union["ResourceDeploymentMetricsInferencePerRegionType0", None, Unset]:
215
- if data is None:
216
- return data
217
- if isinstance(data, Unset):
218
- return data
219
- try:
220
- if not isinstance(data, dict):
221
- raise TypeError()
222
- inference_per_region_type_0 = ResourceDeploymentMetricsInferencePerRegionType0.from_dict(data)
223
-
224
- return inference_per_region_type_0
225
- except: # noqa: E722
226
- pass
227
- return cast(Union["ResourceDeploymentMetricsInferencePerRegionType0", None, Unset], data)
228
-
229
- inference_per_region = _parse_inference_per_region(d.pop("inference_per_region", UNSET))
177
+ _inference_per_region = d.pop("inference_per_region", UNSET)
178
+ inference_per_region: Union[Unset, ResourceDeploymentMetricsInferencePerRegion]
179
+ if isinstance(_inference_per_region, Unset):
180
+ inference_per_region = UNSET
181
+ else:
182
+ inference_per_region = ResourceDeploymentMetricsInferencePerRegion.from_dict(_inference_per_region)
230
183
 
231
184
  inference_per_second_global = []
232
185
  _inference_per_second_global = d.pop("inference_per_second_global", UNSET)
@@ -235,28 +188,14 @@ class ResourceDeploymentMetrics:
235
188
 
236
189
  inference_per_second_global.append(componentsschemas_array_metric_item)
237
190
 
238
- def _parse_inference_per_second_per_region(
239
- data: object,
240
- ) -> Union["ResourceDeploymentMetricsInferencePerSecondPerRegionType0", None, Unset]:
241
- if data is None:
242
- return data
243
- if isinstance(data, Unset):
244
- return data
245
- try:
246
- if not isinstance(data, dict):
247
- raise TypeError()
248
- inference_per_second_per_region_type_0 = (
249
- ResourceDeploymentMetricsInferencePerSecondPerRegionType0.from_dict(data)
250
- )
251
-
252
- return inference_per_second_per_region_type_0
253
- except: # noqa: E722
254
- pass
255
- return cast(Union["ResourceDeploymentMetricsInferencePerSecondPerRegionType0", None, Unset], data)
256
-
257
- inference_per_second_per_region = _parse_inference_per_second_per_region(
258
- d.pop("inference_per_second_per_region", UNSET)
259
- )
191
+ _inference_per_second_per_region = d.pop("inference_per_second_per_region", UNSET)
192
+ inference_per_second_per_region: Union[Unset, ResourceDeploymentMetricsInferencePerSecondPerRegion]
193
+ if isinstance(_inference_per_second_per_region, Unset):
194
+ inference_per_second_per_region = UNSET
195
+ else:
196
+ inference_per_second_per_region = ResourceDeploymentMetricsInferencePerSecondPerRegion.from_dict(
197
+ _inference_per_second_per_region
198
+ )
260
199
 
261
200
  query_global = d.pop("query_global", UNSET)
262
201
 
@@ -274,24 +213,14 @@ class ResourceDeploymentMetrics:
274
213
  else:
275
214
  query_per_region = QPS.from_dict(_query_per_region)
276
215
 
277
- def _parse_query_per_region_per_code(
278
- data: object,
279
- ) -> Union["ResourceDeploymentMetricsQueryPerRegionPerCodeType0", None, Unset]:
280
- if data is None:
281
- return data
282
- if isinstance(data, Unset):
283
- return data
284
- try:
285
- if not isinstance(data, dict):
286
- raise TypeError()
287
- query_per_region_per_code_type_0 = ResourceDeploymentMetricsQueryPerRegionPerCodeType0.from_dict(data)
288
-
289
- return query_per_region_per_code_type_0
290
- except: # noqa: E722
291
- pass
292
- return cast(Union["ResourceDeploymentMetricsQueryPerRegionPerCodeType0", None, Unset], data)
293
-
294
- query_per_region_per_code = _parse_query_per_region_per_code(d.pop("query_per_region_per_code", UNSET))
216
+ _query_per_region_per_code = d.pop("query_per_region_per_code", UNSET)
217
+ query_per_region_per_code: Union[Unset, ResourceDeploymentMetricsQueryPerRegionPerCode]
218
+ if isinstance(_query_per_region_per_code, Unset):
219
+ query_per_region_per_code = UNSET
220
+ else:
221
+ query_per_region_per_code = ResourceDeploymentMetricsQueryPerRegionPerCode.from_dict(
222
+ _query_per_region_per_code
223
+ )
295
224
 
296
225
  query_per_second_global = d.pop("query_per_second_global", UNSET)
297
226
 
@@ -309,28 +238,14 @@ class ResourceDeploymentMetrics:
309
238
  else:
310
239
  query_per_second_per_region = QPS.from_dict(_query_per_second_per_region)
311
240
 
312
- def _parse_query_per_second_per_region_per_code(
313
- data: object,
314
- ) -> Union["ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0", None, Unset]:
315
- if data is None:
316
- return data
317
- if isinstance(data, Unset):
318
- return data
319
- try:
320
- if not isinstance(data, dict):
321
- raise TypeError()
322
- query_per_second_per_region_per_code_type_0 = (
323
- ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0.from_dict(data)
324
- )
325
-
326
- return query_per_second_per_region_per_code_type_0
327
- except: # noqa: E722
328
- pass
329
- return cast(Union["ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0", None, Unset], data)
330
-
331
- query_per_second_per_region_per_code = _parse_query_per_second_per_region_per_code(
332
- d.pop("query_per_second_per_region_per_code", UNSET)
333
- )
241
+ _query_per_second_per_region_per_code = d.pop("query_per_second_per_region_per_code", UNSET)
242
+ query_per_second_per_region_per_code: Union[Unset, ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode]
243
+ if isinstance(_query_per_second_per_region_per_code, Unset):
244
+ query_per_second_per_region_per_code = UNSET
245
+ else:
246
+ query_per_second_per_region_per_code = ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode.from_dict(
247
+ _query_per_second_per_region_per_code
248
+ )
334
249
 
335
250
  resource_deployment_metrics = cls(
336
251
  inference_global=inference_global,
@@ -0,0 +1,77 @@
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Type, 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.metric import Metric
10
+
11
+
12
+ T = TypeVar("T", bound="ResourceDeploymentMetricsInferencePerRegion")
13
+
14
+
15
+ @_attrs_define
16
+ class ResourceDeploymentMetricsInferencePerRegion:
17
+ """Historical requests (in last 24 hours) per location, for the model deployment
18
+
19
+ Attributes:
20
+ region (Union[Unset, List['Metric']]): Array of metrics
21
+ """
22
+
23
+ region: Union[Unset, List["Metric"]] = UNSET
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ region: Union[Unset, List[Dict[str, Any]]] = UNSET
28
+ if not isinstance(self.region, Unset):
29
+ region = []
30
+ for componentsschemas_array_metric_item_data in self.region:
31
+ componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
32
+ region.append(componentsschemas_array_metric_item)
33
+
34
+ field_dict: dict[str, Any] = {}
35
+ field_dict.update(self.additional_properties)
36
+ field_dict.update({})
37
+ if region is not UNSET:
38
+ field_dict["region"] = region
39
+
40
+ return field_dict
41
+
42
+ @classmethod
43
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
44
+ from ..models.metric import Metric
45
+
46
+ if not src_dict:
47
+ return None
48
+ d = src_dict.copy()
49
+ region = []
50
+ _region = d.pop("region", UNSET)
51
+ for componentsschemas_array_metric_item_data in _region or []:
52
+ componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
53
+
54
+ region.append(componentsschemas_array_metric_item)
55
+
56
+ resource_deployment_metrics_inference_per_region = cls(
57
+ region=region,
58
+ )
59
+
60
+ resource_deployment_metrics_inference_per_region.additional_properties = d
61
+ return resource_deployment_metrics_inference_per_region
62
+
63
+ @property
64
+ def additional_keys(self) -> list[str]:
65
+ return list(self.additional_properties.keys())
66
+
67
+ def __getitem__(self, key: str) -> Any:
68
+ return self.additional_properties[key]
69
+
70
+ def __setitem__(self, key: str, value: Any) -> None:
71
+ self.additional_properties[key] = value
72
+
73
+ def __delitem__(self, key: str) -> None:
74
+ del self.additional_properties[key]
75
+
76
+ def __contains__(self, key: str) -> bool:
77
+ return key in self.additional_properties
@@ -0,0 +1,77 @@
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Type, 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.metric import Metric
10
+
11
+
12
+ T = TypeVar("T", bound="ResourceDeploymentMetricsInferencePerSecondPerRegion")
13
+
14
+
15
+ @_attrs_define
16
+ class ResourceDeploymentMetricsInferencePerSecondPerRegion:
17
+ """Historical requests per second (RPS) per location, for the model deployment
18
+
19
+ Attributes:
20
+ region (Union[Unset, List['Metric']]): Array of metrics
21
+ """
22
+
23
+ region: Union[Unset, List["Metric"]] = UNSET
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ region: Union[Unset, List[Dict[str, Any]]] = UNSET
28
+ if not isinstance(self.region, Unset):
29
+ region = []
30
+ for componentsschemas_array_metric_item_data in self.region:
31
+ componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
32
+ region.append(componentsschemas_array_metric_item)
33
+
34
+ field_dict: dict[str, Any] = {}
35
+ field_dict.update(self.additional_properties)
36
+ field_dict.update({})
37
+ if region is not UNSET:
38
+ field_dict["region"] = region
39
+
40
+ return field_dict
41
+
42
+ @classmethod
43
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
44
+ from ..models.metric import Metric
45
+
46
+ if not src_dict:
47
+ return None
48
+ d = src_dict.copy()
49
+ region = []
50
+ _region = d.pop("region", UNSET)
51
+ for componentsschemas_array_metric_item_data in _region or []:
52
+ componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
53
+
54
+ region.append(componentsschemas_array_metric_item)
55
+
56
+ resource_deployment_metrics_inference_per_second_per_region = cls(
57
+ region=region,
58
+ )
59
+
60
+ resource_deployment_metrics_inference_per_second_per_region.additional_properties = d
61
+ return resource_deployment_metrics_inference_per_second_per_region
62
+
63
+ @property
64
+ def additional_keys(self) -> list[str]:
65
+ return list(self.additional_properties.keys())
66
+
67
+ def __getitem__(self, key: str) -> Any:
68
+ return self.additional_properties[key]
69
+
70
+ def __setitem__(self, key: str, value: Any) -> None:
71
+ self.additional_properties[key] = value
72
+
73
+ def __delitem__(self, key: str) -> None:
74
+ del self.additional_properties[key]
75
+
76
+ def __contains__(self, key: str) -> bool:
77
+ return key in self.additional_properties