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
@@ -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
@@ -80,7 +80,9 @@ class DeploymentServerlessConfig:
80
80
  return field_dict
81
81
 
82
82
  @classmethod
83
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
83
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
84
+ if not src_dict:
85
+ return None
84
86
  d = src_dict.copy()
85
87
  last_pod_retention_period = d.pop("last_pod_retention_period", UNSET)
86
88
 
@@ -0,0 +1,220 @@
1
+ from typing import Any, 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
+ T = TypeVar("T", bound="DeploymentServerlessConfigType0")
9
+
10
+
11
+ @_attrs_define
12
+ class DeploymentServerlessConfigType0:
13
+ """Configuration for a serverless deployment
14
+
15
+ Attributes:
16
+ last_pod_retention_period (Union[None, Unset, str]): The minimum amount of time that the last replica will
17
+ remain active AFTER a scale-to-zero decision is made
18
+ max_num_replicas (Union[None, Unset, int]): The maximum number of replicas for the deployment.
19
+ metric (Union[None, Unset, str]): Metric watched to make scaling decisions. Can be "cpu" or "memory" or "rps" or
20
+ "concurrency"
21
+ min_num_replicas (Union[None, Unset, int]): The minimum number of replicas for the deployment. Can be 0 or 1 (in
22
+ which case the deployment is always running in at least one location).
23
+ scale_down_delay (Union[None, Unset, str]): The time window which must pass at reduced concurrency before a
24
+ scale-down decision is applied. This can be useful, for example, to keep containers around for a configurable
25
+ duration to avoid a cold start penalty if new requests come in.
26
+ scale_up_minimum (Union[None, Unset, int]): The minimum number of replicas that will be created when the
27
+ deployment scales up from zero.
28
+ stable_window (Union[None, Unset, str]): The sliding time window over which metrics are averaged to provide the
29
+ input for scaling decisions
30
+ target (Union[None, Unset, str]): Target value for the watched metric
31
+ """
32
+
33
+ last_pod_retention_period: Union[None, Unset, str] = UNSET
34
+ max_num_replicas: Union[None, Unset, int] = UNSET
35
+ metric: Union[None, Unset, str] = UNSET
36
+ min_num_replicas: Union[None, Unset, int] = UNSET
37
+ scale_down_delay: Union[None, Unset, str] = UNSET
38
+ scale_up_minimum: Union[None, Unset, int] = UNSET
39
+ stable_window: Union[None, Unset, str] = UNSET
40
+ target: Union[None, Unset, str] = UNSET
41
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
42
+
43
+ def to_dict(self) -> dict[str, Any]:
44
+ last_pod_retention_period: Union[None, Unset, str]
45
+ if isinstance(self.last_pod_retention_period, Unset):
46
+ last_pod_retention_period = UNSET
47
+ else:
48
+ last_pod_retention_period = self.last_pod_retention_period
49
+
50
+ max_num_replicas: Union[None, Unset, int]
51
+ if isinstance(self.max_num_replicas, Unset):
52
+ max_num_replicas = UNSET
53
+ else:
54
+ max_num_replicas = self.max_num_replicas
55
+
56
+ metric: Union[None, Unset, str]
57
+ if isinstance(self.metric, Unset):
58
+ metric = UNSET
59
+ else:
60
+ metric = self.metric
61
+
62
+ min_num_replicas: Union[None, Unset, int]
63
+ if isinstance(self.min_num_replicas, Unset):
64
+ min_num_replicas = UNSET
65
+ else:
66
+ min_num_replicas = self.min_num_replicas
67
+
68
+ scale_down_delay: Union[None, Unset, str]
69
+ if isinstance(self.scale_down_delay, Unset):
70
+ scale_down_delay = UNSET
71
+ else:
72
+ scale_down_delay = self.scale_down_delay
73
+
74
+ scale_up_minimum: Union[None, Unset, int]
75
+ if isinstance(self.scale_up_minimum, Unset):
76
+ scale_up_minimum = UNSET
77
+ else:
78
+ scale_up_minimum = self.scale_up_minimum
79
+
80
+ stable_window: Union[None, Unset, str]
81
+ if isinstance(self.stable_window, Unset):
82
+ stable_window = UNSET
83
+ else:
84
+ stable_window = self.stable_window
85
+
86
+ target: Union[None, Unset, str]
87
+ if isinstance(self.target, Unset):
88
+ target = UNSET
89
+ else:
90
+ target = self.target
91
+
92
+ field_dict: dict[str, Any] = {}
93
+ field_dict.update(self.additional_properties)
94
+ field_dict.update({})
95
+ if last_pod_retention_period is not UNSET:
96
+ field_dict["last_pod_retention_period"] = last_pod_retention_period
97
+ if max_num_replicas is not UNSET:
98
+ field_dict["max_num_replicas"] = max_num_replicas
99
+ if metric is not UNSET:
100
+ field_dict["metric"] = metric
101
+ if min_num_replicas is not UNSET:
102
+ field_dict["min_num_replicas"] = min_num_replicas
103
+ if scale_down_delay is not UNSET:
104
+ field_dict["scale_down_delay"] = scale_down_delay
105
+ if scale_up_minimum is not UNSET:
106
+ field_dict["scale_up_minimum"] = scale_up_minimum
107
+ if stable_window is not UNSET:
108
+ field_dict["stable_window"] = stable_window
109
+ if target is not UNSET:
110
+ field_dict["target"] = target
111
+
112
+ return field_dict
113
+
114
+ @classmethod
115
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
116
+ d = src_dict.copy()
117
+
118
+ def _parse_last_pod_retention_period(data: object) -> Union[None, Unset, str]:
119
+ if data is None:
120
+ return data
121
+ if isinstance(data, Unset):
122
+ return data
123
+ return cast(Union[None, Unset, str], data)
124
+
125
+ last_pod_retention_period = _parse_last_pod_retention_period(
126
+ d.pop("last_pod_retention_period", UNSET)
127
+ )
128
+
129
+ def _parse_max_num_replicas(data: object) -> Union[None, Unset, int]:
130
+ if data is None:
131
+ return data
132
+ if isinstance(data, Unset):
133
+ return data
134
+ return cast(Union[None, Unset, int], data)
135
+
136
+ max_num_replicas = _parse_max_num_replicas(d.pop("max_num_replicas", UNSET))
137
+
138
+ def _parse_metric(data: object) -> Union[None, Unset, str]:
139
+ if data is None:
140
+ return data
141
+ if isinstance(data, Unset):
142
+ return data
143
+ return cast(Union[None, Unset, str], data)
144
+
145
+ metric = _parse_metric(d.pop("metric", UNSET))
146
+
147
+ def _parse_min_num_replicas(data: object) -> Union[None, Unset, int]:
148
+ if data is None:
149
+ return data
150
+ if isinstance(data, Unset):
151
+ return data
152
+ return cast(Union[None, Unset, int], data)
153
+
154
+ min_num_replicas = _parse_min_num_replicas(d.pop("min_num_replicas", UNSET))
155
+
156
+ def _parse_scale_down_delay(data: object) -> Union[None, Unset, str]:
157
+ if data is None:
158
+ return data
159
+ if isinstance(data, Unset):
160
+ return data
161
+ return cast(Union[None, Unset, str], data)
162
+
163
+ scale_down_delay = _parse_scale_down_delay(d.pop("scale_down_delay", UNSET))
164
+
165
+ def _parse_scale_up_minimum(data: object) -> Union[None, Unset, int]:
166
+ if data is None:
167
+ return data
168
+ if isinstance(data, Unset):
169
+ return data
170
+ return cast(Union[None, Unset, int], data)
171
+
172
+ scale_up_minimum = _parse_scale_up_minimum(d.pop("scale_up_minimum", UNSET))
173
+
174
+ def _parse_stable_window(data: object) -> Union[None, Unset, str]:
175
+ if data is None:
176
+ return data
177
+ if isinstance(data, Unset):
178
+ return data
179
+ return cast(Union[None, Unset, str], data)
180
+
181
+ stable_window = _parse_stable_window(d.pop("stable_window", UNSET))
182
+
183
+ def _parse_target(data: object) -> Union[None, Unset, str]:
184
+ if data is None:
185
+ return data
186
+ if isinstance(data, Unset):
187
+ return data
188
+ return cast(Union[None, Unset, str], data)
189
+
190
+ target = _parse_target(d.pop("target", UNSET))
191
+
192
+ deployment_serverless_config_type_0 = cls(
193
+ last_pod_retention_period=last_pod_retention_period,
194
+ max_num_replicas=max_num_replicas,
195
+ metric=metric,
196
+ min_num_replicas=min_num_replicas,
197
+ scale_down_delay=scale_down_delay,
198
+ scale_up_minimum=scale_up_minimum,
199
+ stable_window=stable_window,
200
+ target=target,
201
+ )
202
+
203
+ deployment_serverless_config_type_0.additional_properties = d
204
+ return deployment_serverless_config_type_0
205
+
206
+ @property
207
+ def additional_keys(self) -> list[str]:
208
+ return list(self.additional_properties.keys())
209
+
210
+ def __getitem__(self, key: str) -> Any:
211
+ return self.additional_properties[key]
212
+
213
+ def __setitem__(self, key: str, value: Any) -> None:
214
+ self.additional_properties[key] = value
215
+
216
+ def __delitem__(self, key: str) -> None:
217
+ del self.additional_properties[key]
218
+
219
+ def __contains__(self, key: str) -> bool:
220
+ return key in self.additional_properties
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -24,7 +24,7 @@ class Environment:
24
24
  display_name (Union[Unset, str]): The display name of the environment
25
25
  labels (Union['LabelsType0', None, Unset]): Labels
26
26
  name (Union[Unset, str]): The name of the environment
27
- policies (Union[Unset, List[Any]]): The policies attached to the environment
27
+ policies (Union[Unset, list[Any]]): The policies attached to the environment
28
28
  workspace (Union[Unset, str]): The workspace the environment belongs to
29
29
  """
30
30
 
@@ -35,7 +35,7 @@ class Environment:
35
35
  display_name: Union[Unset, str] = UNSET
36
36
  labels: Union["LabelsType0", None, Unset] = UNSET
37
37
  name: Union[Unset, str] = UNSET
38
- policies: Union[Unset, List[Any]] = UNSET
38
+ policies: Union[Unset, list[Any]] = UNSET
39
39
  workspace: Union[Unset, str] = UNSET
40
40
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
41
 
@@ -52,7 +52,7 @@ class Environment:
52
52
 
53
53
  display_name = self.display_name
54
54
 
55
- labels: Union[Dict[str, Any], None, Unset]
55
+ labels: Union[None, Unset, dict[str, Any]]
56
56
  if isinstance(self.labels, Unset):
57
57
  labels = UNSET
58
58
  elif isinstance(self.labels, LabelsType0):
@@ -62,7 +62,7 @@ class Environment:
62
62
 
63
63
  name = self.name
64
64
 
65
- policies: Union[Unset, List[Any]] = UNSET
65
+ policies: Union[Unset, list[Any]] = UNSET
66
66
  if not isinstance(self.policies, Unset):
67
67
  policies = self.policies
68
68
 
@@ -93,9 +93,11 @@ class Environment:
93
93
  return field_dict
94
94
 
95
95
  @classmethod
96
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
96
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
97
97
  from ..models.labels_type_0 import LabelsType0
98
98
 
99
+ if not src_dict:
100
+ return None
99
101
  d = src_dict.copy()
100
102
  created_at = d.pop("created_at", UNSET)
101
103
 
@@ -126,7 +128,7 @@ class Environment:
126
128
 
127
129
  name = d.pop("name", UNSET)
128
130
 
129
- policies = cast(List[Any], d.pop("policies", UNSET))
131
+ policies = cast(list[Any], d.pop("policies", UNSET))
130
132
 
131
133
  workspace = d.pop("workspace", UNSET)
132
134
 
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -17,14 +17,23 @@ class EnvironmentMetrics:
17
17
  """Metrics for the environment
18
18
 
19
19
  Attributes:
20
- inference_per_second_global (Union[Unset, List['Metric']]): Array of metrics
20
+ inference_global (Union[Unset, list['Metric']]): Array of metrics
21
+ inference_per_second_global (Union[Unset, list['Metric']]): Array of metrics
21
22
  """
22
23
 
23
- inference_per_second_global: Union[Unset, List["Metric"]] = UNSET
24
+ inference_global: Union[Unset, list["Metric"]] = UNSET
25
+ inference_per_second_global: Union[Unset, list["Metric"]] = UNSET
24
26
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
27
 
26
28
  def to_dict(self) -> dict[str, Any]:
27
- inference_per_second_global: Union[Unset, List[Dict[str, Any]]] = UNSET
29
+ inference_global: Union[Unset, list[dict[str, Any]]] = UNSET
30
+ if not isinstance(self.inference_global, Unset):
31
+ inference_global = []
32
+ for componentsschemas_array_metric_item_data in self.inference_global:
33
+ componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
34
+ inference_global.append(componentsschemas_array_metric_item)
35
+
36
+ inference_per_second_global: Union[Unset, list[dict[str, Any]]] = UNSET
28
37
  if not isinstance(self.inference_per_second_global, Unset):
29
38
  inference_per_second_global = []
30
39
  for componentsschemas_array_metric_item_data in self.inference_per_second_global:
@@ -34,16 +43,27 @@ class EnvironmentMetrics:
34
43
  field_dict: dict[str, Any] = {}
35
44
  field_dict.update(self.additional_properties)
36
45
  field_dict.update({})
46
+ if inference_global is not UNSET:
47
+ field_dict["inference_global"] = inference_global
37
48
  if inference_per_second_global is not UNSET:
38
49
  field_dict["inference_per_second_global"] = inference_per_second_global
39
50
 
40
51
  return field_dict
41
52
 
42
53
  @classmethod
43
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
54
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
44
55
  from ..models.metric import Metric
45
56
 
57
+ if not src_dict:
58
+ return None
46
59
  d = src_dict.copy()
60
+ inference_global = []
61
+ _inference_global = d.pop("inference_global", UNSET)
62
+ for componentsschemas_array_metric_item_data in _inference_global or []:
63
+ componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
64
+
65
+ inference_global.append(componentsschemas_array_metric_item)
66
+
47
67
  inference_per_second_global = []
48
68
  _inference_per_second_global = d.pop("inference_per_second_global", UNSET)
49
69
  for componentsschemas_array_metric_item_data in _inference_per_second_global or []:
@@ -52,6 +72,7 @@ class EnvironmentMetrics:
52
72
  inference_per_second_global.append(componentsschemas_array_metric_item)
53
73
 
54
74
  environment_metrics = cls(
75
+ inference_global=inference_global,
55
76
  inference_per_second_global=inference_per_second_global,
56
77
  )
57
78
 
@@ -0,0 +1,61 @@
1
+ from typing import Any, 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
+ T = TypeVar("T", bound="EnvironmentSpec")
9
+
10
+
11
+ @_attrs_define
12
+ class EnvironmentSpec:
13
+ """Environment specification
14
+
15
+ Attributes:
16
+ policies (Union[Unset, List[str]]):
17
+ """
18
+
19
+ policies: Union[Unset, List[str]] = UNSET
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ policies: Union[Unset, List[str]] = UNSET
24
+ if not isinstance(self.policies, Unset):
25
+ policies = self.policies
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update({})
30
+ if policies is not UNSET:
31
+ field_dict["policies"] = policies
32
+
33
+ return field_dict
34
+
35
+ @classmethod
36
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
37
+ d = src_dict.copy()
38
+ policies = cast(List[str], d.pop("policies", UNSET))
39
+
40
+ environment_spec = cls(
41
+ policies=policies,
42
+ )
43
+
44
+ environment_spec.additional_properties = d
45
+ return environment_spec
46
+
47
+ @property
48
+ def additional_keys(self) -> list[str]:
49
+ return list(self.additional_properties.keys())
50
+
51
+ def __getitem__(self, key: str) -> Any:
52
+ return self.additional_properties[key]
53
+
54
+ def __setitem__(self, key: str, value: Any) -> None:
55
+ self.additional_properties[key] = value
56
+
57
+ def __delitem__(self, key: str) -> None:
58
+ del self.additional_properties[key]
59
+
60
+ def __contains__(self, key: str) -> bool:
61
+ return key in self.additional_properties
beamlit/models/flavor.py CHANGED
@@ -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
@@ -14,38 +14,40 @@ class Flavor:
14
14
 
15
15
  Attributes:
16
16
  name (Union[Unset, str]): Flavor name (e.g. t4)
17
- type (Union[Unset, str]): Flavor type (e.g. cpu, gpu)
17
+ type_ (Union[Unset, str]): Flavor type (e.g. cpu, gpu)
18
18
  """
19
19
 
20
20
  name: Union[Unset, str] = UNSET
21
- type: Union[Unset, str] = UNSET
21
+ type_: Union[Unset, str] = UNSET
22
22
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
23
 
24
24
  def to_dict(self) -> dict[str, Any]:
25
25
  name = self.name
26
26
 
27
- type = self.type
27
+ type_ = self.type_
28
28
 
29
29
  field_dict: dict[str, Any] = {}
30
30
  field_dict.update(self.additional_properties)
31
31
  field_dict.update({})
32
32
  if name is not UNSET:
33
33
  field_dict["name"] = name
34
- if type is not UNSET:
35
- field_dict["type"] = type
34
+ if type_ is not UNSET:
35
+ field_dict["type"] = type_
36
36
 
37
37
  return field_dict
38
38
 
39
39
  @classmethod
40
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
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
  name = d.pop("name", UNSET)
43
45
 
44
- type = d.pop("type", UNSET)
46
+ type_ = d.pop("type", UNSET)
45
47
 
46
48
  flavor = cls(
47
49
  name=name,
48
- type=type,
50
+ type_=type_,
49
51
  )
50
52
 
51
53
  flavor.additional_properties = d
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -50,7 +50,7 @@ class Function:
50
50
 
51
51
  display_name = self.display_name
52
52
 
53
- labels: Union[Dict[str, Any], None, Unset]
53
+ labels: Union[None, Unset, dict[str, Any]]
54
54
  if isinstance(self.labels, Unset):
55
55
  labels = UNSET
56
56
  elif isinstance(self.labels, LabelsType0):
@@ -85,9 +85,11 @@ class Function:
85
85
  return field_dict
86
86
 
87
87
  @classmethod
88
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
88
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
89
89
  from ..models.labels_type_0 import LabelsType0
90
90
 
91
+ if not src_dict:
92
+ return None
91
93
  d = src_dict.copy()
92
94
  created_at = d.pop("created_at", UNSET)
93
95
 
@@ -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
@@ -37,7 +37,9 @@ class FunctionConfiguration:
37
37
  return field_dict
38
38
 
39
39
  @classmethod
40
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
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
  secret = d.pop("secret", UNSET)
43
45