beamlit 0.0.19__py3-none-any.whl → 0.0.20rc1__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.
Files changed (73) hide show
  1. beamlit/api/agents/create_agent.py +14 -9
  2. beamlit/api/agents/get_agent_deployment.py +22 -1
  3. beamlit/api/agents/update_agent.py +14 -9
  4. beamlit/api/functions/create_function.py +14 -9
  5. beamlit/api/functions/update_function.py +14 -9
  6. beamlit/api/{authentication_providers/list_organizations_for_authentication_provider.py → integrations/create_integration_connection.py} +45 -41
  7. beamlit/api/integrations/delete_integration_connection.py +158 -0
  8. beamlit/api/integrations/get_integration.py +97 -0
  9. beamlit/api/integrations/get_integration_connection.py +154 -0
  10. beamlit/api/integrations/get_integration_connection_model.py +97 -0
  11. beamlit/api/integrations/get_integration_model.py +97 -0
  12. beamlit/api/integrations/list_integration_connection_models.py +97 -0
  13. beamlit/api/{authentication_providers/list_models_for_authentication_provider.py → integrations/list_integration_connections.py} +24 -48
  14. beamlit/api/integrations/list_integration_models.py +97 -0
  15. beamlit/api/integrations/update_integration_connection.py +180 -0
  16. beamlit/authentication/__init__.py +2 -1
  17. beamlit/authentication/authentication.py +3 -0
  18. beamlit/authentication/clientcredentials.py +99 -0
  19. beamlit/authentication/credentials.py +7 -1
  20. beamlit/authentication/device_mode.py +0 -2
  21. beamlit/common/generate.py +166 -0
  22. beamlit/common/logger.py +30 -0
  23. beamlit/common/settings.py +112 -0
  24. beamlit/common/utils.py +13 -0
  25. beamlit/models/__init__.py +50 -24
  26. beamlit/models/agent_deployment.py +117 -49
  27. beamlit/models/{agent_deployment_configuration.py → agent_deployment_configuration_type_0.py} +5 -5
  28. beamlit/models/agent_deployment_history.py +46 -13
  29. beamlit/models/agent_deployment_history_event.py +78 -22
  30. beamlit/models/{function_deployment_pod_template.py → agent_deployment_pod_template_type_0.py} +5 -5
  31. beamlit/models/agent_with_deployments.py +174 -0
  32. beamlit/models/deployment_configurations.py +19 -6
  33. beamlit/models/deployment_serverless_config_type_0.py +218 -0
  34. beamlit/models/environment_metrics.py +19 -0
  35. beamlit/models/function_deployment.py +110 -42
  36. beamlit/models/{function_deployment_configuration.py → function_deployment_configuration_type_0.py} +5 -5
  37. beamlit/models/{agent_deployment_pod_template.py → function_deployment_pod_template_type_0.py} +5 -5
  38. beamlit/models/function_with_deployments.py +174 -0
  39. beamlit/models/increase_and_rate_metric.py +102 -0
  40. beamlit/models/integration.py +196 -0
  41. beamlit/models/integration_config.py +43 -0
  42. beamlit/models/integration_connection.py +196 -0
  43. beamlit/models/integration_connection_config.py +43 -0
  44. beamlit/models/integration_connection_secret.py +59 -0
  45. beamlit/models/integration_model.py +142 -0
  46. beamlit/models/integration_secret.py +59 -0
  47. beamlit/models/metrics.py +61 -20
  48. beamlit/models/model_deployment.py +96 -64
  49. beamlit/models/{model_deployment_pod_template.py → model_deployment_pod_template_type_0.py} +5 -5
  50. beamlit/models/policy.py +8 -34
  51. beamlit/models/provider_config.py +0 -9
  52. beamlit/models/resource_deployment_metrics.py +231 -36
  53. beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +75 -0
  54. beamlit/models/{resource_deployment_metrics_inference_per_second_per_region.py → resource_deployment_metrics_inference_per_second_per_region_type_0.py} +5 -5
  55. beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +73 -0
  56. beamlit/models/{resource_deployment_metrics_query_per_second_per_region_per_code.py → resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py} +5 -5
  57. beamlit/models/resource_metrics.py +36 -0
  58. beamlit/models/runtime.py +29 -12
  59. beamlit/models/{runtime_readiness_probe.py → runtime_readiness_probe_type_0.py} +5 -5
  60. beamlit/models/store_agent.py +29 -13
  61. beamlit/models/{store_agent_labels.py → store_agent_labels_type_0.py} +5 -5
  62. beamlit/models/store_configuration.py +15 -4
  63. beamlit/models/store_configuration_option.py +18 -5
  64. beamlit/models/store_function.py +29 -13
  65. beamlit/models/{store_function_labels.py → store_function_labels_type_0.py} +5 -5
  66. beamlit/run.py +49 -0
  67. {beamlit-0.0.19.dist-info → beamlit-0.0.20rc1.dist-info}/METADATA +5 -2
  68. {beamlit-0.0.19.dist-info → beamlit-0.0.20rc1.dist-info}/RECORD +70 -46
  69. beamlit/api/authentication_providers/get_model_with_repo_for_authentication_provider.py +0 -184
  70. beamlit/models/deployment_serverless_config.py +0 -129
  71. beamlit/models/labels.py +0 -43
  72. /beamlit/api/{authentication_providers → integrations}/__init__.py +0 -0
  73. {beamlit-0.0.19.dist-info → beamlit-0.0.20rc1.dist-info}/WHEEL +0 -0
@@ -6,10 +6,10 @@ from attrs import field as _attrs_field
6
6
  from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
- from ..models.deployment_serverless_config import DeploymentServerlessConfig
9
+ from ..models.deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
10
10
  from ..models.flavor import Flavor
11
- from ..models.function_deployment_configuration import FunctionDeploymentConfiguration
12
- from ..models.function_deployment_pod_template import FunctionDeploymentPodTemplate
11
+ from ..models.function_deployment_configuration_type_0 import FunctionDeploymentConfigurationType0
12
+ from ..models.function_deployment_pod_template_type_0 import FunctionDeploymentPodTemplateType0
13
13
  from ..models.function_kit import FunctionKit
14
14
  from ..models.labels_type_0 import LabelsType0
15
15
  from ..models.runtime import Runtime
@@ -28,22 +28,24 @@ class FunctionDeployment:
28
28
  created_by (Union[Unset, str]): The user or service account who created the resource
29
29
  updated_at (Union[Unset, str]): The date and time when the resource was updated
30
30
  updated_by (Union[Unset, str]): The user or service account who updated the resource
31
- configuration (Union[Unset, FunctionDeploymentConfiguration]): Function configuration, this is a key value
32
- storage. In your function you can retrieve the value with config[key]
31
+ configuration (Union['FunctionDeploymentConfigurationType0', None, Unset]): Function configuration, this is a
32
+ key value storage. In your function you can retrieve the value with config[key]
33
33
  description (Union[Unset, str]): Function description, very important for the agent function to work with an LLM
34
- enabled (Union[Unset, bool]): Whether the function deployment is enabled
34
+ enabled (Union[None, Unset, bool]): Whether the function deployment is enabled
35
35
  environment (Union[Unset, str]): The name of the environment
36
36
  flavors (Union[Unset, List['Flavor']]): Types of hardware available for deployments
37
37
  function (Union[Unset, str]): The name of the function
38
+ integration_connections (Union[Unset, List[str]]):
38
39
  kit (Union[Unset, List['FunctionKit']]): The kit of the function deployment
39
40
  labels (Union['LabelsType0', None, Unset]): Labels
40
41
  parameters (Union[Unset, List['StoreFunctionParameter']]): Function parameters, for your function to be callable
41
42
  with Agent
42
- pod_template (Union[Unset, FunctionDeploymentPodTemplate]): The pod template, should be a valid Kubernetes pod
43
- template
43
+ pod_template (Union['FunctionDeploymentPodTemplateType0', None, Unset]): The pod template, should be a valid
44
+ Kubernetes pod template
44
45
  policies (Union[Unset, List[str]]):
45
46
  runtime (Union[Unset, Runtime]): Set of configurations for a deployment
46
- serverless_config (Union[Unset, DeploymentServerlessConfig]): Configuration for a serverless deployment
47
+ serverless_config (Union['DeploymentServerlessConfigType0', None, Unset]): Configuration for a serverless
48
+ deployment
47
49
  store_id (Union[Unset, str]): Create from a store registered function
48
50
  workspace (Union[Unset, str]): The workspace the function deployment belongs to
49
51
  """
@@ -52,24 +54,28 @@ class FunctionDeployment:
52
54
  created_by: Union[Unset, str] = UNSET
53
55
  updated_at: Union[Unset, str] = UNSET
54
56
  updated_by: Union[Unset, str] = UNSET
55
- configuration: Union[Unset, "FunctionDeploymentConfiguration"] = UNSET
57
+ configuration: Union["FunctionDeploymentConfigurationType0", None, Unset] = UNSET
56
58
  description: Union[Unset, str] = UNSET
57
- enabled: Union[Unset, bool] = UNSET
59
+ enabled: Union[None, Unset, bool] = UNSET
58
60
  environment: Union[Unset, str] = UNSET
59
61
  flavors: Union[Unset, List["Flavor"]] = UNSET
60
62
  function: Union[Unset, str] = UNSET
63
+ integration_connections: Union[Unset, List[str]] = UNSET
61
64
  kit: Union[Unset, List["FunctionKit"]] = UNSET
62
65
  labels: Union["LabelsType0", None, Unset] = UNSET
63
66
  parameters: Union[Unset, List["StoreFunctionParameter"]] = UNSET
64
- pod_template: Union[Unset, "FunctionDeploymentPodTemplate"] = UNSET
67
+ pod_template: Union["FunctionDeploymentPodTemplateType0", None, Unset] = UNSET
65
68
  policies: Union[Unset, List[str]] = UNSET
66
69
  runtime: Union[Unset, "Runtime"] = UNSET
67
- serverless_config: Union[Unset, "DeploymentServerlessConfig"] = UNSET
70
+ serverless_config: Union["DeploymentServerlessConfigType0", None, Unset] = UNSET
68
71
  store_id: Union[Unset, str] = UNSET
69
72
  workspace: Union[Unset, str] = UNSET
70
73
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
71
74
 
72
75
  def to_dict(self) -> dict[str, Any]:
76
+ from ..models.deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
77
+ from ..models.function_deployment_configuration_type_0 import FunctionDeploymentConfigurationType0
78
+ from ..models.function_deployment_pod_template_type_0 import FunctionDeploymentPodTemplateType0
73
79
  from ..models.labels_type_0 import LabelsType0
74
80
 
75
81
  created_at = self.created_at
@@ -80,13 +86,21 @@ class FunctionDeployment:
80
86
 
81
87
  updated_by = self.updated_by
82
88
 
83
- configuration: Union[Unset, Dict[str, Any]] = UNSET
84
- if not isinstance(self.configuration, Unset):
89
+ configuration: Union[Dict[str, Any], None, Unset]
90
+ if isinstance(self.configuration, Unset):
91
+ configuration = UNSET
92
+ elif isinstance(self.configuration, FunctionDeploymentConfigurationType0):
85
93
  configuration = self.configuration.to_dict()
94
+ else:
95
+ configuration = self.configuration
86
96
 
87
97
  description = self.description
88
98
 
89
- enabled = self.enabled
99
+ enabled: Union[None, Unset, bool]
100
+ if isinstance(self.enabled, Unset):
101
+ enabled = UNSET
102
+ else:
103
+ enabled = self.enabled
90
104
 
91
105
  environment = self.environment
92
106
 
@@ -99,6 +113,10 @@ class FunctionDeployment:
99
113
 
100
114
  function = self.function
101
115
 
116
+ integration_connections: Union[Unset, List[str]] = UNSET
117
+ if not isinstance(self.integration_connections, Unset):
118
+ integration_connections = self.integration_connections
119
+
102
120
  kit: Union[Unset, List[Dict[str, Any]]] = UNSET
103
121
  if not isinstance(self.kit, Unset):
104
122
  kit = []
@@ -121,9 +139,13 @@ class FunctionDeployment:
121
139
  parameters_item = parameters_item_data.to_dict()
122
140
  parameters.append(parameters_item)
123
141
 
124
- pod_template: Union[Unset, Dict[str, Any]] = UNSET
125
- if not isinstance(self.pod_template, Unset):
142
+ pod_template: Union[Dict[str, Any], None, Unset]
143
+ if isinstance(self.pod_template, Unset):
144
+ pod_template = UNSET
145
+ elif isinstance(self.pod_template, FunctionDeploymentPodTemplateType0):
126
146
  pod_template = self.pod_template.to_dict()
147
+ else:
148
+ pod_template = self.pod_template
127
149
 
128
150
  policies: Union[Unset, List[str]] = UNSET
129
151
  if not isinstance(self.policies, Unset):
@@ -133,9 +155,13 @@ class FunctionDeployment:
133
155
  if not isinstance(self.runtime, Unset):
134
156
  runtime = self.runtime.to_dict()
135
157
 
136
- serverless_config: Union[Unset, Dict[str, Any]] = UNSET
137
- if not isinstance(self.serverless_config, Unset):
158
+ serverless_config: Union[Dict[str, Any], None, Unset]
159
+ if isinstance(self.serverless_config, Unset):
160
+ serverless_config = UNSET
161
+ elif isinstance(self.serverless_config, DeploymentServerlessConfigType0):
138
162
  serverless_config = self.serverless_config.to_dict()
163
+ else:
164
+ serverless_config = self.serverless_config
139
165
 
140
166
  store_id = self.store_id
141
167
 
@@ -164,6 +190,8 @@ class FunctionDeployment:
164
190
  field_dict["flavors"] = flavors
165
191
  if function is not UNSET:
166
192
  field_dict["function"] = function
193
+ if integration_connections is not UNSET:
194
+ field_dict["integration_connections"] = integration_connections
167
195
  if kit is not UNSET:
168
196
  field_dict["kit"] = kit
169
197
  if labels is not UNSET:
@@ -187,10 +215,10 @@ class FunctionDeployment:
187
215
 
188
216
  @classmethod
189
217
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
190
- from ..models.deployment_serverless_config import DeploymentServerlessConfig
218
+ from ..models.deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
191
219
  from ..models.flavor import Flavor
192
- from ..models.function_deployment_configuration import FunctionDeploymentConfiguration
193
- from ..models.function_deployment_pod_template import FunctionDeploymentPodTemplate
220
+ from ..models.function_deployment_configuration_type_0 import FunctionDeploymentConfigurationType0
221
+ from ..models.function_deployment_pod_template_type_0 import FunctionDeploymentPodTemplateType0
194
222
  from ..models.function_kit import FunctionKit
195
223
  from ..models.labels_type_0 import LabelsType0
196
224
  from ..models.runtime import Runtime
@@ -205,16 +233,33 @@ class FunctionDeployment:
205
233
 
206
234
  updated_by = d.pop("updated_by", UNSET)
207
235
 
208
- _configuration = d.pop("configuration", UNSET)
209
- configuration: Union[Unset, FunctionDeploymentConfiguration]
210
- if isinstance(_configuration, Unset):
211
- configuration = UNSET
212
- else:
213
- configuration = FunctionDeploymentConfiguration.from_dict(_configuration)
236
+ def _parse_configuration(data: object) -> Union["FunctionDeploymentConfigurationType0", None, Unset]:
237
+ if data is None:
238
+ return data
239
+ if isinstance(data, Unset):
240
+ return data
241
+ try:
242
+ if not isinstance(data, dict):
243
+ raise TypeError()
244
+ configuration_type_0 = FunctionDeploymentConfigurationType0.from_dict(data)
245
+
246
+ return configuration_type_0
247
+ except: # noqa: E722
248
+ pass
249
+ return cast(Union["FunctionDeploymentConfigurationType0", None, Unset], data)
250
+
251
+ configuration = _parse_configuration(d.pop("configuration", UNSET))
214
252
 
215
253
  description = d.pop("description", UNSET)
216
254
 
217
- enabled = d.pop("enabled", UNSET)
255
+ def _parse_enabled(data: object) -> Union[None, Unset, bool]:
256
+ if data is None:
257
+ return data
258
+ if isinstance(data, Unset):
259
+ return data
260
+ return cast(Union[None, Unset, bool], data)
261
+
262
+ enabled = _parse_enabled(d.pop("enabled", UNSET))
218
263
 
219
264
  environment = d.pop("environment", UNSET)
220
265
 
@@ -227,6 +272,8 @@ class FunctionDeployment:
227
272
 
228
273
  function = d.pop("function", UNSET)
229
274
 
275
+ integration_connections = cast(List[str], d.pop("integration_connections", UNSET))
276
+
230
277
  kit = []
231
278
  _kit = d.pop("kit", UNSET)
232
279
  for kit_item_data in _kit or []:
@@ -258,12 +305,22 @@ class FunctionDeployment:
258
305
 
259
306
  parameters.append(parameters_item)
260
307
 
261
- _pod_template = d.pop("pod_template", UNSET)
262
- pod_template: Union[Unset, FunctionDeploymentPodTemplate]
263
- if isinstance(_pod_template, Unset):
264
- pod_template = UNSET
265
- else:
266
- pod_template = FunctionDeploymentPodTemplate.from_dict(_pod_template)
308
+ def _parse_pod_template(data: object) -> Union["FunctionDeploymentPodTemplateType0", None, Unset]:
309
+ if data is None:
310
+ return data
311
+ if isinstance(data, Unset):
312
+ return data
313
+ try:
314
+ if not isinstance(data, dict):
315
+ raise TypeError()
316
+ pod_template_type_0 = FunctionDeploymentPodTemplateType0.from_dict(data)
317
+
318
+ return pod_template_type_0
319
+ except: # noqa: E722
320
+ pass
321
+ return cast(Union["FunctionDeploymentPodTemplateType0", None, Unset], data)
322
+
323
+ pod_template = _parse_pod_template(d.pop("pod_template", UNSET))
267
324
 
268
325
  policies = cast(List[str], d.pop("policies", UNSET))
269
326
 
@@ -274,12 +331,22 @@ class FunctionDeployment:
274
331
  else:
275
332
  runtime = Runtime.from_dict(_runtime)
276
333
 
277
- _serverless_config = d.pop("serverless_config", UNSET)
278
- serverless_config: Union[Unset, DeploymentServerlessConfig]
279
- if isinstance(_serverless_config, Unset):
280
- serverless_config = UNSET
281
- else:
282
- serverless_config = DeploymentServerlessConfig.from_dict(_serverless_config)
334
+ def _parse_serverless_config(data: object) -> Union["DeploymentServerlessConfigType0", None, Unset]:
335
+ if data is None:
336
+ return data
337
+ if isinstance(data, Unset):
338
+ return data
339
+ try:
340
+ if not isinstance(data, dict):
341
+ raise TypeError()
342
+ componentsschemas_deployment_serverless_config_type_0 = DeploymentServerlessConfigType0.from_dict(data)
343
+
344
+ return componentsschemas_deployment_serverless_config_type_0
345
+ except: # noqa: E722
346
+ pass
347
+ return cast(Union["DeploymentServerlessConfigType0", None, Unset], data)
348
+
349
+ serverless_config = _parse_serverless_config(d.pop("serverless_config", UNSET))
283
350
 
284
351
  store_id = d.pop("store_id", UNSET)
285
352
 
@@ -296,6 +363,7 @@ class FunctionDeployment:
296
363
  environment=environment,
297
364
  flavors=flavors,
298
365
  function=function,
366
+ integration_connections=integration_connections,
299
367
  kit=kit,
300
368
  labels=labels,
301
369
  parameters=parameters,
@@ -3,11 +3,11 @@ from typing import Any, Type, TypeVar
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
- T = TypeVar("T", bound="FunctionDeploymentConfiguration")
6
+ T = TypeVar("T", bound="FunctionDeploymentConfigurationType0")
7
7
 
8
8
 
9
9
  @_attrs_define
10
- class FunctionDeploymentConfiguration:
10
+ class FunctionDeploymentConfigurationType0:
11
11
  """Function configuration, this is a key value storage. In your function you can retrieve the value with config[key]"""
12
12
 
13
13
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
@@ -21,10 +21,10 @@ class FunctionDeploymentConfiguration:
21
21
  @classmethod
22
22
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
23
23
  d = src_dict.copy()
24
- function_deployment_configuration = cls()
24
+ function_deployment_configuration_type_0 = cls()
25
25
 
26
- function_deployment_configuration.additional_properties = d
27
- return function_deployment_configuration
26
+ function_deployment_configuration_type_0.additional_properties = d
27
+ return function_deployment_configuration_type_0
28
28
 
29
29
  @property
30
30
  def additional_keys(self) -> list[str]:
@@ -3,11 +3,11 @@ from typing import Any, Type, TypeVar
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
- T = TypeVar("T", bound="AgentDeploymentPodTemplate")
6
+ T = TypeVar("T", bound="FunctionDeploymentPodTemplateType0")
7
7
 
8
8
 
9
9
  @_attrs_define
10
- class AgentDeploymentPodTemplate:
10
+ class FunctionDeploymentPodTemplateType0:
11
11
  """The pod template, should be a valid Kubernetes pod template"""
12
12
 
13
13
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
@@ -21,10 +21,10 @@ class AgentDeploymentPodTemplate:
21
21
  @classmethod
22
22
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
23
23
  d = src_dict.copy()
24
- agent_deployment_pod_template = cls()
24
+ function_deployment_pod_template_type_0 = cls()
25
25
 
26
- agent_deployment_pod_template.additional_properties = d
27
- return agent_deployment_pod_template
26
+ function_deployment_pod_template_type_0.additional_properties = d
27
+ return function_deployment_pod_template_type_0
28
28
 
29
29
  @property
30
30
  def additional_keys(self) -> list[str]:
@@ -0,0 +1,174 @@
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.function_deployment import FunctionDeployment
10
+ from ..models.labels_type_0 import LabelsType0
11
+
12
+
13
+ T = TypeVar("T", bound="FunctionWithDeployments")
14
+
15
+
16
+ @_attrs_define
17
+ class FunctionWithDeployments:
18
+ """Logical object representing a function but with deployment definition inside
19
+
20
+ Attributes:
21
+ created_at (Union[Unset, str]): The date and time when the resource was created
22
+ created_by (Union[Unset, str]): The user or service account who created the resource
23
+ updated_at (Union[Unset, str]): The date and time when the resource was updated
24
+ updated_by (Union[Unset, str]): The user or service account who updated the resource
25
+ display_name (Union[Unset, str]): Function display name
26
+ labels (Union['LabelsType0', None, Unset]): Labels
27
+ name (Union[Unset, str]): Function name
28
+ workspace (Union[Unset, str]): Workspace name
29
+ deployments (Union[Unset, List['FunctionDeployment']]):
30
+ """
31
+
32
+ created_at: Union[Unset, str] = UNSET
33
+ created_by: Union[Unset, str] = UNSET
34
+ updated_at: Union[Unset, str] = UNSET
35
+ updated_by: Union[Unset, str] = UNSET
36
+ display_name: Union[Unset, str] = UNSET
37
+ labels: Union["LabelsType0", None, Unset] = UNSET
38
+ name: Union[Unset, str] = UNSET
39
+ workspace: Union[Unset, str] = UNSET
40
+ deployments: Union[Unset, List["FunctionDeployment"]] = UNSET
41
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
42
+
43
+ def to_dict(self) -> dict[str, Any]:
44
+ from ..models.labels_type_0 import LabelsType0
45
+
46
+ created_at = self.created_at
47
+
48
+ created_by = self.created_by
49
+
50
+ updated_at = self.updated_at
51
+
52
+ updated_by = self.updated_by
53
+
54
+ display_name = self.display_name
55
+
56
+ labels: Union[Dict[str, Any], None, Unset]
57
+ if isinstance(self.labels, Unset):
58
+ labels = UNSET
59
+ elif isinstance(self.labels, LabelsType0):
60
+ labels = self.labels.to_dict()
61
+ else:
62
+ labels = self.labels
63
+
64
+ name = self.name
65
+
66
+ workspace = self.workspace
67
+
68
+ deployments: Union[Unset, List[Dict[str, Any]]] = UNSET
69
+ if not isinstance(self.deployments, Unset):
70
+ deployments = []
71
+ for componentsschemas_function_deployments_item_data in self.deployments:
72
+ componentsschemas_function_deployments_item = componentsschemas_function_deployments_item_data.to_dict()
73
+ deployments.append(componentsschemas_function_deployments_item)
74
+
75
+ field_dict: dict[str, Any] = {}
76
+ field_dict.update(self.additional_properties)
77
+ field_dict.update({})
78
+ if created_at is not UNSET:
79
+ field_dict["created_at"] = created_at
80
+ if created_by is not UNSET:
81
+ field_dict["created_by"] = created_by
82
+ if updated_at is not UNSET:
83
+ field_dict["updated_at"] = updated_at
84
+ if updated_by is not UNSET:
85
+ field_dict["updated_by"] = updated_by
86
+ if display_name is not UNSET:
87
+ field_dict["display_name"] = display_name
88
+ if labels is not UNSET:
89
+ field_dict["labels"] = labels
90
+ if name is not UNSET:
91
+ field_dict["name"] = name
92
+ if workspace is not UNSET:
93
+ field_dict["workspace"] = workspace
94
+ if deployments is not UNSET:
95
+ field_dict["deployments"] = deployments
96
+
97
+ return field_dict
98
+
99
+ @classmethod
100
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
101
+ from ..models.function_deployment import FunctionDeployment
102
+ from ..models.labels_type_0 import LabelsType0
103
+
104
+ d = src_dict.copy()
105
+ created_at = d.pop("created_at", UNSET)
106
+
107
+ created_by = d.pop("created_by", UNSET)
108
+
109
+ updated_at = d.pop("updated_at", UNSET)
110
+
111
+ updated_by = d.pop("updated_by", UNSET)
112
+
113
+ display_name = d.pop("display_name", UNSET)
114
+
115
+ def _parse_labels(data: object) -> Union["LabelsType0", None, Unset]:
116
+ if data is None:
117
+ return data
118
+ if isinstance(data, Unset):
119
+ return data
120
+ try:
121
+ if not isinstance(data, dict):
122
+ raise TypeError()
123
+ componentsschemas_labels_type_0 = LabelsType0.from_dict(data)
124
+
125
+ return componentsschemas_labels_type_0
126
+ except: # noqa: E722
127
+ pass
128
+ return cast(Union["LabelsType0", None, Unset], data)
129
+
130
+ labels = _parse_labels(d.pop("labels", UNSET))
131
+
132
+ name = d.pop("name", UNSET)
133
+
134
+ workspace = d.pop("workspace", UNSET)
135
+
136
+ deployments = []
137
+ _deployments = d.pop("deployments", UNSET)
138
+ for componentsschemas_function_deployments_item_data in _deployments or []:
139
+ componentsschemas_function_deployments_item = FunctionDeployment.from_dict(
140
+ componentsschemas_function_deployments_item_data
141
+ )
142
+
143
+ deployments.append(componentsschemas_function_deployments_item)
144
+
145
+ function_with_deployments = cls(
146
+ created_at=created_at,
147
+ created_by=created_by,
148
+ updated_at=updated_at,
149
+ updated_by=updated_by,
150
+ display_name=display_name,
151
+ labels=labels,
152
+ name=name,
153
+ workspace=workspace,
154
+ deployments=deployments,
155
+ )
156
+
157
+ function_with_deployments.additional_properties = d
158
+ return function_with_deployments
159
+
160
+ @property
161
+ def additional_keys(self) -> list[str]:
162
+ return list(self.additional_properties.keys())
163
+
164
+ def __getitem__(self, key: str) -> Any:
165
+ return self.additional_properties[key]
166
+
167
+ def __setitem__(self, key: str, value: Any) -> None:
168
+ self.additional_properties[key] = value
169
+
170
+ def __delitem__(self, key: str) -> None:
171
+ del self.additional_properties[key]
172
+
173
+ def __contains__(self, key: str) -> bool:
174
+ return key in self.additional_properties
@@ -0,0 +1,102 @@
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="IncreaseAndRateMetric")
13
+
14
+
15
+ @_attrs_define
16
+ class IncreaseAndRateMetric:
17
+ """Metrics for resources
18
+
19
+ Attributes:
20
+ inference_global (Union[Unset, Any]): Historical requests for all resources globally
21
+ inference_per_second_global (Union[Unset, List['Metric']]): Array of metrics
22
+ query (Union[Unset, Any]): Number of requests for all resources globally
23
+ query_per_second (Union[Unset, float]): RPS value (in last 24 hours) per location, for all resources globally
24
+ """
25
+
26
+ inference_global: Union[Unset, Any] = UNSET
27
+ inference_per_second_global: Union[Unset, List["Metric"]] = UNSET
28
+ query: Union[Unset, Any] = UNSET
29
+ query_per_second: Union[Unset, float] = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ inference_global = self.inference_global
34
+
35
+ inference_per_second_global: Union[Unset, List[Dict[str, Any]]] = UNSET
36
+ if not isinstance(self.inference_per_second_global, Unset):
37
+ inference_per_second_global = []
38
+ for componentsschemas_array_metric_item_data in self.inference_per_second_global:
39
+ componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
40
+ inference_per_second_global.append(componentsschemas_array_metric_item)
41
+
42
+ query = self.query
43
+
44
+ query_per_second = self.query_per_second
45
+
46
+ field_dict: dict[str, Any] = {}
47
+ field_dict.update(self.additional_properties)
48
+ field_dict.update({})
49
+ if inference_global is not UNSET:
50
+ field_dict["inference_global"] = inference_global
51
+ if inference_per_second_global is not UNSET:
52
+ field_dict["inference_per_second_global"] = inference_per_second_global
53
+ if query is not UNSET:
54
+ field_dict["query"] = query
55
+ if query_per_second is not UNSET:
56
+ field_dict["query_per_second"] = query_per_second
57
+
58
+ return field_dict
59
+
60
+ @classmethod
61
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
62
+ from ..models.metric import Metric
63
+
64
+ d = src_dict.copy()
65
+ inference_global = d.pop("inference_global", UNSET)
66
+
67
+ inference_per_second_global = []
68
+ _inference_per_second_global = d.pop("inference_per_second_global", UNSET)
69
+ for componentsschemas_array_metric_item_data in _inference_per_second_global or []:
70
+ componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
71
+
72
+ inference_per_second_global.append(componentsschemas_array_metric_item)
73
+
74
+ query = d.pop("query", UNSET)
75
+
76
+ query_per_second = d.pop("query_per_second", UNSET)
77
+
78
+ increase_and_rate_metric = cls(
79
+ inference_global=inference_global,
80
+ inference_per_second_global=inference_per_second_global,
81
+ query=query,
82
+ query_per_second=query_per_second,
83
+ )
84
+
85
+ increase_and_rate_metric.additional_properties = d
86
+ return increase_and_rate_metric
87
+
88
+ @property
89
+ def additional_keys(self) -> list[str]:
90
+ return list(self.additional_properties.keys())
91
+
92
+ def __getitem__(self, key: str) -> Any:
93
+ return self.additional_properties[key]
94
+
95
+ def __setitem__(self, key: str, value: Any) -> None:
96
+ self.additional_properties[key] = value
97
+
98
+ def __delitem__(self, key: str) -> None:
99
+ del self.additional_properties[key]
100
+
101
+ def __contains__(self, key: str) -> bool:
102
+ return key in self.additional_properties