beamlit 0.0.19__py3-none-any.whl → 0.0.20__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. beamlit/agents/__init__.py +4 -0
  2. beamlit/agents/chat.py +87 -0
  3. beamlit/agents/decorator.py +147 -0
  4. beamlit/api/agents/create_agent.py +14 -9
  5. beamlit/api/agents/delete_agent_history.py +159 -0
  6. beamlit/api/agents/get_agent_deployment_logs.py +11 -11
  7. beamlit/api/{authentication_providers/list_organizations_for_authentication_provider.py → agents/get_agent_environment_logs.py} +30 -42
  8. beamlit/api/{authentication_providers/get_model_with_repo_for_authentication_provider.py → agents/get_agent_history.py} +43 -68
  9. beamlit/api/agents/list_agent_deployment_history.py +11 -11
  10. beamlit/api/agents/list_agent_deployments.py +11 -11
  11. beamlit/api/agents/list_agent_history.py +151 -0
  12. beamlit/api/agents/list_agents.py +11 -11
  13. beamlit/api/agents/put_agent_history.py +185 -0
  14. beamlit/api/agents/update_agent.py +14 -9
  15. beamlit/api/environments/list_environments.py +11 -11
  16. beamlit/api/functions/create_function.py +14 -9
  17. beamlit/api/functions/get_function_deployment_logs.py +11 -11
  18. beamlit/api/functions/get_function_environment_logs.py +151 -0
  19. beamlit/api/functions/list_function_deployments.py +11 -11
  20. beamlit/api/functions/list_functions.py +11 -11
  21. beamlit/api/functions/update_function.py +14 -9
  22. beamlit/api/history/get_agents_history.py +11 -11
  23. beamlit/api/history/list_agents_history.py +11 -11
  24. beamlit/api/integrations/create_integration_connection.py +167 -0
  25. beamlit/api/integrations/delete_integration_connection.py +158 -0
  26. beamlit/api/integrations/get_integration.py +97 -0
  27. beamlit/api/integrations/get_integration_connection.py +154 -0
  28. beamlit/api/integrations/get_integration_connection_model.py +97 -0
  29. beamlit/api/integrations/get_integration_model.py +97 -0
  30. beamlit/api/integrations/list_integration_connection_models.py +97 -0
  31. beamlit/api/integrations/list_integration_connections.py +139 -0
  32. beamlit/api/integrations/list_integration_models.py +97 -0
  33. beamlit/api/integrations/update_integration_connection.py +180 -0
  34. beamlit/api/invitations/list_all_pending_invitations.py +11 -11
  35. beamlit/api/locations/list_locations.py +11 -11
  36. beamlit/api/model_providers/list_model_providers.py +11 -11
  37. beamlit/api/models/get_model_deployment_logs.py +11 -11
  38. beamlit/api/{authentication_providers/list_models_for_authentication_provider.py → models/get_model_environment_logs.py} +30 -38
  39. beamlit/api/models/list_model_deployments.py +11 -11
  40. beamlit/api/models/list_models.py +11 -11
  41. beamlit/api/policies/list_policies.py +11 -11
  42. beamlit/api/service_accounts/get_workspace_service_accounts.py +11 -11
  43. beamlit/api/service_accounts/list_api_keys_for_service_account.py +11 -11
  44. beamlit/api/store/list_store_agents.py +11 -11
  45. beamlit/api/store/list_store_functions.py +11 -11
  46. beamlit/api/workspaces/list_workspace_users.py +11 -11
  47. beamlit/api/workspaces/list_workspaces.py +11 -11
  48. beamlit/authentication/__init__.py +29 -8
  49. beamlit/authentication/apikey.py +8 -2
  50. beamlit/authentication/authentication.py +66 -3
  51. beamlit/authentication/clientcredentials.py +108 -0
  52. beamlit/authentication/credentials.py +22 -8
  53. beamlit/authentication/device_mode.py +23 -13
  54. beamlit/common/__init__.py +13 -0
  55. beamlit/common/generate.py +183 -0
  56. beamlit/common/logger.py +29 -0
  57. beamlit/common/secrets.py +11 -0
  58. beamlit/common/settings.py +156 -0
  59. beamlit/common/utils.py +15 -0
  60. beamlit/functions/__init__.py +5 -0
  61. beamlit/functions/decorator.py +90 -0
  62. beamlit/functions/github/__init__.py +3 -0
  63. beamlit/functions/github/github.py +21 -0
  64. beamlit/functions/github/kit/__init__.py +7 -0
  65. beamlit/functions/github/kit/pull_request.py +51 -0
  66. beamlit/functions/math/__init__.py +3 -0
  67. beamlit/functions/math/math.py +40 -0
  68. beamlit/functions/search/__init__.py +3 -0
  69. beamlit/functions/search/search.py +15 -0
  70. beamlit/models/__init__.py +24 -0
  71. beamlit/models/acl.py +4 -2
  72. beamlit/models/agent.py +5 -3
  73. beamlit/models/agent_chain.py +4 -2
  74. beamlit/models/agent_configuration.py +4 -2
  75. beamlit/models/agent_deployment.py +41 -28
  76. beamlit/models/agent_deployment_configuration.py +4 -2
  77. beamlit/models/agent_deployment_configuration_type_0.py +43 -0
  78. beamlit/models/agent_deployment_history.py +7 -5
  79. beamlit/models/agent_deployment_history_event.py +11 -9
  80. beamlit/models/agent_deployment_pod_template.py +4 -2
  81. beamlit/models/agent_deployment_pod_template_type_0.py +43 -0
  82. beamlit/models/agent_history.py +165 -0
  83. beamlit/models/agent_history_event.py +131 -0
  84. beamlit/models/agent_metadata.py +144 -0
  85. beamlit/models/agent_release.py +4 -2
  86. beamlit/models/agent_spec.py +248 -0
  87. beamlit/models/agent_with_deployments.py +176 -0
  88. beamlit/models/api_key.py +4 -2
  89. beamlit/models/authentication_provider_model.py +8 -6
  90. beamlit/models/authentication_provider_organization.py +4 -2
  91. beamlit/models/configuration.py +12 -10
  92. beamlit/models/continent.py +4 -2
  93. beamlit/models/core_spec.py +185 -0
  94. beamlit/models/country.py +4 -2
  95. beamlit/models/create_api_key_for_service_account_body.py +4 -2
  96. beamlit/models/create_workspace_service_account_body.py +4 -2
  97. beamlit/models/create_workspace_service_account_response_200.py +4 -2
  98. beamlit/models/delete_workspace_service_account_response_200.py +4 -2
  99. beamlit/models/deployment_configuration.py +4 -2
  100. beamlit/models/deployment_configurations.py +22 -7
  101. beamlit/models/deployment_serverless_config.py +4 -2
  102. beamlit/models/deployment_serverless_config_type_0.py +220 -0
  103. beamlit/models/environment.py +9 -7
  104. beamlit/models/environment_metrics.py +26 -5
  105. beamlit/models/environment_spec.py +61 -0
  106. beamlit/models/flavor.py +11 -9
  107. beamlit/models/function.py +5 -3
  108. beamlit/models/function_configuration.py +4 -2
  109. beamlit/models/function_deployment.py +33 -20
  110. beamlit/models/function_deployment_configuration.py +4 -2
  111. beamlit/models/function_deployment_configuration_type_0.py +43 -0
  112. beamlit/models/function_deployment_pod_template.py +4 -2
  113. beamlit/models/function_deployment_pod_template_type_0.py +43 -0
  114. beamlit/models/function_kit.py +7 -5
  115. beamlit/models/function_metadata.py +144 -0
  116. beamlit/models/function_provider_ref.py +4 -2
  117. beamlit/models/function_release.py +4 -2
  118. beamlit/models/function_spec.py +246 -0
  119. beamlit/models/function_with_deployments.py +176 -0
  120. beamlit/models/get_workspace_service_accounts_response_200_item.py +4 -2
  121. beamlit/models/increase_and_rate_metric.py +104 -0
  122. beamlit/models/integration.py +198 -0
  123. beamlit/models/integration_config.py +45 -0
  124. beamlit/models/integration_connection.py +198 -0
  125. beamlit/models/integration_connection_config.py +45 -0
  126. beamlit/models/integration_connection_secret.py +61 -0
  127. beamlit/models/integration_connection_spec.py +99 -0
  128. beamlit/models/integration_model.py +144 -0
  129. beamlit/models/integration_secret.py +61 -0
  130. beamlit/models/invite_workspace_user_body.py +4 -2
  131. beamlit/models/labels_type_0.py +4 -2
  132. beamlit/models/location.py +7 -5
  133. beamlit/models/location_response.py +7 -5
  134. beamlit/models/metadata.py +135 -0
  135. beamlit/models/{labels.py → metadata_labels.py} +5 -5
  136. beamlit/models/metric.py +4 -2
  137. beamlit/models/metrics.py +68 -25
  138. beamlit/models/model.py +5 -3
  139. beamlit/models/model_deployment.py +27 -14
  140. beamlit/models/model_deployment_log.py +4 -2
  141. beamlit/models/model_deployment_metrics.py +11 -9
  142. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +7 -5
  143. beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +5 -3
  144. beamlit/models/model_deployment_pod_template.py +4 -2
  145. beamlit/models/model_deployment_pod_template_type_0.py +43 -0
  146. beamlit/models/model_metadata.py +144 -0
  147. beamlit/models/model_metrics.py +8 -6
  148. beamlit/models/model_provider.py +13 -11
  149. beamlit/models/model_provider_ref.py +4 -2
  150. beamlit/models/model_release.py +4 -2
  151. beamlit/models/model_spec.py +194 -0
  152. beamlit/models/model_with_deployments.py +8 -6
  153. beamlit/models/owner_fields.py +68 -0
  154. beamlit/models/pending_invitation.py +4 -2
  155. beamlit/models/pending_invitation_accept.py +5 -3
  156. beamlit/models/pending_invitation_render.py +7 -5
  157. beamlit/models/pending_invitation_render_invited_by.py +4 -2
  158. beamlit/models/pending_invitation_render_workspace.py +4 -2
  159. beamlit/models/pending_invitation_workspace_details.py +8 -6
  160. beamlit/models/pod_template_spec.py +43 -0
  161. beamlit/models/policy.py +22 -20
  162. beamlit/models/policy_location.py +11 -9
  163. beamlit/models/policy_spec.py +125 -0
  164. beamlit/models/provider_config.py +9 -16
  165. beamlit/models/qps.py +4 -2
  166. beamlit/models/resource_deployment_log.py +4 -2
  167. beamlit/models/resource_deployment_metrics.py +119 -9
  168. beamlit/models/resource_deployment_metrics_inference_per_region.py +77 -0
  169. beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +79 -0
  170. beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +7 -5
  171. beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +79 -0
  172. beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +75 -0
  173. beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +73 -0
  174. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +5 -3
  175. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +73 -0
  176. beamlit/models/resource_environment_metrics.py +210 -0
  177. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +79 -0
  178. beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +73 -0
  179. beamlit/models/resource_log.py +68 -0
  180. beamlit/models/resource_metrics.py +44 -6
  181. beamlit/models/runtime.py +25 -23
  182. beamlit/models/runtime_readiness_probe.py +4 -2
  183. beamlit/models/runtime_readiness_probe_type_0.py +43 -0
  184. beamlit/models/runtime_resources.py +4 -2
  185. beamlit/models/runtime_type_0.py +111 -0
  186. beamlit/models/runtime_type_0_readiness_probe.py +43 -0
  187. beamlit/models/runtime_type_0_readiness_probe_type_0.py +43 -0
  188. beamlit/models/runtime_type_0_resources.py +59 -0
  189. beamlit/models/serverless_config.py +4 -2
  190. beamlit/models/spec_configuration.py +68 -0
  191. beamlit/models/standard_fields_dynamo_db.py +4 -2
  192. beamlit/models/store_agent.py +8 -6
  193. beamlit/models/store_agent_configuration.py +4 -2
  194. beamlit/models/store_agent_labels.py +4 -2
  195. beamlit/models/store_agent_labels_type_0.py +43 -0
  196. beamlit/models/store_configuration.py +18 -16
  197. beamlit/models/store_configuration_option.py +4 -2
  198. beamlit/models/store_function.py +14 -12
  199. beamlit/models/store_function_configuration.py +4 -2
  200. beamlit/models/store_function_kit.py +7 -5
  201. beamlit/models/store_function_labels.py +4 -2
  202. beamlit/models/store_function_labels_type_0.py +43 -0
  203. beamlit/models/store_function_parameter.py +11 -9
  204. beamlit/models/time_fields.py +68 -0
  205. beamlit/models/update_workspace_service_account_body.py +4 -2
  206. beamlit/models/update_workspace_service_account_response_200.py +4 -2
  207. beamlit/models/update_workspace_user_role_body.py +4 -2
  208. beamlit/models/websocket_channel.py +86 -0
  209. beamlit/models/workspace.py +5 -3
  210. beamlit/models/workspace_labels.py +4 -2
  211. beamlit/models/workspace_user.py +4 -2
  212. beamlit/run.py +49 -0
  213. beamlit/serve/app.py +78 -0
  214. beamlit/serve/middlewares/__init__.py +4 -0
  215. beamlit/serve/middlewares/accesslog.py +14 -0
  216. beamlit/serve/middlewares/processtime.py +12 -0
  217. {beamlit-0.0.19.dist-info → beamlit-0.0.20.dist-info}/METADATA +11 -2
  218. beamlit-0.0.20.dist-info/RECORD +301 -0
  219. beamlit-0.0.19.dist-info/RECORD +0 -211
  220. /beamlit/api/{authentication_providers → integrations}/__init__.py +0 -0
  221. {beamlit-0.0.19.dist-info → beamlit-0.0.20.dist-info}/WHEEL +0 -0
@@ -0,0 +1,246 @@
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.function_kit import FunctionKit
11
+ from ..models.pod_template_spec import PodTemplateSpec
12
+ from ..models.runtime import Runtime
13
+ from ..models.serverless_config import ServerlessConfig
14
+ from ..models.spec_configuration import SpecConfiguration
15
+ from ..models.store_function_parameter import StoreFunctionParameter
16
+
17
+
18
+ T = TypeVar("T", bound="FunctionSpec")
19
+
20
+
21
+ @_attrs_define
22
+ class FunctionSpec:
23
+ """Function specification
24
+
25
+ Attributes:
26
+ configurations (Union[Unset, SpecConfiguration]): Agent configuration, this is a key value storage. In your
27
+ agent you can retrieve the value with config[key]
28
+ enabled (Union[Unset, bool]): Enable or disable the agent
29
+ flavors (Union[Unset, List['Flavor']]): Types of hardware available for deployments
30
+ integration_connections (Union[Unset, List[str]]):
31
+ pod_template (Union[Unset, PodTemplateSpec]): Pod template specification
32
+ policies (Union[Unset, List[str]]):
33
+ runtime (Union[Unset, Runtime]): Set of configurations for a deployment
34
+ serverless_config (Union[Unset, ServerlessConfig]): Configuration for a serverless deployment
35
+ description (Union[Unset, str]): Function description, very important for the agent function to work with an LLM
36
+ kit (Union[Unset, List['FunctionKit']]): The kit of the function deployment
37
+ parameters (Union[Unset, List['StoreFunctionParameter']]): Function parameters, for your function to be callable
38
+ with Agent
39
+ store_id (Union[Unset, str]): Store id
40
+ """
41
+
42
+ configurations: Union[Unset, "SpecConfiguration"] = UNSET
43
+ enabled: Union[Unset, bool] = UNSET
44
+ flavors: Union[Unset, List["Flavor"]] = UNSET
45
+ integration_connections: Union[Unset, List[str]] = UNSET
46
+ pod_template: Union[Unset, "PodTemplateSpec"] = UNSET
47
+ policies: Union[Unset, List[str]] = UNSET
48
+ runtime: Union[Unset, "Runtime"] = UNSET
49
+ serverless_config: Union[Unset, "ServerlessConfig"] = UNSET
50
+ description: Union[Unset, str] = UNSET
51
+ kit: Union[Unset, List["FunctionKit"]] = UNSET
52
+ parameters: Union[Unset, List["StoreFunctionParameter"]] = UNSET
53
+ store_id: Union[Unset, str] = UNSET
54
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
55
+
56
+ def to_dict(self) -> dict[str, Any]:
57
+ configurations: Union[Unset, Dict[str, Any]] = UNSET
58
+ if not isinstance(self.configurations, Unset):
59
+ configurations = self.configurations.to_dict()
60
+
61
+ enabled = self.enabled
62
+
63
+ flavors: Union[Unset, List[Dict[str, Any]]] = UNSET
64
+ if not isinstance(self.flavors, Unset):
65
+ flavors = []
66
+ for componentsschemas_flavors_item_data in self.flavors:
67
+ componentsschemas_flavors_item = (
68
+ componentsschemas_flavors_item_data.to_dict()
69
+ )
70
+ flavors.append(componentsschemas_flavors_item)
71
+
72
+ integration_connections: Union[Unset, List[str]] = UNSET
73
+ if not isinstance(self.integration_connections, Unset):
74
+ integration_connections = self.integration_connections
75
+
76
+ pod_template: Union[Unset, Dict[str, Any]] = UNSET
77
+ if not isinstance(self.pod_template, Unset):
78
+ pod_template = self.pod_template.to_dict()
79
+
80
+ policies: Union[Unset, List[str]] = UNSET
81
+ if not isinstance(self.policies, Unset):
82
+ policies = self.policies
83
+
84
+ runtime: Union[Unset, Dict[str, Any]] = UNSET
85
+ if not isinstance(self.runtime, Unset):
86
+ runtime = self.runtime.to_dict()
87
+
88
+ serverless_config: Union[Unset, Dict[str, Any]] = UNSET
89
+ if not isinstance(self.serverless_config, Unset):
90
+ serverless_config = self.serverless_config.to_dict()
91
+
92
+ description = self.description
93
+
94
+ kit: Union[Unset, List[Dict[str, Any]]] = UNSET
95
+ if not isinstance(self.kit, Unset):
96
+ kit = []
97
+ for kit_item_data in self.kit:
98
+ kit_item = kit_item_data.to_dict()
99
+ kit.append(kit_item)
100
+
101
+ parameters: Union[Unset, List[Dict[str, Any]]] = UNSET
102
+ if not isinstance(self.parameters, Unset):
103
+ parameters = []
104
+ for parameters_item_data in self.parameters:
105
+ parameters_item = parameters_item_data.to_dict()
106
+ parameters.append(parameters_item)
107
+
108
+ store_id = self.store_id
109
+
110
+ field_dict: dict[str, Any] = {}
111
+ field_dict.update(self.additional_properties)
112
+ field_dict.update({})
113
+ if configurations is not UNSET:
114
+ field_dict["configurations"] = configurations
115
+ if enabled is not UNSET:
116
+ field_dict["enabled"] = enabled
117
+ if flavors is not UNSET:
118
+ field_dict["flavors"] = flavors
119
+ if integration_connections is not UNSET:
120
+ field_dict["integrationConnections"] = integration_connections
121
+ if pod_template is not UNSET:
122
+ field_dict["podTemplate"] = pod_template
123
+ if policies is not UNSET:
124
+ field_dict["policies"] = policies
125
+ if runtime is not UNSET:
126
+ field_dict["runtime"] = runtime
127
+ if serverless_config is not UNSET:
128
+ field_dict["serverlessConfig"] = serverless_config
129
+ if description is not UNSET:
130
+ field_dict["description"] = description
131
+ if kit is not UNSET:
132
+ field_dict["kit"] = kit
133
+ if parameters is not UNSET:
134
+ field_dict["parameters"] = parameters
135
+ if store_id is not UNSET:
136
+ field_dict["store_id"] = store_id
137
+
138
+ return field_dict
139
+
140
+ @classmethod
141
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
142
+ from ..models.flavor import Flavor
143
+ from ..models.function_kit import FunctionKit
144
+ from ..models.pod_template_spec import PodTemplateSpec
145
+ from ..models.runtime import Runtime
146
+ from ..models.serverless_config import ServerlessConfig
147
+ from ..models.spec_configuration import SpecConfiguration
148
+ from ..models.store_function_parameter import StoreFunctionParameter
149
+
150
+ d = src_dict.copy()
151
+ _configurations = d.pop("configurations", UNSET)
152
+ configurations: Union[Unset, SpecConfiguration]
153
+ if isinstance(_configurations, Unset):
154
+ configurations = UNSET
155
+ else:
156
+ configurations = SpecConfiguration.from_dict(_configurations)
157
+
158
+ enabled = d.pop("enabled", UNSET)
159
+
160
+ flavors = []
161
+ _flavors = d.pop("flavors", UNSET)
162
+ for componentsschemas_flavors_item_data in _flavors or []:
163
+ componentsschemas_flavors_item = Flavor.from_dict(
164
+ componentsschemas_flavors_item_data
165
+ )
166
+
167
+ flavors.append(componentsschemas_flavors_item)
168
+
169
+ integration_connections = cast(
170
+ List[str], d.pop("integrationConnections", UNSET)
171
+ )
172
+
173
+ _pod_template = d.pop("podTemplate", UNSET)
174
+ pod_template: Union[Unset, PodTemplateSpec]
175
+ if isinstance(_pod_template, Unset):
176
+ pod_template = UNSET
177
+ else:
178
+ pod_template = PodTemplateSpec.from_dict(_pod_template)
179
+
180
+ policies = cast(List[str], d.pop("policies", UNSET))
181
+
182
+ _runtime = d.pop("runtime", UNSET)
183
+ runtime: Union[Unset, Runtime]
184
+ if isinstance(_runtime, Unset):
185
+ runtime = UNSET
186
+ else:
187
+ runtime = Runtime.from_dict(_runtime)
188
+
189
+ _serverless_config = d.pop("serverlessConfig", UNSET)
190
+ serverless_config: Union[Unset, ServerlessConfig]
191
+ if isinstance(_serverless_config, Unset):
192
+ serverless_config = UNSET
193
+ else:
194
+ serverless_config = ServerlessConfig.from_dict(_serverless_config)
195
+
196
+ description = d.pop("description", UNSET)
197
+
198
+ kit = []
199
+ _kit = d.pop("kit", UNSET)
200
+ for kit_item_data in _kit or []:
201
+ kit_item = FunctionKit.from_dict(kit_item_data)
202
+
203
+ kit.append(kit_item)
204
+
205
+ parameters = []
206
+ _parameters = d.pop("parameters", UNSET)
207
+ for parameters_item_data in _parameters or []:
208
+ parameters_item = StoreFunctionParameter.from_dict(parameters_item_data)
209
+
210
+ parameters.append(parameters_item)
211
+
212
+ store_id = d.pop("store_id", UNSET)
213
+
214
+ function_spec = cls(
215
+ configurations=configurations,
216
+ enabled=enabled,
217
+ flavors=flavors,
218
+ integration_connections=integration_connections,
219
+ pod_template=pod_template,
220
+ policies=policies,
221
+ runtime=runtime,
222
+ serverless_config=serverless_config,
223
+ description=description,
224
+ kit=kit,
225
+ parameters=parameters,
226
+ store_id=store_id,
227
+ )
228
+
229
+ function_spec.additional_properties = d
230
+ return function_spec
231
+
232
+ @property
233
+ def additional_keys(self) -> list[str]:
234
+ return list(self.additional_properties.keys())
235
+
236
+ def __getitem__(self, key: str) -> Any:
237
+ return self.additional_properties[key]
238
+
239
+ def __setitem__(self, key: str, value: Any) -> None:
240
+ self.additional_properties[key] = value
241
+
242
+ def __delitem__(self, key: str) -> None:
243
+ del self.additional_properties[key]
244
+
245
+ def __contains__(self, key: str) -> bool:
246
+ return key in self.additional_properties
@@ -0,0 +1,176 @@
1
+ from typing import TYPE_CHECKING, Any, 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[None, Unset, dict[str, Any]]
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
+ if not src_dict:
105
+ return None
106
+ d = src_dict.copy()
107
+ created_at = d.pop("created_at", UNSET)
108
+
109
+ created_by = d.pop("created_by", UNSET)
110
+
111
+ updated_at = d.pop("updated_at", UNSET)
112
+
113
+ updated_by = d.pop("updated_by", UNSET)
114
+
115
+ display_name = d.pop("display_name", UNSET)
116
+
117
+ def _parse_labels(data: object) -> Union["LabelsType0", None, Unset]:
118
+ if data is None:
119
+ return data
120
+ if isinstance(data, Unset):
121
+ return data
122
+ try:
123
+ if not isinstance(data, dict):
124
+ raise TypeError()
125
+ componentsschemas_labels_type_0 = LabelsType0.from_dict(data)
126
+
127
+ return componentsschemas_labels_type_0
128
+ except: # noqa: E722
129
+ pass
130
+ return cast(Union["LabelsType0", None, Unset], data)
131
+
132
+ labels = _parse_labels(d.pop("labels", UNSET))
133
+
134
+ name = d.pop("name", UNSET)
135
+
136
+ workspace = d.pop("workspace", UNSET)
137
+
138
+ deployments = []
139
+ _deployments = d.pop("deployments", UNSET)
140
+ for componentsschemas_function_deployments_item_data in _deployments or []:
141
+ componentsschemas_function_deployments_item = FunctionDeployment.from_dict(
142
+ componentsschemas_function_deployments_item_data
143
+ )
144
+
145
+ deployments.append(componentsschemas_function_deployments_item)
146
+
147
+ function_with_deployments = cls(
148
+ created_at=created_at,
149
+ created_by=created_by,
150
+ updated_at=updated_at,
151
+ updated_by=updated_by,
152
+ display_name=display_name,
153
+ labels=labels,
154
+ name=name,
155
+ workspace=workspace,
156
+ deployments=deployments,
157
+ )
158
+
159
+ function_with_deployments.additional_properties = d
160
+ return function_with_deployments
161
+
162
+ @property
163
+ def additional_keys(self) -> list[str]:
164
+ return list(self.additional_properties.keys())
165
+
166
+ def __getitem__(self, key: str) -> Any:
167
+ return self.additional_properties[key]
168
+
169
+ def __setitem__(self, key: str, value: Any) -> None:
170
+ self.additional_properties[key] = value
171
+
172
+ def __delitem__(self, key: str) -> None:
173
+ del self.additional_properties[key]
174
+
175
+ def __contains__(self, key: str) -> bool:
176
+ return key in self.additional_properties
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar, Union
1
+ from typing import Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -54,7 +54,9 @@ class GetWorkspaceServiceAccountsResponse200Item:
54
54
  return field_dict
55
55
 
56
56
  @classmethod
57
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
57
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
58
+ if not src_dict:
59
+ return None
58
60
  d = src_dict.copy()
59
61
  client_id = d.pop("client_id", UNSET)
60
62
 
@@ -0,0 +1,104 @@
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.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
+ if not src_dict:
65
+ return None
66
+ d = src_dict.copy()
67
+ inference_global = d.pop("inference_global", UNSET)
68
+
69
+ inference_per_second_global = []
70
+ _inference_per_second_global = d.pop("inference_per_second_global", UNSET)
71
+ for componentsschemas_array_metric_item_data in _inference_per_second_global or []:
72
+ componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
73
+
74
+ inference_per_second_global.append(componentsschemas_array_metric_item)
75
+
76
+ query = d.pop("query", UNSET)
77
+
78
+ query_per_second = d.pop("query_per_second", UNSET)
79
+
80
+ increase_and_rate_metric = cls(
81
+ inference_global=inference_global,
82
+ inference_per_second_global=inference_per_second_global,
83
+ query=query,
84
+ query_per_second=query_per_second,
85
+ )
86
+
87
+ increase_and_rate_metric.additional_properties = d
88
+ return increase_and_rate_metric
89
+
90
+ @property
91
+ def additional_keys(self) -> list[str]:
92
+ return list(self.additional_properties.keys())
93
+
94
+ def __getitem__(self, key: str) -> Any:
95
+ return self.additional_properties[key]
96
+
97
+ def __setitem__(self, key: str, value: Any) -> None:
98
+ self.additional_properties[key] = value
99
+
100
+ def __delitem__(self, key: str) -> None:
101
+ del self.additional_properties[key]
102
+
103
+ def __contains__(self, key: str) -> bool:
104
+ return key in self.additional_properties