beamlit 0.0.24rc19__py3-none-any.whl → 0.0.24rc21__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. beamlit/agents/chat.py +37 -11
  2. beamlit/agents/decorator.py +97 -65
  3. beamlit/api/agents/create_agent.py +9 -14
  4. beamlit/api/agents/delete_agent.py +22 -1
  5. beamlit/api/agents/delete_agent_history.py +2 -6
  6. beamlit/api/agents/get_agent.py +22 -1
  7. beamlit/api/agents/get_agent_environment_logs.py +11 -11
  8. beamlit/api/agents/get_agent_history.py +2 -6
  9. beamlit/api/agents/get_agent_metrics.py +22 -1
  10. beamlit/api/agents/list_agent_history.py +11 -11
  11. beamlit/api/agents/list_agents.py +36 -4
  12. beamlit/api/agents/put_agent_history.py +2 -6
  13. beamlit/api/agents/update_agent.py +9 -14
  14. beamlit/api/functions/create_function.py +9 -14
  15. beamlit/api/functions/delete_function.py +22 -1
  16. beamlit/api/functions/get_function.py +22 -1
  17. beamlit/api/functions/get_function_environment_logs.py +11 -11
  18. beamlit/api/functions/get_function_metrics.py +22 -1
  19. beamlit/api/functions/list_functions.py +36 -4
  20. beamlit/api/functions/update_function.py +9 -14
  21. beamlit/api/history/get_agents_history.py +12 -12
  22. beamlit/api/history/list_agents_history.py +12 -12
  23. beamlit/api/integrations/get_integration_connection.py +16 -12
  24. beamlit/api/integrations/get_integration_connection_model.py +8 -1
  25. beamlit/api/integrations/get_integration_model.py +8 -1
  26. beamlit/api/locations/list_locations.py +12 -12
  27. beamlit/api/models/create_model.py +13 -14
  28. beamlit/api/models/delete_model.py +22 -1
  29. beamlit/api/models/get_model.py +22 -1
  30. beamlit/api/models/get_model_environment_logs.py +11 -11
  31. beamlit/api/models/get_model_metrics.py +38 -13
  32. beamlit/api/models/list_models.py +36 -4
  33. beamlit/api/models/update_model.py +13 -14
  34. beamlit/api/privateclusters/__init__.py +0 -0
  35. beamlit/api/{agents/get_agent_deployment_metrics.py → privateclusters/create_private_cluster.py} +28 -55
  36. beamlit/api/{functions/list_function_deployments.py → privateclusters/delete_private_cluster.py} +38 -37
  37. beamlit/api/{agents/get_agent_deployment.py → privateclusters/get_private_cluster.py} +40 -44
  38. beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
  39. beamlit/api/{agents/list_agent_deployments.py → privateclusters/list_private_clusters.py} +30 -45
  40. beamlit/api/{models/list_model_deployments.py → privateclusters/update_private_cluster.py} +38 -45
  41. beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
  42. beamlit/authentication/device_mode.py +3 -9
  43. beamlit/common/generate.py +47 -34
  44. beamlit/common/settings.py +29 -27
  45. beamlit/deploy/deploy.py +101 -342
  46. beamlit/deploy/format.py +70 -0
  47. beamlit/deploy/parser.py +175 -0
  48. beamlit/functions/decorator.py +17 -14
  49. beamlit/models/__init__.py +64 -78
  50. beamlit/models/acl.py +4 -22
  51. beamlit/models/agent.py +34 -95
  52. beamlit/models/agent_history.py +7 -5
  53. beamlit/models/agent_history_event.py +11 -9
  54. beamlit/models/agent_metadata.py +5 -3
  55. beamlit/models/agent_spec.py +54 -45
  56. beamlit/models/api_key.py +14 -14
  57. beamlit/models/configuration.py +11 -0
  58. beamlit/models/core_spec.py +45 -32
  59. beamlit/models/{model_deployment_metrics_query_per_second_per_region_per_code.py → core_spec_configurations.py} +22 -22
  60. beamlit/models/environment.py +33 -105
  61. beamlit/models/environment_metadata.py +146 -0
  62. beamlit/models/environment_spec.py +8 -6
  63. beamlit/models/function.py +34 -95
  64. beamlit/models/function_metadata.py +5 -3
  65. beamlit/models/function_spec.py +53 -40
  66. beamlit/models/integration_connection.py +31 -137
  67. beamlit/models/integration_connection_spec.py +6 -4
  68. beamlit/models/metadata.py +5 -3
  69. beamlit/models/metadata_labels.py +4 -2
  70. beamlit/models/model.py +33 -94
  71. beamlit/models/model_metadata.py +5 -3
  72. beamlit/models/{function_provider_ref.py → model_private_cluster.py} +23 -14
  73. beamlit/models/model_provider.py +27 -43
  74. beamlit/models/model_spec.py +45 -32
  75. beamlit/models/owner_fields.py +4 -2
  76. beamlit/models/pending_invitation.py +14 -14
  77. beamlit/models/pod_template_spec.py +4 -2
  78. beamlit/models/policy.py +33 -159
  79. beamlit/models/policy_spec.py +24 -28
  80. beamlit/models/private_cluster.py +183 -0
  81. beamlit/models/{model_provider_ref.py → private_location.py} +7 -16
  82. beamlit/models/resource_deployment_metrics.py +0 -108
  83. beamlit/models/resource_environment_metrics.py +143 -71
  84. beamlit/models/{resource_deployment_metrics_inference_per_region.py → resource_environment_metrics_inference_per_region.py} +5 -5
  85. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +9 -11
  86. beamlit/models/{resource_deployment_metrics_query_per_region_per_code.py → resource_environment_metrics_query_per_region_per_code.py} +5 -5
  87. beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
  88. beamlit/models/resource_log.py +4 -2
  89. beamlit/models/runtime.py +20 -2
  90. beamlit/models/serverless_config.py +28 -21
  91. beamlit/models/spec_configuration.py +7 -5
  92. beamlit/models/store_agent.py +14 -14
  93. beamlit/models/store_function.py +14 -14
  94. beamlit/models/time_fields.py +4 -2
  95. beamlit/models/websocket_channel.py +4 -2
  96. beamlit/models/workspace.py +23 -14
  97. beamlit/run.py +0 -1
  98. beamlit/serve/app.py +1 -0
  99. beamlit/serve/middlewares/accesslog.py +3 -1
  100. {beamlit-0.0.24rc19.dist-info → beamlit-0.0.24rc21.dist-info}/METADATA +1 -1
  101. beamlit-0.0.24rc21.dist-info/RECORD +243 -0
  102. beamlit/api/agents/delete_agent_deployment.py +0 -163
  103. beamlit/api/agents/delete_agent_deployment_history.py +0 -172
  104. beamlit/api/agents/get_agent_deployment_history.py +0 -172
  105. beamlit/api/agents/get_agent_deployment_logs.py +0 -164
  106. beamlit/api/agents/list_agent_deployment_history.py +0 -164
  107. beamlit/api/agents/put_agent_deployment.py +0 -185
  108. beamlit/api/agents/put_agent_deployment_history.py +0 -198
  109. beamlit/api/functions/delete_function_deployment.py +0 -163
  110. beamlit/api/functions/get_function_deployment.py +0 -163
  111. beamlit/api/functions/get_function_deployment_logs.py +0 -164
  112. beamlit/api/functions/get_function_deployment_metrics.py +0 -159
  113. beamlit/api/functions/put_function_deployment.py +0 -185
  114. beamlit/api/models/delete_model_deployment.py +0 -171
  115. beamlit/api/models/get_model_deployment.py +0 -171
  116. beamlit/api/models/get_model_deployment_logs.py +0 -168
  117. beamlit/api/models/get_model_deployment_metrics.py +0 -163
  118. beamlit/api/models/put_model_deployment.py +0 -193
  119. beamlit/models/agent_configuration.py +0 -70
  120. beamlit/models/agent_deployment.py +0 -340
  121. beamlit/models/agent_deployment_configuration.py +0 -45
  122. beamlit/models/agent_deployment_configuration_type_0.py +0 -43
  123. beamlit/models/agent_deployment_history.py +0 -185
  124. beamlit/models/agent_deployment_history_event.py +0 -133
  125. beamlit/models/agent_deployment_pod_template.py +0 -45
  126. beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
  127. beamlit/models/agent_with_deployments.py +0 -176
  128. beamlit/models/authentication_provider_model.py +0 -144
  129. beamlit/models/authentication_provider_organization.py +0 -88
  130. beamlit/models/deployment_configuration.py +0 -70
  131. beamlit/models/deployment_configurations.py +0 -58
  132. beamlit/models/deployment_serverless_config.py +0 -131
  133. beamlit/models/deployment_serverless_config_type_0.py +0 -220
  134. beamlit/models/function_configuration.py +0 -70
  135. beamlit/models/function_deployment.py +0 -340
  136. beamlit/models/function_deployment_configuration.py +0 -45
  137. beamlit/models/function_deployment_configuration_type_0.py +0 -43
  138. beamlit/models/function_deployment_pod_template.py +0 -45
  139. beamlit/models/function_deployment_pod_template_type_0.py +0 -43
  140. beamlit/models/function_with_deployments.py +0 -176
  141. beamlit/models/integration.py +0 -198
  142. beamlit/models/integration_config.py +0 -45
  143. beamlit/models/integration_secret.py +0 -61
  144. beamlit/models/labels_type_0.py +0 -45
  145. beamlit/models/location.py +0 -122
  146. beamlit/models/model_deployment.py +0 -296
  147. beamlit/models/model_deployment_log.py +0 -70
  148. beamlit/models/model_deployment_metrics.py +0 -172
  149. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +0 -77
  150. beamlit/models/model_deployment_pod_template.py +0 -45
  151. beamlit/models/model_deployment_pod_template_type_0.py +0 -43
  152. beamlit/models/model_metrics.py +0 -96
  153. beamlit/models/model_with_deployments.py +0 -176
  154. beamlit/models/resource_deployment_log.py +0 -70
  155. beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
  156. beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
  157. beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
  158. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
  159. beamlit/models/runtime_readiness_probe_type_0.py +0 -43
  160. beamlit/models/runtime_type_0.py +0 -111
  161. beamlit/models/runtime_type_0_readiness_probe.py +0 -43
  162. beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
  163. beamlit/models/runtime_type_0_resources.py +0 -59
  164. beamlit/models/standard_fields_dynamo_db.py +0 -88
  165. beamlit/models/store_agent_configuration.py +0 -97
  166. beamlit/models/store_agent_labels_type_0.py +0 -43
  167. beamlit/models/store_function_configuration.py +0 -97
  168. beamlit/models/store_function_labels_type_0.py +0 -43
  169. beamlit-0.0.24rc19.dist-info/RECORD +0 -303
  170. {beamlit-0.0.24rc19.dist-info → beamlit-0.0.24rc21.dist-info}/WHEEL +0 -0
@@ -0,0 +1,97 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response
9
+
10
+
11
+ def _get_kwargs(
12
+ private_cluster_name: str,
13
+ ) -> dict[str, Any]:
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "get",
16
+ "url": f"/privateclusters/{private_cluster_name}/health",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
23
+ if response.status_code == 200:
24
+ return None
25
+ if response.status_code == 401:
26
+ return None
27
+ if response.status_code == 403:
28
+ return None
29
+ if client.raise_on_unexpected_status:
30
+ raise errors.UnexpectedStatus(response.status_code, response.content)
31
+ else:
32
+ return None
33
+
34
+
35
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
36
+ return Response(
37
+ status_code=HTTPStatus(response.status_code),
38
+ content=response.content,
39
+ headers=response.headers,
40
+ parsed=_parse_response(client=client, response=response),
41
+ )
42
+
43
+
44
+ def sync_detailed(
45
+ private_cluster_name: str,
46
+ *,
47
+ client: Union[AuthenticatedClient, Client],
48
+ ) -> Response[Any]:
49
+ """Get private cluster health
50
+
51
+ Args:
52
+ private_cluster_name (str):
53
+
54
+ Raises:
55
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
56
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
57
+
58
+ Returns:
59
+ Response[Any]
60
+ """
61
+
62
+ kwargs = _get_kwargs(
63
+ private_cluster_name=private_cluster_name,
64
+ )
65
+
66
+ response = client.get_httpx_client().request(
67
+ **kwargs,
68
+ )
69
+
70
+ return _build_response(client=client, response=response)
71
+
72
+
73
+ async def asyncio_detailed(
74
+ private_cluster_name: str,
75
+ *,
76
+ client: Union[AuthenticatedClient, Client],
77
+ ) -> Response[Any]:
78
+ """Get private cluster health
79
+
80
+ Args:
81
+ private_cluster_name (str):
82
+
83
+ Raises:
84
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
86
+
87
+ Returns:
88
+ Response[Any]
89
+ """
90
+
91
+ kwargs = _get_kwargs(
92
+ private_cluster_name=private_cluster_name,
93
+ )
94
+
95
+ response = await client.get_async_httpx_client().request(**kwargs)
96
+
97
+ return _build_response(client=client, response=response)
@@ -1,20 +1,18 @@
1
1
  from http import HTTPStatus
2
- from typing import Any, Optional, Union
2
+ from typing import Any, Optional, Union, cast
3
3
 
4
4
  import httpx
5
5
 
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
- from ...models.agent_deployment import AgentDeployment
8
+ from ...models.private_cluster import PrivateCluster
9
9
  from ...types import Response
10
10
 
11
11
 
12
- def _get_kwargs(
13
- agent_name: str,
14
- ) -> dict[str, Any]:
12
+ def _get_kwargs() -> dict[str, Any]:
15
13
  _kwargs: dict[str, Any] = {
16
14
  "method": "get",
17
- "url": f"/agents/{agent_name}/deployments",
15
+ "url": "/privateclusters",
18
16
  }
19
17
 
20
18
  return _kwargs
@@ -22,16 +20,25 @@ def _get_kwargs(
22
20
 
23
21
  def _parse_response(
24
22
  *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25
- ) -> Optional[list["AgentDeployment"]]:
23
+ ) -> Optional[Union[Any, list["PrivateCluster"]]]:
26
24
  if response.status_code == 200:
27
25
  response_200 = []
28
26
  _response_200 = response.json()
29
27
  for response_200_item_data in _response_200:
30
- response_200_item = AgentDeployment.from_dict(response_200_item_data)
28
+ response_200_item = PrivateCluster.from_dict(response_200_item_data)
31
29
 
32
30
  response_200.append(response_200_item)
33
31
 
34
32
  return response_200
33
+ if response.status_code == 401:
34
+ response_401 = cast(Any, None)
35
+ return response_401
36
+ if response.status_code == 403:
37
+ response_403 = cast(Any, None)
38
+ return response_403
39
+ if response.status_code == 404:
40
+ response_404 = cast(Any, None)
41
+ return response_404
35
42
  if client.raise_on_unexpected_status:
36
43
  raise errors.UnexpectedStatus(response.status_code, response.content)
37
44
  else:
@@ -40,7 +47,7 @@ def _parse_response(
40
47
 
41
48
  def _build_response(
42
49
  *, client: Union[AuthenticatedClient, Client], response: httpx.Response
43
- ) -> Response[list["AgentDeployment"]]:
50
+ ) -> Response[Union[Any, list["PrivateCluster"]]]:
44
51
  return Response(
45
52
  status_code=HTTPStatus(response.status_code),
46
53
  content=response.content,
@@ -50,26 +57,20 @@ def _build_response(
50
57
 
51
58
 
52
59
  def sync_detailed(
53
- agent_name: str,
54
60
  *,
55
61
  client: AuthenticatedClient,
56
- ) -> Response[list["AgentDeployment"]]:
57
- """List all agent deployments
58
-
59
- Args:
60
- agent_name (str):
62
+ ) -> Response[Union[Any, list["PrivateCluster"]]]:
63
+ """List all private clusters
61
64
 
62
65
  Raises:
63
66
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
64
67
  httpx.TimeoutException: If the request takes longer than Client.timeout.
65
68
 
66
69
  Returns:
67
- Response[list['AgentDeployment']]
70
+ Response[Union[Any, list['PrivateCluster']]]
68
71
  """
69
72
 
70
- kwargs = _get_kwargs(
71
- agent_name=agent_name,
72
- )
73
+ kwargs = _get_kwargs()
73
74
 
74
75
  response = client.get_httpx_client().request(
75
76
  **kwargs,
@@ -79,50 +80,39 @@ def sync_detailed(
79
80
 
80
81
 
81
82
  def sync(
82
- agent_name: str,
83
83
  *,
84
84
  client: AuthenticatedClient,
85
- ) -> Optional[list["AgentDeployment"]]:
86
- """List all agent deployments
87
-
88
- Args:
89
- agent_name (str):
85
+ ) -> Optional[Union[Any, list["PrivateCluster"]]]:
86
+ """List all private clusters
90
87
 
91
88
  Raises:
92
89
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
93
90
  httpx.TimeoutException: If the request takes longer than Client.timeout.
94
91
 
95
92
  Returns:
96
- list['AgentDeployment']
93
+ Union[Any, list['PrivateCluster']]
97
94
  """
98
95
 
99
96
  return sync_detailed(
100
- agent_name=agent_name,
101
97
  client=client,
102
98
  ).parsed
103
99
 
104
100
 
105
101
  async def asyncio_detailed(
106
- agent_name: str,
107
102
  *,
108
103
  client: AuthenticatedClient,
109
- ) -> Response[list["AgentDeployment"]]:
110
- """List all agent deployments
111
-
112
- Args:
113
- agent_name (str):
104
+ ) -> Response[Union[Any, list["PrivateCluster"]]]:
105
+ """List all private clusters
114
106
 
115
107
  Raises:
116
108
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
117
109
  httpx.TimeoutException: If the request takes longer than Client.timeout.
118
110
 
119
111
  Returns:
120
- Response[list['AgentDeployment']]
112
+ Response[Union[Any, list['PrivateCluster']]]
121
113
  """
122
114
 
123
- kwargs = _get_kwargs(
124
- agent_name=agent_name,
125
- )
115
+ kwargs = _get_kwargs()
126
116
 
127
117
  response = await client.get_async_httpx_client().request(**kwargs)
128
118
 
@@ -130,26 +120,21 @@ async def asyncio_detailed(
130
120
 
131
121
 
132
122
  async def asyncio(
133
- agent_name: str,
134
123
  *,
135
124
  client: AuthenticatedClient,
136
- ) -> Optional[list["AgentDeployment"]]:
137
- """List all agent deployments
138
-
139
- Args:
140
- agent_name (str):
125
+ ) -> Optional[Union[Any, list["PrivateCluster"]]]:
126
+ """List all private clusters
141
127
 
142
128
  Raises:
143
129
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144
130
  httpx.TimeoutException: If the request takes longer than Client.timeout.
145
131
 
146
132
  Returns:
147
- list['AgentDeployment']
133
+ Union[Any, list['PrivateCluster']]
148
134
  """
149
135
 
150
136
  return (
151
137
  await asyncio_detailed(
152
- agent_name=agent_name,
153
138
  client=client,
154
139
  )
155
140
  ).parsed
@@ -1,20 +1,20 @@
1
1
  from http import HTTPStatus
2
- from typing import Any, Optional, Union
2
+ from typing import Any, Optional, Union, cast
3
3
 
4
4
  import httpx
5
5
 
6
6
  from ... import errors
7
7
  from ...client import AuthenticatedClient, Client
8
- from ...models.model_deployment import ModelDeployment
8
+ from ...models.private_cluster import PrivateCluster
9
9
  from ...types import Response
10
10
 
11
11
 
12
12
  def _get_kwargs(
13
- model_name: str,
13
+ private_cluster_name: str,
14
14
  ) -> dict[str, Any]:
15
15
  _kwargs: dict[str, Any] = {
16
- "method": "get",
17
- "url": f"/models/{model_name}/deployments",
16
+ "method": "put",
17
+ "url": f"/privateclusters/{private_cluster_name}",
18
18
  }
19
19
 
20
20
  return _kwargs
@@ -22,16 +22,17 @@ def _get_kwargs(
22
22
 
23
23
  def _parse_response(
24
24
  *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25
- ) -> Optional[list["ModelDeployment"]]:
25
+ ) -> Optional[Union[Any, PrivateCluster]]:
26
26
  if response.status_code == 200:
27
- response_200 = []
28
- _response_200 = response.json()
29
- for response_200_item_data in _response_200:
30
- response_200_item = ModelDeployment.from_dict(response_200_item_data)
31
-
32
- response_200.append(response_200_item)
27
+ response_200 = PrivateCluster.from_dict(response.json())
33
28
 
34
29
  return response_200
30
+ if response.status_code == 401:
31
+ response_401 = cast(Any, None)
32
+ return response_401
33
+ if response.status_code == 403:
34
+ response_403 = cast(Any, None)
35
+ return response_403
35
36
  if client.raise_on_unexpected_status:
36
37
  raise errors.UnexpectedStatus(response.status_code, response.content)
37
38
  else:
@@ -40,7 +41,7 @@ def _parse_response(
40
41
 
41
42
  def _build_response(
42
43
  *, client: Union[AuthenticatedClient, Client], response: httpx.Response
43
- ) -> Response[list["ModelDeployment"]]:
44
+ ) -> Response[Union[Any, PrivateCluster]]:
44
45
  return Response(
45
46
  status_code=HTTPStatus(response.status_code),
46
47
  content=response.content,
@@ -50,27 +51,25 @@ def _build_response(
50
51
 
51
52
 
52
53
  def sync_detailed(
53
- model_name: str,
54
+ private_cluster_name: str,
54
55
  *,
55
56
  client: AuthenticatedClient,
56
- ) -> Response[list["ModelDeployment"]]:
57
- """List model deployments
58
-
59
- Returns a list of all deployments for a model.
57
+ ) -> Response[Union[Any, PrivateCluster]]:
58
+ """Update private cluster
60
59
 
61
60
  Args:
62
- model_name (str):
61
+ private_cluster_name (str):
63
62
 
64
63
  Raises:
65
64
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
66
65
  httpx.TimeoutException: If the request takes longer than Client.timeout.
67
66
 
68
67
  Returns:
69
- Response[list['ModelDeployment']]
68
+ Response[Union[Any, PrivateCluster]]
70
69
  """
71
70
 
72
71
  kwargs = _get_kwargs(
73
- model_name=model_name,
72
+ private_cluster_name=private_cluster_name,
74
73
  )
75
74
 
76
75
  response = client.get_httpx_client().request(
@@ -81,53 +80,49 @@ def sync_detailed(
81
80
 
82
81
 
83
82
  def sync(
84
- model_name: str,
83
+ private_cluster_name: str,
85
84
  *,
86
85
  client: AuthenticatedClient,
87
- ) -> Optional[list["ModelDeployment"]]:
88
- """List model deployments
89
-
90
- Returns a list of all deployments for a model.
86
+ ) -> Optional[Union[Any, PrivateCluster]]:
87
+ """Update private cluster
91
88
 
92
89
  Args:
93
- model_name (str):
90
+ private_cluster_name (str):
94
91
 
95
92
  Raises:
96
93
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
94
  httpx.TimeoutException: If the request takes longer than Client.timeout.
98
95
 
99
96
  Returns:
100
- list['ModelDeployment']
97
+ Union[Any, PrivateCluster]
101
98
  """
102
99
 
103
100
  return sync_detailed(
104
- model_name=model_name,
101
+ private_cluster_name=private_cluster_name,
105
102
  client=client,
106
103
  ).parsed
107
104
 
108
105
 
109
106
  async def asyncio_detailed(
110
- model_name: str,
107
+ private_cluster_name: str,
111
108
  *,
112
109
  client: AuthenticatedClient,
113
- ) -> Response[list["ModelDeployment"]]:
114
- """List model deployments
115
-
116
- Returns a list of all deployments for a model.
110
+ ) -> Response[Union[Any, PrivateCluster]]:
111
+ """Update private cluster
117
112
 
118
113
  Args:
119
- model_name (str):
114
+ private_cluster_name (str):
120
115
 
121
116
  Raises:
122
117
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
123
118
  httpx.TimeoutException: If the request takes longer than Client.timeout.
124
119
 
125
120
  Returns:
126
- Response[list['ModelDeployment']]
121
+ Response[Union[Any, PrivateCluster]]
127
122
  """
128
123
 
129
124
  kwargs = _get_kwargs(
130
- model_name=model_name,
125
+ private_cluster_name=private_cluster_name,
131
126
  )
132
127
 
133
128
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -136,28 +131,26 @@ async def asyncio_detailed(
136
131
 
137
132
 
138
133
  async def asyncio(
139
- model_name: str,
134
+ private_cluster_name: str,
140
135
  *,
141
136
  client: AuthenticatedClient,
142
- ) -> Optional[list["ModelDeployment"]]:
143
- """List model deployments
144
-
145
- Returns a list of all deployments for a model.
137
+ ) -> Optional[Union[Any, PrivateCluster]]:
138
+ """Update private cluster
146
139
 
147
140
  Args:
148
- model_name (str):
141
+ private_cluster_name (str):
149
142
 
150
143
  Raises:
151
144
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
152
145
  httpx.TimeoutException: If the request takes longer than Client.timeout.
153
146
 
154
147
  Returns:
155
- list['ModelDeployment']
148
+ Union[Any, PrivateCluster]
156
149
  """
157
150
 
158
151
  return (
159
152
  await asyncio_detailed(
160
- model_name=model_name,
153
+ private_cluster_name=private_cluster_name,
161
154
  client=client,
162
155
  )
163
156
  ).parsed
@@ -0,0 +1,97 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response
9
+
10
+
11
+ def _get_kwargs(
12
+ private_cluster_name: str,
13
+ ) -> dict[str, Any]:
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "post",
16
+ "url": f"/privateclusters/{private_cluster_name}/health",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
23
+ if response.status_code == 200:
24
+ return None
25
+ if response.status_code == 401:
26
+ return None
27
+ if response.status_code == 403:
28
+ return None
29
+ if client.raise_on_unexpected_status:
30
+ raise errors.UnexpectedStatus(response.status_code, response.content)
31
+ else:
32
+ return None
33
+
34
+
35
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
36
+ return Response(
37
+ status_code=HTTPStatus(response.status_code),
38
+ content=response.content,
39
+ headers=response.headers,
40
+ parsed=_parse_response(client=client, response=response),
41
+ )
42
+
43
+
44
+ def sync_detailed(
45
+ private_cluster_name: str,
46
+ *,
47
+ client: Union[AuthenticatedClient, Client],
48
+ ) -> Response[Any]:
49
+ """Update private cluster health
50
+
51
+ Args:
52
+ private_cluster_name (str):
53
+
54
+ Raises:
55
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
56
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
57
+
58
+ Returns:
59
+ Response[Any]
60
+ """
61
+
62
+ kwargs = _get_kwargs(
63
+ private_cluster_name=private_cluster_name,
64
+ )
65
+
66
+ response = client.get_httpx_client().request(
67
+ **kwargs,
68
+ )
69
+
70
+ return _build_response(client=client, response=response)
71
+
72
+
73
+ async def asyncio_detailed(
74
+ private_cluster_name: str,
75
+ *,
76
+ client: Union[AuthenticatedClient, Client],
77
+ ) -> Response[Any]:
78
+ """Update private cluster health
79
+
80
+ Args:
81
+ private_cluster_name (str):
82
+
83
+ Raises:
84
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
86
+
87
+ Returns:
88
+ Response[Any]
89
+ """
90
+
91
+ kwargs = _get_kwargs(
92
+ private_cluster_name=private_cluster_name,
93
+ )
94
+
95
+ response = await client.get_async_httpx_client().request(**kwargs)
96
+
97
+ return _build_response(client=client, response=response)
@@ -61,9 +61,7 @@ class BearerToken(Auth):
61
61
  return Exception("Invalid JWT token format")
62
62
 
63
63
  try:
64
- claims_bytes = base64.urlsafe_b64decode(
65
- parts[1] + "=" * (-len(parts[1]) % 4)
66
- )
64
+ claims_bytes = base64.urlsafe_b64decode(parts[1] + "=" * (-len(parts[1]) % 4))
67
65
  claims = json.loads(claims_bytes)
68
66
  except Exception as e:
69
67
  return Exception(f"Failed to decode/parse JWT claims: {str(e)}")
@@ -80,9 +78,7 @@ class BearerToken(Auth):
80
78
  if err:
81
79
  return err
82
80
 
83
- request.headers["X-Beamlit-Authorization"] = (
84
- f"Bearer {self.credentials.access_token}"
85
- )
81
+ request.headers["X-Beamlit-Authorization"] = f"Bearer {self.credentials.access_token}"
86
82
  request.headers["X-Beamlit-Workspace"] = self.workspace_name
87
83
  yield request
88
84
 
@@ -99,9 +95,7 @@ class BearerToken(Auth):
99
95
  }
100
96
 
101
97
  try:
102
- response = post(
103
- url, json=refresh_data, headers={"Content-Type": "application/json"}
104
- )
98
+ response = post(url, json=refresh_data, headers={"Content-Type": "application/json"})
105
99
  response.raise_for_status()
106
100
  finalize_response = DeviceLoginFinalizeResponse(**response.json())
107
101