beamlit 0.1.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. beamlit/__init__.py +8 -0
  2. beamlit/api/__init__.py +1 -0
  3. beamlit/api/agents/__init__.py +0 -0
  4. beamlit/api/agents/create_agent.py +155 -0
  5. beamlit/api/agents/create_agent_release.py +146 -0
  6. beamlit/api/agents/delete_agent.py +146 -0
  7. beamlit/api/agents/delete_agent_deployment.py +163 -0
  8. beamlit/api/agents/delete_agent_deployment_history.py +172 -0
  9. beamlit/api/agents/get_agent.py +146 -0
  10. beamlit/api/agents/get_agent_deployment.py +163 -0
  11. beamlit/api/agents/get_agent_deployment_history.py +172 -0
  12. beamlit/api/agents/get_agent_deployment_logs.py +164 -0
  13. beamlit/api/agents/get_agent_deployment_metrics.py +159 -0
  14. beamlit/api/agents/get_agent_metrics.py +150 -0
  15. beamlit/api/agents/list_agent_deployment_history.py +164 -0
  16. beamlit/api/agents/list_agent_deployments.py +155 -0
  17. beamlit/api/agents/list_agents.py +127 -0
  18. beamlit/api/agents/put_agent_deployment.py +185 -0
  19. beamlit/api/agents/put_agent_deployment_history.py +198 -0
  20. beamlit/api/agents/update_agent.py +168 -0
  21. beamlit/api/authentication_providers/__init__.py +0 -0
  22. beamlit/api/authentication_providers/get_model_with_repo_for_authentication_provider.py +184 -0
  23. beamlit/api/authentication_providers/list_models_for_authentication_provider.py +163 -0
  24. beamlit/api/authentication_providers/list_organizations_for_authentication_provider.py +163 -0
  25. beamlit/api/configurations/__init__.py +0 -0
  26. beamlit/api/configurations/get_configuration.py +122 -0
  27. beamlit/api/environments/__init__.py +0 -0
  28. beamlit/api/environments/create_environment.py +167 -0
  29. beamlit/api/environments/delete_environment.py +154 -0
  30. beamlit/api/environments/get_environment.py +154 -0
  31. beamlit/api/environments/get_environment_metrics.py +158 -0
  32. beamlit/api/environments/list_environments.py +139 -0
  33. beamlit/api/environments/update_environment.py +180 -0
  34. beamlit/api/functions/__init__.py +0 -0
  35. beamlit/api/functions/create_function.py +155 -0
  36. beamlit/api/functions/create_function_release.py +150 -0
  37. beamlit/api/functions/delete_function.py +146 -0
  38. beamlit/api/functions/delete_function_deployment.py +163 -0
  39. beamlit/api/functions/get_function.py +146 -0
  40. beamlit/api/functions/get_function_deployment.py +163 -0
  41. beamlit/api/functions/get_function_deployment_logs.py +164 -0
  42. beamlit/api/functions/get_function_deployment_metrics.py +159 -0
  43. beamlit/api/functions/get_function_metrics.py +150 -0
  44. beamlit/api/functions/list_function_deployments.py +155 -0
  45. beamlit/api/functions/list_functions.py +131 -0
  46. beamlit/api/functions/put_function_deployment.py +185 -0
  47. beamlit/api/functions/update_function.py +168 -0
  48. beamlit/api/history/__init__.py +0 -0
  49. beamlit/api/history/get_agents_history.py +155 -0
  50. beamlit/api/history/list_agents_history.py +131 -0
  51. beamlit/api/invitations/__init__.py +0 -0
  52. beamlit/api/invitations/list_all_pending_invitations.py +142 -0
  53. beamlit/api/locations/__init__.py +0 -0
  54. beamlit/api/locations/list_locations.py +139 -0
  55. beamlit/api/metrics/__init__.py +0 -0
  56. beamlit/api/metrics/get_metrics.py +130 -0
  57. beamlit/api/model_providers/__init__.py +0 -0
  58. beamlit/api/model_providers/create_model_provider.py +163 -0
  59. beamlit/api/model_providers/delete_model_provider.py +154 -0
  60. beamlit/api/model_providers/get_model_provider.py +154 -0
  61. beamlit/api/model_providers/list_model_providers.py +139 -0
  62. beamlit/api/model_providers/update_model_provider.py +176 -0
  63. beamlit/api/models/__init__.py +0 -0
  64. beamlit/api/models/create_model.py +168 -0
  65. beamlit/api/models/delete_model.py +154 -0
  66. beamlit/api/models/delete_model_deployment.py +171 -0
  67. beamlit/api/models/get_model.py +154 -0
  68. beamlit/api/models/get_model_deployment.py +171 -0
  69. beamlit/api/models/get_model_deployment_logs.py +168 -0
  70. beamlit/api/models/get_model_deployment_metrics.py +163 -0
  71. beamlit/api/models/get_model_metrics.py +154 -0
  72. beamlit/api/models/list_model_deployments.py +163 -0
  73. beamlit/api/models/list_models.py +135 -0
  74. beamlit/api/models/put_model_deployment.py +193 -0
  75. beamlit/api/models/release_model.py +154 -0
  76. beamlit/api/models/update_model.py +181 -0
  77. beamlit/api/policies/__init__.py +0 -0
  78. beamlit/api/policies/create_policy.py +167 -0
  79. beamlit/api/policies/delete_policy.py +154 -0
  80. beamlit/api/policies/get_policy.py +154 -0
  81. beamlit/api/policies/list_policies.py +139 -0
  82. beamlit/api/policies/update_policy.py +180 -0
  83. beamlit/api/service_accounts/__init__.py +0 -0
  84. beamlit/api/service_accounts/create_api_key_for_service_account.py +177 -0
  85. beamlit/api/service_accounts/create_workspace_service_account.py +168 -0
  86. beamlit/api/service_accounts/delete_api_key_for_service_account.py +104 -0
  87. beamlit/api/service_accounts/delete_workspace_service_account.py +158 -0
  88. beamlit/api/service_accounts/get_workspace_service_accounts.py +139 -0
  89. beamlit/api/service_accounts/list_api_keys_for_service_account.py +163 -0
  90. beamlit/api/service_accounts/update_workspace_service_account.py +181 -0
  91. beamlit/api/store/__init__.py +0 -0
  92. beamlit/api/store/get_store_agent.py +146 -0
  93. beamlit/api/store/get_store_function.py +146 -0
  94. beamlit/api/store/list_store_agents.py +131 -0
  95. beamlit/api/store/list_store_functions.py +131 -0
  96. beamlit/api/workspaces/__init__.py +0 -0
  97. beamlit/api/workspaces/accept_workspace_invitation.py +161 -0
  98. beamlit/api/workspaces/create_worspace.py +163 -0
  99. beamlit/api/workspaces/decline_workspace_invitation.py +158 -0
  100. beamlit/api/workspaces/delete_workspace.py +154 -0
  101. beamlit/api/workspaces/get_workspace.py +154 -0
  102. beamlit/api/workspaces/invite_workspace_user.py +174 -0
  103. beamlit/api/workspaces/leave_workspace.py +161 -0
  104. beamlit/api/workspaces/list_workspace_users.py +139 -0
  105. beamlit/api/workspaces/list_workspaces.py +139 -0
  106. beamlit/api/workspaces/remove_workspace_user.py +101 -0
  107. beamlit/api/workspaces/update_workspace.py +176 -0
  108. beamlit/api/workspaces/update_workspace_user_role.py +187 -0
  109. beamlit/authentication/__init__.py +24 -0
  110. beamlit/authentication/apikey.py +14 -0
  111. beamlit/authentication/authentication.py +35 -0
  112. beamlit/authentication/credentials.py +165 -0
  113. beamlit/authentication/device_mode.py +115 -0
  114. beamlit/client.py +270 -0
  115. beamlit/errors.py +16 -0
  116. beamlit/models/__init__.py +189 -0
  117. beamlit/models/acl.py +149 -0
  118. beamlit/models/agent.py +151 -0
  119. beamlit/models/agent_chain.py +77 -0
  120. beamlit/models/agent_configuration.py +68 -0
  121. beamlit/models/agent_deployment.py +327 -0
  122. beamlit/models/agent_deployment_configuration.py +43 -0
  123. beamlit/models/agent_deployment_history.py +183 -0
  124. beamlit/models/agent_deployment_history_event.py +131 -0
  125. beamlit/models/agent_deployment_pod_template.py +43 -0
  126. beamlit/models/agent_release.py +68 -0
  127. beamlit/models/api_key.py +140 -0
  128. beamlit/models/authentication_provider_model.py +142 -0
  129. beamlit/models/authentication_provider_organization.py +86 -0
  130. beamlit/models/configuration.py +72 -0
  131. beamlit/models/continent.py +68 -0
  132. beamlit/models/country.py +68 -0
  133. beamlit/models/create_api_key_for_service_account_body.py +67 -0
  134. beamlit/models/create_workspace_service_account_body.py +69 -0
  135. beamlit/models/create_workspace_service_account_response_200.py +103 -0
  136. beamlit/models/delete_workspace_service_account_response_200.py +94 -0
  137. beamlit/models/deployment_configuration.py +68 -0
  138. beamlit/models/deployment_configurations.py +43 -0
  139. beamlit/models/deployment_serverless_config.py +129 -0
  140. beamlit/models/environment.py +162 -0
  141. beamlit/models/environment_metrics.py +75 -0
  142. beamlit/models/flavor.py +68 -0
  143. beamlit/models/function.py +151 -0
  144. beamlit/models/function_configuration.py +68 -0
  145. beamlit/models/function_deployment.py +327 -0
  146. beamlit/models/function_deployment_configuration.py +43 -0
  147. beamlit/models/function_deployment_pod_template.py +43 -0
  148. beamlit/models/function_kit.py +95 -0
  149. beamlit/models/function_provider_ref.py +68 -0
  150. beamlit/models/function_release.py +68 -0
  151. beamlit/models/get_workspace_service_accounts_response_200_item.py +94 -0
  152. beamlit/models/invite_workspace_user_body.py +58 -0
  153. beamlit/models/labels.py +43 -0
  154. beamlit/models/labels_type_0.py +43 -0
  155. beamlit/models/location.py +120 -0
  156. beamlit/models/location_response.py +111 -0
  157. beamlit/models/metric.py +68 -0
  158. beamlit/models/metrics.py +111 -0
  159. beamlit/models/model.py +151 -0
  160. beamlit/models/model_deployment.py +283 -0
  161. beamlit/models/model_deployment_log.py +68 -0
  162. beamlit/models/model_deployment_metrics.py +170 -0
  163. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +75 -0
  164. beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +73 -0
  165. beamlit/models/model_deployment_pod_template.py +43 -0
  166. beamlit/models/model_metrics.py +94 -0
  167. beamlit/models/model_provider.py +187 -0
  168. beamlit/models/model_provider_ref.py +68 -0
  169. beamlit/models/model_release.py +68 -0
  170. beamlit/models/model_with_deployments.py +174 -0
  171. beamlit/models/pending_invitation.py +122 -0
  172. beamlit/models/pending_invitation_accept.py +81 -0
  173. beamlit/models/pending_invitation_render.py +135 -0
  174. beamlit/models/pending_invitation_render_invited_by.py +86 -0
  175. beamlit/models/pending_invitation_render_workspace.py +68 -0
  176. beamlit/models/pending_invitation_workspace_details.py +70 -0
  177. beamlit/models/policy.py +216 -0
  178. beamlit/models/policy_location.py +68 -0
  179. beamlit/models/provider_config.py +101 -0
  180. beamlit/models/qps.py +59 -0
  181. beamlit/models/resource_deployment_log.py +68 -0
  182. beamlit/models/resource_deployment_metrics.py +172 -0
  183. beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +75 -0
  184. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +73 -0
  185. beamlit/models/resource_metrics.py +94 -0
  186. beamlit/models/runtime.py +152 -0
  187. beamlit/models/runtime_readiness_probe.py +43 -0
  188. beamlit/models/runtime_resources.py +43 -0
  189. beamlit/models/serverless_config.py +122 -0
  190. beamlit/models/standard_fields_dynamo_db.py +86 -0
  191. beamlit/models/store_agent.py +165 -0
  192. beamlit/models/store_agent_configuration.py +95 -0
  193. beamlit/models/store_agent_labels.py +43 -0
  194. beamlit/models/store_configuration.py +149 -0
  195. beamlit/models/store_configuration_option.py +77 -0
  196. beamlit/models/store_function.py +207 -0
  197. beamlit/models/store_function_configuration.py +95 -0
  198. beamlit/models/store_function_kit.py +95 -0
  199. beamlit/models/store_function_labels.py +43 -0
  200. beamlit/models/store_function_parameter.py +86 -0
  201. beamlit/models/update_workspace_service_account_body.py +67 -0
  202. beamlit/models/update_workspace_service_account_response_200.py +94 -0
  203. beamlit/models/update_workspace_user_role_body.py +58 -0
  204. beamlit/models/workspace.py +126 -0
  205. beamlit/models/workspace_labels.py +43 -0
  206. beamlit/models/workspace_user.py +113 -0
  207. beamlit/py.typed +1 -0
  208. beamlit/types.py +46 -0
  209. beamlit-0.1.0.dist-info/METADATA +59 -0
  210. beamlit-0.1.0.dist-info/RECORD +211 -0
  211. beamlit-0.1.0.dist-info/WHEEL +4 -0
beamlit/client.py ADDED
@@ -0,0 +1,270 @@
1
+ import ssl
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+ from attrs import define, evolve, field
6
+
7
+
8
+ @define
9
+ class Client:
10
+ """A class for keeping track of data related to the API
11
+
12
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
13
+
14
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
15
+
16
+ ``cookies``: A dictionary of cookies to be sent with every request
17
+
18
+ ``headers``: A dictionary of headers to be sent with every request
19
+
20
+ ``provider``: An implementation of httpx.Auth to use for authentication
21
+
22
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
23
+ httpx.TimeoutException if this is exceeded.
24
+
25
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
26
+ but can be set to False for testing purposes.
27
+
28
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
29
+
30
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
31
+
32
+
33
+ Attributes:
34
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
35
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
36
+ argument to the constructor.
37
+
38
+ """
39
+
40
+ raise_on_unexpected_status: bool = field(default=True, kw_only=True)
41
+ _base_url: str = field(alias="base_url", default="https://api.beamlit.dev/v0")
42
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
43
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
44
+ _provider: httpx.Auth = field(default=None, alias="provider")
45
+ _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
46
+ _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
47
+ _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
48
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
49
+ _client: Optional[httpx.Client] = field(default=None, init=False)
50
+ _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
51
+
52
+ def with_headers(self, headers: dict[str, str]) -> "Client":
53
+ """Get a new client matching this one with additional headers"""
54
+ if self._client is not None:
55
+ self._client.headers.update(headers)
56
+ if self._async_client is not None:
57
+ self._async_client.headers.update(headers)
58
+ return evolve(self, headers={**self._headers, **headers})
59
+
60
+ def with_cookies(self, cookies: dict[str, str]) -> "Client":
61
+ """Get a new client matching this one with additional cookies"""
62
+ if self._client is not None:
63
+ self._client.cookies.update(cookies)
64
+ if self._async_client is not None:
65
+ self._async_client.cookies.update(cookies)
66
+ return evolve(self, cookies={**self._cookies, **cookies})
67
+
68
+ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
69
+ """Get a new client matching this one with a new timeout (in seconds)"""
70
+ if self._client is not None:
71
+ self._client.timeout = timeout
72
+ if self._async_client is not None:
73
+ self._async_client.timeout = timeout
74
+ return evolve(self, timeout=timeout)
75
+
76
+ def set_httpx_client(self, client: httpx.Client) -> "Client":
77
+ """Manually set the underlying httpx.Client
78
+
79
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
80
+ """
81
+ self._client = client
82
+ return self
83
+
84
+ def get_httpx_client(self) -> httpx.Client:
85
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
86
+ if self._client is None:
87
+ self._client = httpx.Client(
88
+ base_url=self._base_url,
89
+ cookies=self._cookies,
90
+ headers=self._headers,
91
+ timeout=self._timeout,
92
+ verify=self._verify_ssl,
93
+ follow_redirects=self._follow_redirects,
94
+ auth=self._provider,
95
+ **self._httpx_args,
96
+ )
97
+ return self._client
98
+
99
+ def __enter__(self) -> "Client":
100
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
101
+ self.get_httpx_client().__enter__()
102
+ return self
103
+
104
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
105
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
106
+ self.get_httpx_client().__exit__(*args, **kwargs)
107
+
108
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
109
+ """Manually the underlying httpx.AsyncClient
110
+
111
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
112
+ """
113
+ self._async_client = async_client
114
+ return self
115
+
116
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
117
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
118
+ if self._async_client is None:
119
+ self._async_client = httpx.AsyncClient(
120
+ base_url=self._base_url,
121
+ cookies=self._cookies,
122
+ headers=self._headers,
123
+ timeout=self._timeout,
124
+ verify=self._verify_ssl,
125
+ follow_redirects=self._follow_redirects,
126
+ **self._httpx_args,
127
+ )
128
+ return self._async_client
129
+
130
+ async def __aenter__(self) -> "Client":
131
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
132
+ await self.get_async_httpx_client().__aenter__()
133
+ return self
134
+
135
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
136
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
137
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
138
+
139
+
140
+ @define
141
+ class AuthenticatedClient:
142
+ """A Client which has been authenticated for use on secured endpoints
143
+
144
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
145
+
146
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
147
+
148
+ ``cookies``: A dictionary of cookies to be sent with every request
149
+
150
+ ``headers``: A dictionary of headers to be sent with every request
151
+
152
+ ``provider``: An implementation of httpx.Auth to use for authentication
153
+
154
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
155
+ httpx.TimeoutException if this is exceeded.
156
+
157
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
158
+ but can be set to False for testing purposes.
159
+
160
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
161
+
162
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
163
+
164
+
165
+ Attributes:
166
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
167
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
168
+ argument to the constructor.
169
+ provider: AuthProvider to use for authentication
170
+ """
171
+
172
+ raise_on_unexpected_status: bool = field(default=True, kw_only=True)
173
+ _base_url: str = field(alias="base_url", default="https://api.beamlit.dev/v0")
174
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
175
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
176
+ _provider: httpx.Auth = field(default=None, alias="provider")
177
+ _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
178
+ _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
179
+ _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
180
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
181
+ _client: Optional[httpx.Client] = field(default=None, init=False)
182
+ _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
183
+
184
+ def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
185
+ """Get a new client matching this one with additional headers"""
186
+ if self._client is not None:
187
+ self._client.headers.update(headers)
188
+ if self._async_client is not None:
189
+ self._async_client.headers.update(headers)
190
+ return evolve(self, headers={**self._headers, **headers})
191
+
192
+ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
193
+ """Get a new client matching this one with additional cookies"""
194
+ if self._client is not None:
195
+ self._client.cookies.update(cookies)
196
+ if self._async_client is not None:
197
+ self._async_client.cookies.update(cookies)
198
+ return evolve(self, cookies={**self._cookies, **cookies})
199
+
200
+ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
201
+ """Get a new client matching this one with a new timeout (in seconds)"""
202
+ if self._client is not None:
203
+ self._client.timeout = timeout
204
+ if self._async_client is not None:
205
+ self._async_client.timeout = timeout
206
+ return evolve(self, timeout=timeout)
207
+
208
+ def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
209
+ """Manually set the underlying httpx.Client
210
+
211
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
212
+ """
213
+ self._client = client
214
+ return self
215
+
216
+ def get_httpx_client(self) -> httpx.Client:
217
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
218
+ if self._client is None:
219
+ self._client = httpx.Client(
220
+ base_url=self._base_url,
221
+ cookies=self._cookies,
222
+ headers=self._headers,
223
+ timeout=self._timeout,
224
+ verify=self._verify_ssl,
225
+ follow_redirects=self._follow_redirects,
226
+ auth=self._provider,
227
+ **self._httpx_args,
228
+ )
229
+ return self._client
230
+
231
+ def __enter__(self) -> "AuthenticatedClient":
232
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
233
+ self.get_httpx_client().__enter__()
234
+ return self
235
+
236
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
237
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
238
+ self.get_httpx_client().__exit__(*args, **kwargs)
239
+
240
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
241
+ """Manually the underlying httpx.AsyncClient
242
+
243
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
244
+ """
245
+ self._async_client = async_client
246
+ return self
247
+
248
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
249
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
250
+ if self._async_client is None:
251
+ self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
252
+ self._async_client = httpx.AsyncClient(
253
+ base_url=self._base_url,
254
+ cookies=self._cookies,
255
+ headers=self._headers,
256
+ timeout=self._timeout,
257
+ verify=self._verify_ssl,
258
+ follow_redirects=self._follow_redirects,
259
+ **self._httpx_args,
260
+ )
261
+ return self._async_client
262
+
263
+ async def __aenter__(self) -> "AuthenticatedClient":
264
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
265
+ await self.get_async_httpx_client().__aenter__()
266
+ return self
267
+
268
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
269
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
270
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
beamlit/errors.py ADDED
@@ -0,0 +1,16 @@
1
+ """Contains shared errors types that can be raised from API functions"""
2
+
3
+
4
+ class UnexpectedStatus(Exception):
5
+ """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6
+
7
+ def __init__(self, status_code: int, content: bytes):
8
+ self.status_code = status_code
9
+ self.content = content
10
+
11
+ super().__init__(
12
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13
+ )
14
+
15
+
16
+ __all__ = ["UnexpectedStatus"]
@@ -0,0 +1,189 @@
1
+ """Contains all the data models used in inputs/outputs"""
2
+
3
+ from .acl import ACL
4
+ from .agent import Agent
5
+ from .agent_chain import AgentChain
6
+ from .agent_configuration import AgentConfiguration
7
+ from .agent_deployment import AgentDeployment
8
+ from .agent_deployment_configuration import AgentDeploymentConfiguration
9
+ from .agent_deployment_history import AgentDeploymentHistory
10
+ from .agent_deployment_history_event import AgentDeploymentHistoryEvent
11
+ from .agent_deployment_pod_template import AgentDeploymentPodTemplate
12
+ from .agent_release import AgentRelease
13
+ from .api_key import ApiKey
14
+ from .authentication_provider_model import AuthenticationProviderModel
15
+ from .authentication_provider_organization import AuthenticationProviderOrganization
16
+ from .configuration import Configuration
17
+ from .continent import Continent
18
+ from .country import Country
19
+ from .create_api_key_for_service_account_body import CreateApiKeyForServiceAccountBody
20
+ from .create_workspace_service_account_body import CreateWorkspaceServiceAccountBody
21
+ from .create_workspace_service_account_response_200 import CreateWorkspaceServiceAccountResponse200
22
+ from .delete_workspace_service_account_response_200 import DeleteWorkspaceServiceAccountResponse200
23
+ from .deployment_configuration import DeploymentConfiguration
24
+ from .deployment_configurations import DeploymentConfigurations
25
+ from .deployment_serverless_config import DeploymentServerlessConfig
26
+ from .environment import Environment
27
+ from .environment_metrics import EnvironmentMetrics
28
+ from .flavor import Flavor
29
+ from .function import Function
30
+ from .function_configuration import FunctionConfiguration
31
+ from .function_deployment import FunctionDeployment
32
+ from .function_deployment_configuration import FunctionDeploymentConfiguration
33
+ from .function_deployment_pod_template import FunctionDeploymentPodTemplate
34
+ from .function_kit import FunctionKit
35
+ from .function_provider_ref import FunctionProviderRef
36
+ from .function_release import FunctionRelease
37
+ from .get_workspace_service_accounts_response_200_item import GetWorkspaceServiceAccountsResponse200Item
38
+ from .invite_workspace_user_body import InviteWorkspaceUserBody
39
+ from .labels_type_0 import LabelsType0
40
+ from .location import Location
41
+ from .location_response import LocationResponse
42
+ from .metric import Metric
43
+ from .metrics import Metrics
44
+ from .model import Model
45
+ from .model_deployment import ModelDeployment
46
+ from .model_deployment_log import ModelDeploymentLog
47
+ from .model_deployment_metrics import ModelDeploymentMetrics
48
+ from .model_deployment_metrics_inference_per_second_per_region import ModelDeploymentMetricsInferencePerSecondPerRegion
49
+ from .model_deployment_metrics_query_per_second_per_region_per_code import (
50
+ ModelDeploymentMetricsQueryPerSecondPerRegionPerCode,
51
+ )
52
+ from .model_deployment_pod_template import ModelDeploymentPodTemplate
53
+ from .model_metrics import ModelMetrics
54
+ from .model_provider import ModelProvider
55
+ from .model_provider_ref import ModelProviderRef
56
+ from .model_release import ModelRelease
57
+ from .model_with_deployments import ModelWithDeployments
58
+ from .pending_invitation import PendingInvitation
59
+ from .pending_invitation_accept import PendingInvitationAccept
60
+ from .pending_invitation_render import PendingInvitationRender
61
+ from .pending_invitation_render_invited_by import PendingInvitationRenderInvitedBy
62
+ from .pending_invitation_render_workspace import PendingInvitationRenderWorkspace
63
+ from .pending_invitation_workspace_details import PendingInvitationWorkspaceDetails
64
+ from .policy import Policy
65
+ from .policy_location import PolicyLocation
66
+ from .provider_config import ProviderConfig
67
+ from .qps import QPS
68
+ from .resource_deployment_log import ResourceDeploymentLog
69
+ from .resource_deployment_metrics import ResourceDeploymentMetrics
70
+ from .resource_deployment_metrics_inference_per_second_per_region import (
71
+ ResourceDeploymentMetricsInferencePerSecondPerRegion,
72
+ )
73
+ from .resource_deployment_metrics_query_per_second_per_region_per_code import (
74
+ ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode,
75
+ )
76
+ from .resource_metrics import ResourceMetrics
77
+ from .runtime import Runtime
78
+ from .runtime_readiness_probe import RuntimeReadinessProbe
79
+ from .runtime_resources import RuntimeResources
80
+ from .serverless_config import ServerlessConfig
81
+ from .standard_fields_dynamo_db import StandardFieldsDynamoDb
82
+ from .store_agent import StoreAgent
83
+ from .store_agent_configuration import StoreAgentConfiguration
84
+ from .store_agent_labels import StoreAgentLabels
85
+ from .store_configuration import StoreConfiguration
86
+ from .store_configuration_option import StoreConfigurationOption
87
+ from .store_function import StoreFunction
88
+ from .store_function_configuration import StoreFunctionConfiguration
89
+ from .store_function_kit import StoreFunctionKit
90
+ from .store_function_labels import StoreFunctionLabels
91
+ from .store_function_parameter import StoreFunctionParameter
92
+ from .update_workspace_service_account_body import UpdateWorkspaceServiceAccountBody
93
+ from .update_workspace_service_account_response_200 import UpdateWorkspaceServiceAccountResponse200
94
+ from .update_workspace_user_role_body import UpdateWorkspaceUserRoleBody
95
+ from .workspace import Workspace
96
+ from .workspace_labels import WorkspaceLabels
97
+ from .workspace_user import WorkspaceUser
98
+
99
+ __all__ = (
100
+ "ACL",
101
+ "Agent",
102
+ "AgentChain",
103
+ "AgentConfiguration",
104
+ "AgentDeployment",
105
+ "AgentDeploymentConfiguration",
106
+ "AgentDeploymentHistory",
107
+ "AgentDeploymentHistoryEvent",
108
+ "AgentDeploymentPodTemplate",
109
+ "AgentRelease",
110
+ "ApiKey",
111
+ "AuthenticationProviderModel",
112
+ "AuthenticationProviderOrganization",
113
+ "Configuration",
114
+ "Continent",
115
+ "Country",
116
+ "CreateApiKeyForServiceAccountBody",
117
+ "CreateWorkspaceServiceAccountBody",
118
+ "CreateWorkspaceServiceAccountResponse200",
119
+ "DeleteWorkspaceServiceAccountResponse200",
120
+ "DeploymentConfiguration",
121
+ "DeploymentConfigurations",
122
+ "DeploymentServerlessConfig",
123
+ "Environment",
124
+ "EnvironmentMetrics",
125
+ "Flavor",
126
+ "Function",
127
+ "FunctionConfiguration",
128
+ "FunctionDeployment",
129
+ "FunctionDeploymentConfiguration",
130
+ "FunctionDeploymentPodTemplate",
131
+ "FunctionKit",
132
+ "FunctionProviderRef",
133
+ "FunctionRelease",
134
+ "GetWorkspaceServiceAccountsResponse200Item",
135
+ "InviteWorkspaceUserBody",
136
+ "LabelsType0",
137
+ "Location",
138
+ "LocationResponse",
139
+ "Metric",
140
+ "Metrics",
141
+ "Model",
142
+ "ModelDeployment",
143
+ "ModelDeploymentLog",
144
+ "ModelDeploymentMetrics",
145
+ "ModelDeploymentMetricsInferencePerSecondPerRegion",
146
+ "ModelDeploymentMetricsQueryPerSecondPerRegionPerCode",
147
+ "ModelDeploymentPodTemplate",
148
+ "ModelMetrics",
149
+ "ModelProvider",
150
+ "ModelProviderRef",
151
+ "ModelRelease",
152
+ "ModelWithDeployments",
153
+ "PendingInvitation",
154
+ "PendingInvitationAccept",
155
+ "PendingInvitationRender",
156
+ "PendingInvitationRenderInvitedBy",
157
+ "PendingInvitationRenderWorkspace",
158
+ "PendingInvitationWorkspaceDetails",
159
+ "Policy",
160
+ "PolicyLocation",
161
+ "ProviderConfig",
162
+ "QPS",
163
+ "ResourceDeploymentLog",
164
+ "ResourceDeploymentMetrics",
165
+ "ResourceDeploymentMetricsInferencePerSecondPerRegion",
166
+ "ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode",
167
+ "ResourceMetrics",
168
+ "Runtime",
169
+ "RuntimeReadinessProbe",
170
+ "RuntimeResources",
171
+ "ServerlessConfig",
172
+ "StandardFieldsDynamoDb",
173
+ "StoreAgent",
174
+ "StoreAgentConfiguration",
175
+ "StoreAgentLabels",
176
+ "StoreConfiguration",
177
+ "StoreConfigurationOption",
178
+ "StoreFunction",
179
+ "StoreFunctionConfiguration",
180
+ "StoreFunctionKit",
181
+ "StoreFunctionLabels",
182
+ "StoreFunctionParameter",
183
+ "UpdateWorkspaceServiceAccountBody",
184
+ "UpdateWorkspaceServiceAccountResponse200",
185
+ "UpdateWorkspaceUserRoleBody",
186
+ "Workspace",
187
+ "WorkspaceLabels",
188
+ "WorkspaceUser",
189
+ )
beamlit/models/acl.py ADDED
@@ -0,0 +1,149 @@
1
+ from typing import Any, Type, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="ACL")
9
+
10
+
11
+ @_attrs_define
12
+ class ACL:
13
+ """ACL
14
+
15
+ Attributes:
16
+ created_at (Union[Unset, str]): The date and time when the resource was created
17
+ created_by (Union[Unset, str]): The user or service account who created the resource
18
+ updated_at (Union[Unset, str]): The date and time when the resource was updated
19
+ updated_by (Union[Unset, str]): The user or service account who updated the resource
20
+ id (Union[Unset, str]): ACL id
21
+ resource_id (Union[Unset, str]): Resource ID
22
+ resource_type (Union[Unset, str]): Resource type
23
+ role (Union[Unset, str]): Role
24
+ subject_id (Union[Unset, str]): Subject ID
25
+ subject_type (Union[Unset, str]): Subject type
26
+ workspace (Union[Unset, str]): Workspace name
27
+ """
28
+
29
+ created_at: Union[Unset, str] = UNSET
30
+ created_by: Union[Unset, str] = UNSET
31
+ updated_at: Union[Unset, str] = UNSET
32
+ updated_by: Union[Unset, str] = UNSET
33
+ id: Union[Unset, str] = UNSET
34
+ resource_id: Union[Unset, str] = UNSET
35
+ resource_type: Union[Unset, str] = UNSET
36
+ role: Union[Unset, str] = UNSET
37
+ subject_id: Union[Unset, str] = UNSET
38
+ subject_type: Union[Unset, str] = UNSET
39
+ workspace: Union[Unset, str] = UNSET
40
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
+
42
+ def to_dict(self) -> dict[str, Any]:
43
+ created_at = self.created_at
44
+
45
+ created_by = self.created_by
46
+
47
+ updated_at = self.updated_at
48
+
49
+ updated_by = self.updated_by
50
+
51
+ id = self.id
52
+
53
+ resource_id = self.resource_id
54
+
55
+ resource_type = self.resource_type
56
+
57
+ role = self.role
58
+
59
+ subject_id = self.subject_id
60
+
61
+ subject_type = self.subject_type
62
+
63
+ workspace = self.workspace
64
+
65
+ field_dict: dict[str, Any] = {}
66
+ field_dict.update(self.additional_properties)
67
+ field_dict.update({})
68
+ if created_at is not UNSET:
69
+ field_dict["created_at"] = created_at
70
+ if created_by is not UNSET:
71
+ field_dict["created_by"] = created_by
72
+ if updated_at is not UNSET:
73
+ field_dict["updated_at"] = updated_at
74
+ if updated_by is not UNSET:
75
+ field_dict["updated_by"] = updated_by
76
+ if id is not UNSET:
77
+ field_dict["id"] = id
78
+ if resource_id is not UNSET:
79
+ field_dict["resource_id"] = resource_id
80
+ if resource_type is not UNSET:
81
+ field_dict["resource_type"] = resource_type
82
+ if role is not UNSET:
83
+ field_dict["role"] = role
84
+ if subject_id is not UNSET:
85
+ field_dict["subject_id"] = subject_id
86
+ if subject_type is not UNSET:
87
+ field_dict["subject_type"] = subject_type
88
+ if workspace is not UNSET:
89
+ field_dict["workspace"] = workspace
90
+
91
+ return field_dict
92
+
93
+ @classmethod
94
+ def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
95
+ d = src_dict.copy()
96
+ created_at = d.pop("created_at", UNSET)
97
+
98
+ created_by = d.pop("created_by", UNSET)
99
+
100
+ updated_at = d.pop("updated_at", UNSET)
101
+
102
+ updated_by = d.pop("updated_by", UNSET)
103
+
104
+ id = d.pop("id", UNSET)
105
+
106
+ resource_id = d.pop("resource_id", UNSET)
107
+
108
+ resource_type = d.pop("resource_type", UNSET)
109
+
110
+ role = d.pop("role", UNSET)
111
+
112
+ subject_id = d.pop("subject_id", UNSET)
113
+
114
+ subject_type = d.pop("subject_type", UNSET)
115
+
116
+ workspace = d.pop("workspace", UNSET)
117
+
118
+ acl = cls(
119
+ created_at=created_at,
120
+ created_by=created_by,
121
+ updated_at=updated_at,
122
+ updated_by=updated_by,
123
+ id=id,
124
+ resource_id=resource_id,
125
+ resource_type=resource_type,
126
+ role=role,
127
+ subject_id=subject_id,
128
+ subject_type=subject_type,
129
+ workspace=workspace,
130
+ )
131
+
132
+ acl.additional_properties = d
133
+ return acl
134
+
135
+ @property
136
+ def additional_keys(self) -> list[str]:
137
+ return list(self.additional_properties.keys())
138
+
139
+ def __getitem__(self, key: str) -> Any:
140
+ return self.additional_properties[key]
141
+
142
+ def __setitem__(self, key: str, value: Any) -> None:
143
+ self.additional_properties[key] = value
144
+
145
+ def __delitem__(self, key: str) -> None:
146
+ del self.additional_properties[key]
147
+
148
+ def __contains__(self, key: str) -> bool:
149
+ return key in self.additional_properties