beamlit 0.0.20rc3__py3-none-any.whl → 0.0.20rc5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. beamlit/api/agents/delete_agent_history.py +155 -0
  2. beamlit/api/agents/get_agent_deployment.py +1 -22
  3. beamlit/api/agents/get_agent_environment_logs.py +151 -0
  4. beamlit/api/agents/get_agent_history.py +155 -0
  5. beamlit/api/agents/list_agent_history.py +151 -0
  6. beamlit/api/agents/put_agent_history.py +181 -0
  7. beamlit/api/functions/get_function_environment_logs.py +151 -0
  8. beamlit/api/models/get_model_environment_logs.py +155 -0
  9. beamlit/authentication/__init__.py +4 -0
  10. beamlit/authentication/apikey.py +6 -0
  11. beamlit/authentication/authentication.py +31 -2
  12. beamlit/authentication/clientcredentials.py +20 -9
  13. beamlit/authentication/credentials.py +1 -0
  14. beamlit/authentication/device_mode.py +10 -1
  15. beamlit/common/generate.py +8 -3
  16. beamlit/common/logger.py +2 -0
  17. beamlit/common/settings.py +1 -5
  18. beamlit/models/__init__.py +28 -30
  19. beamlit/models/acl.py +2 -0
  20. beamlit/models/agent.py +2 -0
  21. beamlit/models/agent_chain.py +2 -0
  22. beamlit/models/agent_configuration.py +2 -0
  23. beamlit/models/agent_deployment.py +44 -99
  24. beamlit/models/agent_deployment_configuration.py +45 -0
  25. beamlit/models/agent_deployment_history.py +15 -46
  26. beamlit/models/agent_deployment_history_event.py +24 -78
  27. beamlit/models/agent_deployment_pod_template.py +45 -0
  28. beamlit/models/agent_history.py +165 -0
  29. beamlit/models/agent_history_event.py +131 -0
  30. beamlit/models/agent_metadata.py +144 -0
  31. beamlit/models/agent_release.py +2 -0
  32. beamlit/models/agent_spec.py +238 -0
  33. beamlit/models/agent_with_deployments.py +2 -0
  34. beamlit/models/api_key.py +2 -0
  35. beamlit/models/authentication_provider_model.py +2 -0
  36. beamlit/models/authentication_provider_organization.py +2 -0
  37. beamlit/models/configuration.py +2 -0
  38. beamlit/models/continent.py +2 -0
  39. beamlit/models/core_spec.py +179 -0
  40. beamlit/models/country.py +2 -0
  41. beamlit/models/create_api_key_for_service_account_body.py +2 -0
  42. beamlit/models/create_workspace_service_account_body.py +2 -0
  43. beamlit/models/create_workspace_service_account_response_200.py +2 -0
  44. beamlit/models/delete_workspace_service_account_response_200.py +2 -0
  45. beamlit/models/deployment_configuration.py +2 -0
  46. beamlit/models/deployment_configurations.py +2 -0
  47. beamlit/models/deployment_serverless_config.py +131 -0
  48. beamlit/models/environment.py +2 -0
  49. beamlit/models/environment_metrics.py +2 -0
  50. beamlit/models/environment_spec.py +61 -0
  51. beamlit/models/flavor.py +2 -0
  52. beamlit/models/function.py +2 -0
  53. beamlit/models/function_configuration.py +2 -0
  54. beamlit/models/function_deployment.py +44 -99
  55. beamlit/models/function_deployment_configuration.py +45 -0
  56. beamlit/models/function_deployment_pod_template.py +45 -0
  57. beamlit/models/function_kit.py +2 -0
  58. beamlit/models/function_metadata.py +144 -0
  59. beamlit/models/function_provider_ref.py +2 -0
  60. beamlit/models/function_release.py +2 -0
  61. beamlit/models/function_spec.py +240 -0
  62. beamlit/models/function_with_deployments.py +2 -0
  63. beamlit/models/get_workspace_service_accounts_response_200_item.py +2 -0
  64. beamlit/models/increase_and_rate_metric.py +2 -0
  65. beamlit/models/integration.py +2 -0
  66. beamlit/models/integration_config.py +2 -0
  67. beamlit/models/integration_connection.py +2 -0
  68. beamlit/models/integration_connection_config.py +2 -0
  69. beamlit/models/integration_connection_secret.py +2 -0
  70. beamlit/models/integration_connection_spec.py +99 -0
  71. beamlit/models/integration_model.py +2 -0
  72. beamlit/models/integration_secret.py +2 -0
  73. beamlit/models/invite_workspace_user_body.py +2 -0
  74. beamlit/models/labels_type_0.py +2 -0
  75. beamlit/models/location.py +2 -0
  76. beamlit/models/location_response.py +2 -0
  77. beamlit/models/metadata.py +135 -0
  78. beamlit/models/metadata_labels.py +43 -0
  79. beamlit/models/metric.py +2 -0
  80. beamlit/models/metrics.py +2 -0
  81. beamlit/models/model.py +2 -0
  82. beamlit/models/model_deployment.py +66 -85
  83. beamlit/models/model_deployment_log.py +2 -0
  84. beamlit/models/model_deployment_metrics.py +2 -0
  85. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +2 -0
  86. beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +2 -0
  87. beamlit/models/model_deployment_pod_template.py +45 -0
  88. beamlit/models/model_metadata.py +144 -0
  89. beamlit/models/model_metrics.py +2 -0
  90. beamlit/models/model_provider.py +2 -0
  91. beamlit/models/model_provider_ref.py +2 -0
  92. beamlit/models/model_release.py +2 -0
  93. beamlit/models/model_spec.py +188 -0
  94. beamlit/models/model_with_deployments.py +2 -0
  95. beamlit/models/owner_fields.py +68 -0
  96. beamlit/models/pending_invitation.py +2 -0
  97. beamlit/models/pending_invitation_accept.py +2 -0
  98. beamlit/models/pending_invitation_render.py +2 -0
  99. beamlit/models/pending_invitation_render_invited_by.py +2 -0
  100. beamlit/models/pending_invitation_render_workspace.py +2 -0
  101. beamlit/models/pending_invitation_workspace_details.py +2 -0
  102. beamlit/models/pod_template_spec.py +43 -0
  103. beamlit/models/policy.py +36 -8
  104. beamlit/models/policy_location.py +2 -0
  105. beamlit/models/policy_spec.py +119 -0
  106. beamlit/models/provider_config.py +2 -0
  107. beamlit/models/qps.py +2 -0
  108. beamlit/models/resource_deployment_log.py +2 -0
  109. beamlit/models/resource_deployment_metrics.py +70 -155
  110. beamlit/models/resource_deployment_metrics_inference_per_region.py +77 -0
  111. beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +77 -0
  112. beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +75 -0
  113. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +75 -0
  114. beamlit/models/resource_environment_metrics.py +172 -0
  115. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +75 -0
  116. beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +73 -0
  117. beamlit/models/resource_log.py +68 -0
  118. beamlit/models/resource_metrics.py +2 -0
  119. beamlit/models/runtime.py +14 -29
  120. beamlit/models/runtime_readiness_probe.py +45 -0
  121. beamlit/models/runtime_resources.py +2 -0
  122. beamlit/models/runtime_type_0.py +111 -0
  123. beamlit/models/runtime_type_0_readiness_probe.py +43 -0
  124. beamlit/models/runtime_type_0_readiness_probe_type_0.py +43 -0
  125. beamlit/models/runtime_type_0_resources.py +59 -0
  126. beamlit/models/serverless_config.py +2 -0
  127. beamlit/models/spec_configuration.py +68 -0
  128. beamlit/models/standard_fields_dynamo_db.py +2 -0
  129. beamlit/models/store_agent.py +15 -29
  130. beamlit/models/store_agent_configuration.py +2 -0
  131. beamlit/models/store_agent_labels.py +45 -0
  132. beamlit/models/store_configuration.py +6 -15
  133. beamlit/models/store_configuration_option.py +7 -18
  134. beamlit/models/store_function.py +15 -29
  135. beamlit/models/store_function_configuration.py +2 -0
  136. beamlit/models/store_function_kit.py +2 -0
  137. beamlit/models/store_function_labels.py +45 -0
  138. beamlit/models/store_function_parameter.py +2 -0
  139. beamlit/models/time_fields.py +68 -0
  140. beamlit/models/update_workspace_service_account_body.py +2 -0
  141. beamlit/models/update_workspace_service_account_response_200.py +2 -0
  142. beamlit/models/update_workspace_user_role_body.py +2 -0
  143. beamlit/models/websocket_channel.py +86 -0
  144. beamlit/models/workspace.py +2 -0
  145. beamlit/models/workspace_labels.py +2 -0
  146. beamlit/models/workspace_user.py +2 -0
  147. {beamlit-0.0.20rc3.dist-info → beamlit-0.0.20rc5.dist-info}/METADATA +1 -1
  148. {beamlit-0.0.20rc3.dist-info → beamlit-0.0.20rc5.dist-info}/RECORD +149 -102
  149. {beamlit-0.0.20rc3.dist-info → beamlit-0.0.20rc5.dist-info}/WHEEL +0 -0
@@ -1,12 +1,13 @@
1
1
  from dataclasses import dataclass
2
- from typing import Generator
2
+ from typing import Dict, Generator
3
3
 
4
+ from beamlit.common.settings import Settings
4
5
  from httpx import Auth, Request, Response
5
6
 
6
7
  from ..client import AuthenticatedClient
7
8
  from .apikey import ApiKeyProvider
8
9
  from .clientcredentials import ClientCredentials
9
- from .credentials import Credentials
10
+ from .credentials import Credentials, load_credentials_from_settings
10
11
  from .device_mode import BearerToken
11
12
 
12
13
 
@@ -24,6 +25,15 @@ class RunClientWithCredentials:
24
25
  run_url: str = "https://run.beamlit.dev/v0"
25
26
 
26
27
 
28
+ def new_client_from_settings(settings: Settings):
29
+ credentials = load_credentials_from_settings(settings)
30
+
31
+ client_config = RunClientWithCredentials(
32
+ credentials=credentials,
33
+ workspace=settings.workspace,
34
+ )
35
+ return new_client_with_credentials(client_config)
36
+
27
37
  def new_client_with_credentials(config: RunClientWithCredentials):
28
38
  provider: Auth = None
29
39
  if config.credentials.api_key:
@@ -36,3 +46,22 @@ def new_client_with_credentials(config: RunClientWithCredentials):
36
46
  provider = PublicProvider()
37
47
 
38
48
  return AuthenticatedClient(base_url=config.api_url, provider=provider)
49
+
50
+ def get_authentication_headers(settings: Settings) -> Dict[str, str]:
51
+ credentials = load_credentials_from_settings(settings)
52
+ config = RunClientWithCredentials(
53
+ credentials=credentials,
54
+ workspace=settings.workspace,
55
+ )
56
+ provider = None
57
+ if config.credentials.api_key:
58
+ provider = ApiKeyProvider(config.credentials, config.workspace)
59
+ elif config.credentials.access_token:
60
+ provider = BearerToken(config.credentials, config.workspace, config.api_url)
61
+ elif config.credentials.client_credentials:
62
+ provider = ClientCredentials(config.credentials, config.workspace, config.api_url)
63
+
64
+ if provider is None:
65
+ return None
66
+
67
+ return provider.get_headers()
@@ -23,7 +23,27 @@ class ClientCredentials(Auth):
23
23
  self.workspace_name = workspace_name
24
24
  self.base_url = base_url
25
25
 
26
+ def get_headers(self):
27
+ err = self.refresh_if_needed()
28
+ if err:
29
+ raise err
30
+
31
+ return {
32
+ 'X-Beamlit-Authorization': f'Bearer {self.credentials.access_token}',
33
+ 'X-Beamlit-Workspace': self.workspace_name
34
+ }
35
+
26
36
  def refresh_if_needed(self) -> Optional[Exception]:
37
+ settings = get_settings()
38
+ if self.credentials.client_credentials and not self.credentials.refresh_token:
39
+ headers = { "Authorization": f"Basic {self.credentials.client_credentials}" }
40
+ body = { "grant_type": "client_credentials" }
41
+ response = requests.post(f"{settings.base_url}/oauth/token", headers=headers, json=body)
42
+ response.raise_for_status()
43
+ self.credentials.access_token = response.json()['access_token']
44
+ self.credentials.refresh_token = response.json()['refresh_token']
45
+ self.credentials.expires_in = response.json()['expires_in']
46
+
27
47
  # Need to refresh token if expires in less than 10 minutes
28
48
  parts = self.credentials.access_token.split('.')
29
49
  if len(parts) != 3:
@@ -42,15 +62,6 @@ class ClientCredentials(Auth):
42
62
  return None
43
63
 
44
64
  def auth_flow(self, request: Request) -> Generator[Request, Response, None]:
45
- settings = get_settings()
46
- if self.credentials.client_credentials and not self.credentials.refresh_token:
47
- headers = { "Authorization": f"Basic {self.credentials.client_credentials}" }
48
- body = { "grant_type": "client_credentials" }
49
- response = requests.post(f"{settings.base_url}/oauth/token", headers=headers, json=body)
50
- response.raise_for_status()
51
- self.credentials.access_token = response.json()['access_token']
52
- self.credentials.refresh_token = response.json()['refresh_token']
53
- self.credentials.expires_in = response.json()['expires_in']
54
65
  err = self.refresh_if_needed()
55
66
  if err:
56
67
  return err
@@ -14,6 +14,7 @@ class Credentials:
14
14
  expires_in: int = 0
15
15
  device_code: str = ""
16
16
  client_credentials: str = ""
17
+
17
18
  @dataclass
18
19
  class WorkspaceConfig:
19
20
  name: str
@@ -2,7 +2,7 @@ import base64
2
2
  import json
3
3
  import time
4
4
  from dataclasses import dataclass
5
- from typing import Generator, Optional
5
+ from typing import Dict, Generator, Optional
6
6
 
7
7
  from httpx import Auth, Request, Response, post
8
8
 
@@ -45,6 +45,15 @@ class BearerToken(Auth):
45
45
  self.workspace_name = workspace_name
46
46
  self.base_url = base_url
47
47
 
48
+ def get_headers(self) -> Dict[str, str]:
49
+ err = self.refresh_if_needed()
50
+ if err:
51
+ raise err
52
+ return {
53
+ 'X-Beamlit-Authorization': f'Bearer {self.credentials.access_token}',
54
+ 'X-Beamlit-Workspace': self.workspace_name
55
+ }
56
+
48
57
  def refresh_if_needed(self) -> Optional[Exception]:
49
58
  # Need to refresh token if expires in less than 10 minutes
50
59
  parts = self.credentials.access_token.split('.')
@@ -13,8 +13,13 @@ def generate_kit_function_code(settings: Settings, function: FunctionDeployment,
13
13
  export_code = ""
14
14
  code = ""
15
15
  for kit in kit:
16
- body = {"function": kit.name, "workspace": settings.workspace, **kit.to_dict()}
17
- new_code, export = generate_function_code(body, force_name_in_endpoint=function.function, kit=True)
16
+ fn = FunctionDeployment(
17
+ function=kit.name,
18
+ workspace=settings.workspace,
19
+ parameters=kit.parameters,
20
+ description=kit.description,
21
+ )
22
+ new_code, export = generate_function_code(settings, fn, force_name_in_endpoint=function.function, kit=True)
18
23
  code += new_code
19
24
  export_code += export
20
25
  return code, export_code
@@ -141,7 +146,7 @@ run_client = RunClient(client=client)
141
146
  if settings.agent_functions and len(settings.agent_functions) > 0:
142
147
  for function_config in settings.agent_functions:
143
148
  if function_config.kit and len(function_config.kit) > 0:
144
- new_code, export = generate_kit_function_code(settings, function_config)
149
+ new_code, export = generate_kit_function_code(settings, function_config, function_config.kit)
145
150
  code += new_code
146
151
  export_code += export
147
152
  else:
beamlit/common/logger.py CHANGED
@@ -19,6 +19,8 @@ class ColoredFormatter(logging.Formatter):
19
19
  def init(log_level: str):
20
20
  logging.getLogger("uvicorn.access").handlers.clear()
21
21
  logging.getLogger("uvicorn.access").propagate = False
22
+ logging.getLogger("uvicorn.error").handlers.clear()
23
+ logging.getLogger("uvicorn.error").propagate = False
22
24
  logging.getLogger("httpx").handlers.clear()
23
25
  logging.getLogger("httpx").propagate = False
24
26
 
@@ -54,7 +54,7 @@ class Settings(BaseSettings):
54
54
  ) -> Tuple[PydanticBaseSettingsSource, ...]:
55
55
  return (env_settings, dotenv_settings, file_secret_settings, YamlConfigSettingsSource(settings_cls), init_settings, )
56
56
 
57
- def init_agent(client: AuthenticatedClient):
57
+ def init_agent(client: AuthenticatedClient, destination: str = f"{os.getcwd()}/src/beamlit_generated.py"):
58
58
  from beamlit.api.agents import get_agent_deployment
59
59
  from beamlit.common.generate import generate
60
60
 
@@ -89,10 +89,6 @@ def init_agent(client: AuthenticatedClient):
89
89
  model_deployment = get_model_deployment.sync(agent_deployment.model, env , client=client)
90
90
  SETTINGS.agent_model = model_deployment
91
91
 
92
-
93
- destination = f"{os.getcwd()}/src/beamlit_generated.py"
94
-
95
-
96
92
  content_generate = generate(destination, dry_run=True)
97
93
  compared_content = None
98
94
  if os.path.exists(destination):
@@ -5,10 +5,10 @@ from .agent import Agent
5
5
  from .agent_chain import AgentChain
6
6
  from .agent_configuration import AgentConfiguration
7
7
  from .agent_deployment import AgentDeployment
8
- from .agent_deployment_configuration_type_0 import AgentDeploymentConfigurationType0
8
+ from .agent_deployment_configuration import AgentDeploymentConfiguration
9
9
  from .agent_deployment_history import AgentDeploymentHistory
10
10
  from .agent_deployment_history_event import AgentDeploymentHistoryEvent
11
- from .agent_deployment_pod_template_type_0 import AgentDeploymentPodTemplateType0
11
+ from .agent_deployment_pod_template import AgentDeploymentPodTemplate
12
12
  from .agent_release import AgentRelease
13
13
  from .agent_with_deployments import AgentWithDeployments
14
14
  from .api_key import ApiKey
@@ -23,15 +23,15 @@ from .create_workspace_service_account_response_200 import CreateWorkspaceServic
23
23
  from .delete_workspace_service_account_response_200 import DeleteWorkspaceServiceAccountResponse200
24
24
  from .deployment_configuration import DeploymentConfiguration
25
25
  from .deployment_configurations import DeploymentConfigurations
26
- from .deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
26
+ from .deployment_serverless_config import DeploymentServerlessConfig
27
27
  from .environment import Environment
28
28
  from .environment_metrics import EnvironmentMetrics
29
29
  from .flavor import Flavor
30
30
  from .function import Function
31
31
  from .function_configuration import FunctionConfiguration
32
32
  from .function_deployment import FunctionDeployment
33
- from .function_deployment_configuration_type_0 import FunctionDeploymentConfigurationType0
34
- from .function_deployment_pod_template_type_0 import FunctionDeploymentPodTemplateType0
33
+ from .function_deployment_configuration import FunctionDeploymentConfiguration
34
+ from .function_deployment_pod_template import FunctionDeploymentPodTemplate
35
35
  from .function_kit import FunctionKit
36
36
  from .function_provider_ref import FunctionProviderRef
37
37
  from .function_release import FunctionRelease
@@ -59,7 +59,7 @@ from .model_deployment_metrics_inference_per_second_per_region import ModelDeplo
59
59
  from .model_deployment_metrics_query_per_second_per_region_per_code import (
60
60
  ModelDeploymentMetricsQueryPerSecondPerRegionPerCode,
61
61
  )
62
- from .model_deployment_pod_template_type_0 import ModelDeploymentPodTemplateType0
62
+ from .model_deployment_pod_template import ModelDeploymentPodTemplate
63
63
  from .model_metrics import ModelMetrics
64
64
  from .model_provider import ModelProvider
65
65
  from .model_provider_ref import ModelProviderRef
@@ -77,31 +77,29 @@ from .provider_config import ProviderConfig
77
77
  from .qps import QPS
78
78
  from .resource_deployment_log import ResourceDeploymentLog
79
79
  from .resource_deployment_metrics import ResourceDeploymentMetrics
80
- from .resource_deployment_metrics_inference_per_region_type_0 import ResourceDeploymentMetricsInferencePerRegionType0
81
- from .resource_deployment_metrics_inference_per_second_per_region_type_0 import (
82
- ResourceDeploymentMetricsInferencePerSecondPerRegionType0,
80
+ from .resource_deployment_metrics_inference_per_region import ResourceDeploymentMetricsInferencePerRegion
81
+ from .resource_deployment_metrics_inference_per_second_per_region import (
82
+ ResourceDeploymentMetricsInferencePerSecondPerRegion,
83
83
  )
84
- from .resource_deployment_metrics_query_per_region_per_code_type_0 import (
85
- ResourceDeploymentMetricsQueryPerRegionPerCodeType0,
86
- )
87
- from .resource_deployment_metrics_query_per_second_per_region_per_code_type_0 import (
88
- ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0,
84
+ from .resource_deployment_metrics_query_per_region_per_code import ResourceDeploymentMetricsQueryPerRegionPerCode
85
+ from .resource_deployment_metrics_query_per_second_per_region_per_code import (
86
+ ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode,
89
87
  )
90
88
  from .resource_metrics import ResourceMetrics
91
89
  from .runtime import Runtime
92
- from .runtime_readiness_probe_type_0 import RuntimeReadinessProbeType0
90
+ from .runtime_readiness_probe import RuntimeReadinessProbe
93
91
  from .runtime_resources import RuntimeResources
94
92
  from .serverless_config import ServerlessConfig
95
93
  from .standard_fields_dynamo_db import StandardFieldsDynamoDb
96
94
  from .store_agent import StoreAgent
97
95
  from .store_agent_configuration import StoreAgentConfiguration
98
- from .store_agent_labels_type_0 import StoreAgentLabelsType0
96
+ from .store_agent_labels import StoreAgentLabels
99
97
  from .store_configuration import StoreConfiguration
100
98
  from .store_configuration_option import StoreConfigurationOption
101
99
  from .store_function import StoreFunction
102
100
  from .store_function_configuration import StoreFunctionConfiguration
103
101
  from .store_function_kit import StoreFunctionKit
104
- from .store_function_labels_type_0 import StoreFunctionLabelsType0
102
+ from .store_function_labels import StoreFunctionLabels
105
103
  from .store_function_parameter import StoreFunctionParameter
106
104
  from .update_workspace_service_account_body import UpdateWorkspaceServiceAccountBody
107
105
  from .update_workspace_service_account_response_200 import UpdateWorkspaceServiceAccountResponse200
@@ -116,10 +114,10 @@ __all__ = (
116
114
  "AgentChain",
117
115
  "AgentConfiguration",
118
116
  "AgentDeployment",
119
- "AgentDeploymentConfigurationType0",
117
+ "AgentDeploymentConfiguration",
120
118
  "AgentDeploymentHistory",
121
119
  "AgentDeploymentHistoryEvent",
122
- "AgentDeploymentPodTemplateType0",
120
+ "AgentDeploymentPodTemplate",
123
121
  "AgentRelease",
124
122
  "AgentWithDeployments",
125
123
  "ApiKey",
@@ -134,15 +132,15 @@ __all__ = (
134
132
  "DeleteWorkspaceServiceAccountResponse200",
135
133
  "DeploymentConfiguration",
136
134
  "DeploymentConfigurations",
137
- "DeploymentServerlessConfigType0",
135
+ "DeploymentServerlessConfig",
138
136
  "Environment",
139
137
  "EnvironmentMetrics",
140
138
  "Flavor",
141
139
  "Function",
142
140
  "FunctionConfiguration",
143
141
  "FunctionDeployment",
144
- "FunctionDeploymentConfigurationType0",
145
- "FunctionDeploymentPodTemplateType0",
142
+ "FunctionDeploymentConfiguration",
143
+ "FunctionDeploymentPodTemplate",
146
144
  "FunctionKit",
147
145
  "FunctionProviderRef",
148
146
  "FunctionRelease",
@@ -168,7 +166,7 @@ __all__ = (
168
166
  "ModelDeploymentMetrics",
169
167
  "ModelDeploymentMetricsInferencePerSecondPerRegion",
170
168
  "ModelDeploymentMetricsQueryPerSecondPerRegionPerCode",
171
- "ModelDeploymentPodTemplateType0",
169
+ "ModelDeploymentPodTemplate",
172
170
  "ModelMetrics",
173
171
  "ModelProvider",
174
172
  "ModelProviderRef",
@@ -186,25 +184,25 @@ __all__ = (
186
184
  "QPS",
187
185
  "ResourceDeploymentLog",
188
186
  "ResourceDeploymentMetrics",
189
- "ResourceDeploymentMetricsInferencePerRegionType0",
190
- "ResourceDeploymentMetricsInferencePerSecondPerRegionType0",
191
- "ResourceDeploymentMetricsQueryPerRegionPerCodeType0",
192
- "ResourceDeploymentMetricsQueryPerSecondPerRegionPerCodeType0",
187
+ "ResourceDeploymentMetricsInferencePerRegion",
188
+ "ResourceDeploymentMetricsInferencePerSecondPerRegion",
189
+ "ResourceDeploymentMetricsQueryPerRegionPerCode",
190
+ "ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode",
193
191
  "ResourceMetrics",
194
192
  "Runtime",
195
- "RuntimeReadinessProbeType0",
193
+ "RuntimeReadinessProbe",
196
194
  "RuntimeResources",
197
195
  "ServerlessConfig",
198
196
  "StandardFieldsDynamoDb",
199
197
  "StoreAgent",
200
198
  "StoreAgentConfiguration",
201
- "StoreAgentLabelsType0",
199
+ "StoreAgentLabels",
202
200
  "StoreConfiguration",
203
201
  "StoreConfigurationOption",
204
202
  "StoreFunction",
205
203
  "StoreFunctionConfiguration",
206
204
  "StoreFunctionKit",
207
- "StoreFunctionLabelsType0",
205
+ "StoreFunctionLabels",
208
206
  "StoreFunctionParameter",
209
207
  "UpdateWorkspaceServiceAccountBody",
210
208
  "UpdateWorkspaceServiceAccountResponse200",
beamlit/models/acl.py CHANGED
@@ -92,6 +92,8 @@ class ACL:
92
92
 
93
93
  @classmethod
94
94
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
95
+ if not src_dict:
96
+ return None
95
97
  d = src_dict.copy()
96
98
  created_at = d.pop("created_at", UNSET)
97
99
 
beamlit/models/agent.py CHANGED
@@ -88,6 +88,8 @@ class Agent:
88
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
 
@@ -44,6 +44,8 @@ class AgentChain:
44
44
 
45
45
  @classmethod
46
46
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
47
+ if not src_dict:
48
+ return None
47
49
  d = src_dict.copy()
48
50
  description = d.pop("description", UNSET)
49
51
 
@@ -38,6 +38,8 @@ class AgentConfiguration:
38
38
 
39
39
  @classmethod
40
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
 
@@ -7,9 +7,9 @@ from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from ..models.agent_chain import AgentChain
10
- from ..models.agent_deployment_configuration_type_0 import AgentDeploymentConfigurationType0
11
- from ..models.agent_deployment_pod_template_type_0 import AgentDeploymentPodTemplateType0
12
- from ..models.deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
10
+ from ..models.agent_deployment_configuration import AgentDeploymentConfiguration
11
+ from ..models.agent_deployment_pod_template import AgentDeploymentPodTemplate
12
+ from ..models.deployment_serverless_config import DeploymentServerlessConfig
13
13
  from ..models.flavor import Flavor
14
14
  from ..models.labels_type_0 import LabelsType0
15
15
  from ..models.runtime import Runtime
@@ -29,11 +29,11 @@ class AgentDeployment:
29
29
  updated_by (Union[Unset, str]): The user or service account who updated the resource
30
30
  agent (Union[Unset, str]): The name of the agent
31
31
  agent_chain (Union[Unset, List['AgentChain']]): Agent chaining configuration
32
- configuration (Union['AgentDeploymentConfigurationType0', None, Unset]): Agent configuration, this is a key
33
- value storage. In your agent you can retrieve the value with config[key]
32
+ configuration (Union[Unset, AgentDeploymentConfiguration]): Agent configuration, this is a key value storage. In
33
+ your agent you can retrieve the value with config[key]
34
34
  description (Union[Unset, str]): Agent description, very important to have a clear description for your agent if
35
35
  you want to make it work with agent chaining
36
- enabled (Union[None, Unset, bool]): Whether the agent deployment is enabled
36
+ enabled (Union[Unset, bool]): Whether the agent deployment is enabled
37
37
  environment (Union[Unset, str]): The name of the environment
38
38
  flavors (Union[Unset, List['Flavor']]): Types of hardware available for deployments
39
39
  functions (Union[Unset, List[str]]): Functions used by the agent, those functions needs to be created before
@@ -41,12 +41,11 @@ class AgentDeployment:
41
41
  integration_connections (Union[Unset, List[str]]):
42
42
  labels (Union['LabelsType0', None, Unset]): Labels
43
43
  model (Union[Unset, str]): Model beamlit to use for agent, it should be compatible with function calling
44
- pod_template (Union['AgentDeploymentPodTemplateType0', None, Unset]): The pod template, should be a valid
45
- Kubernetes pod template
44
+ pod_template (Union[Unset, AgentDeploymentPodTemplate]): The pod template, should be a valid Kubernetes pod
45
+ template
46
46
  policies (Union[Unset, List[str]]):
47
47
  runtime (Union[Unset, Runtime]): Set of configurations for a deployment
48
- serverless_config (Union['DeploymentServerlessConfigType0', None, Unset]): Configuration for a serverless
49
- deployment
48
+ serverless_config (Union[Unset, DeploymentServerlessConfig]): Configuration for a serverless deployment
50
49
  store_id (Union[Unset, str]): Create from a store registered function
51
50
  workspace (Union[Unset, str]): The workspace the agent deployment belongs to
52
51
  """
@@ -57,27 +56,24 @@ class AgentDeployment:
57
56
  updated_by: Union[Unset, str] = UNSET
58
57
  agent: Union[Unset, str] = UNSET
59
58
  agent_chain: Union[Unset, List["AgentChain"]] = UNSET
60
- configuration: Union["AgentDeploymentConfigurationType0", None, Unset] = UNSET
59
+ configuration: Union[Unset, "AgentDeploymentConfiguration"] = UNSET
61
60
  description: Union[Unset, str] = UNSET
62
- enabled: Union[None, Unset, bool] = UNSET
61
+ enabled: Union[Unset, bool] = UNSET
63
62
  environment: Union[Unset, str] = UNSET
64
63
  flavors: Union[Unset, List["Flavor"]] = UNSET
65
64
  functions: Union[Unset, List[str]] = UNSET
66
65
  integration_connections: Union[Unset, List[str]] = UNSET
67
66
  labels: Union["LabelsType0", None, Unset] = UNSET
68
67
  model: Union[Unset, str] = UNSET
69
- pod_template: Union["AgentDeploymentPodTemplateType0", None, Unset] = UNSET
68
+ pod_template: Union[Unset, "AgentDeploymentPodTemplate"] = UNSET
70
69
  policies: Union[Unset, List[str]] = UNSET
71
70
  runtime: Union[Unset, "Runtime"] = UNSET
72
- serverless_config: Union["DeploymentServerlessConfigType0", None, Unset] = UNSET
71
+ serverless_config: Union[Unset, "DeploymentServerlessConfig"] = UNSET
73
72
  store_id: Union[Unset, str] = UNSET
74
73
  workspace: Union[Unset, str] = UNSET
75
74
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
76
75
 
77
76
  def to_dict(self) -> dict[str, Any]:
78
- from ..models.agent_deployment_configuration_type_0 import AgentDeploymentConfigurationType0
79
- from ..models.agent_deployment_pod_template_type_0 import AgentDeploymentPodTemplateType0
80
- from ..models.deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
81
77
  from ..models.labels_type_0 import LabelsType0
82
78
 
83
79
  created_at = self.created_at
@@ -97,21 +93,13 @@ class AgentDeployment:
97
93
  agent_chain_item = agent_chain_item_data.to_dict()
98
94
  agent_chain.append(agent_chain_item)
99
95
 
100
- configuration: Union[Dict[str, Any], None, Unset]
101
- if isinstance(self.configuration, Unset):
102
- configuration = UNSET
103
- elif isinstance(self.configuration, AgentDeploymentConfigurationType0):
96
+ configuration: Union[Unset, Dict[str, Any]] = UNSET
97
+ if not isinstance(self.configuration, Unset):
104
98
  configuration = self.configuration.to_dict()
105
- else:
106
- configuration = self.configuration
107
99
 
108
100
  description = self.description
109
101
 
110
- enabled: Union[None, Unset, bool]
111
- if isinstance(self.enabled, Unset):
112
- enabled = UNSET
113
- else:
114
- enabled = self.enabled
102
+ enabled = self.enabled
115
103
 
116
104
  environment = self.environment
117
105
 
@@ -140,13 +128,9 @@ class AgentDeployment:
140
128
 
141
129
  model = self.model
142
130
 
143
- pod_template: Union[Dict[str, Any], None, Unset]
144
- if isinstance(self.pod_template, Unset):
145
- pod_template = UNSET
146
- elif isinstance(self.pod_template, AgentDeploymentPodTemplateType0):
131
+ pod_template: Union[Unset, Dict[str, Any]] = UNSET
132
+ if not isinstance(self.pod_template, Unset):
147
133
  pod_template = self.pod_template.to_dict()
148
- else:
149
- pod_template = self.pod_template
150
134
 
151
135
  policies: Union[Unset, List[str]] = UNSET
152
136
  if not isinstance(self.policies, Unset):
@@ -156,13 +140,9 @@ class AgentDeployment:
156
140
  if not isinstance(self.runtime, Unset):
157
141
  runtime = self.runtime.to_dict()
158
142
 
159
- serverless_config: Union[Dict[str, Any], None, Unset]
160
- if isinstance(self.serverless_config, Unset):
161
- serverless_config = UNSET
162
- elif isinstance(self.serverless_config, DeploymentServerlessConfigType0):
143
+ serverless_config: Union[Unset, Dict[str, Any]] = UNSET
144
+ if not isinstance(self.serverless_config, Unset):
163
145
  serverless_config = self.serverless_config.to_dict()
164
- else:
165
- serverless_config = self.serverless_config
166
146
 
167
147
  store_id = self.store_id
168
148
 
@@ -219,13 +199,15 @@ class AgentDeployment:
219
199
  @classmethod
220
200
  def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
221
201
  from ..models.agent_chain import AgentChain
222
- from ..models.agent_deployment_configuration_type_0 import AgentDeploymentConfigurationType0
223
- from ..models.agent_deployment_pod_template_type_0 import AgentDeploymentPodTemplateType0
224
- from ..models.deployment_serverless_config_type_0 import DeploymentServerlessConfigType0
202
+ from ..models.agent_deployment_configuration import AgentDeploymentConfiguration
203
+ from ..models.agent_deployment_pod_template import AgentDeploymentPodTemplate
204
+ from ..models.deployment_serverless_config import DeploymentServerlessConfig
225
205
  from ..models.flavor import Flavor
226
206
  from ..models.labels_type_0 import LabelsType0
227
207
  from ..models.runtime import Runtime
228
208
 
209
+ if not src_dict:
210
+ return None
229
211
  d = src_dict.copy()
230
212
  created_at = d.pop("created_at", UNSET)
231
213
 
@@ -244,33 +226,16 @@ class AgentDeployment:
244
226
 
245
227
  agent_chain.append(agent_chain_item)
246
228
 
247
- def _parse_configuration(data: object) -> Union["AgentDeploymentConfigurationType0", None, Unset]:
248
- if data is None:
249
- return data
250
- if isinstance(data, Unset):
251
- return data
252
- try:
253
- if not isinstance(data, dict):
254
- raise TypeError()
255
- configuration_type_0 = AgentDeploymentConfigurationType0.from_dict(data)
256
-
257
- return configuration_type_0
258
- except: # noqa: E722
259
- pass
260
- return cast(Union["AgentDeploymentConfigurationType0", None, Unset], data)
261
-
262
- configuration = _parse_configuration(d.pop("configuration", UNSET))
229
+ _configuration = d.pop("configuration", UNSET)
230
+ configuration: Union[Unset, AgentDeploymentConfiguration]
231
+ if isinstance(_configuration, Unset):
232
+ configuration = UNSET
233
+ else:
234
+ configuration = AgentDeploymentConfiguration.from_dict(_configuration)
263
235
 
264
236
  description = d.pop("description", UNSET)
265
237
 
266
- def _parse_enabled(data: object) -> Union[None, Unset, bool]:
267
- if data is None:
268
- return data
269
- if isinstance(data, Unset):
270
- return data
271
- return cast(Union[None, Unset, bool], data)
272
-
273
- enabled = _parse_enabled(d.pop("enabled", UNSET))
238
+ enabled = d.pop("enabled", UNSET)
274
239
 
275
240
  environment = d.pop("environment", UNSET)
276
241
 
@@ -304,22 +269,12 @@ class AgentDeployment:
304
269
 
305
270
  model = d.pop("model", UNSET)
306
271
 
307
- def _parse_pod_template(data: object) -> Union["AgentDeploymentPodTemplateType0", None, Unset]:
308
- if data is None:
309
- return data
310
- if isinstance(data, Unset):
311
- return data
312
- try:
313
- if not isinstance(data, dict):
314
- raise TypeError()
315
- pod_template_type_0 = AgentDeploymentPodTemplateType0.from_dict(data)
316
-
317
- return pod_template_type_0
318
- except: # noqa: E722
319
- pass
320
- return cast(Union["AgentDeploymentPodTemplateType0", None, Unset], data)
321
-
322
- pod_template = _parse_pod_template(d.pop("pod_template", UNSET))
272
+ _pod_template = d.pop("pod_template", UNSET)
273
+ pod_template: Union[Unset, AgentDeploymentPodTemplate]
274
+ if isinstance(_pod_template, Unset):
275
+ pod_template = UNSET
276
+ else:
277
+ pod_template = AgentDeploymentPodTemplate.from_dict(_pod_template)
323
278
 
324
279
  policies = cast(List[str], d.pop("policies", UNSET))
325
280
 
@@ -330,22 +285,12 @@ class AgentDeployment:
330
285
  else:
331
286
  runtime = Runtime.from_dict(_runtime)
332
287
 
333
- def _parse_serverless_config(data: object) -> Union["DeploymentServerlessConfigType0", None, Unset]:
334
- if data is None:
335
- return data
336
- if isinstance(data, Unset):
337
- return data
338
- try:
339
- if not isinstance(data, dict):
340
- raise TypeError()
341
- componentsschemas_deployment_serverless_config_type_0 = DeploymentServerlessConfigType0.from_dict(data)
342
-
343
- return componentsschemas_deployment_serverless_config_type_0
344
- except: # noqa: E722
345
- pass
346
- return cast(Union["DeploymentServerlessConfigType0", None, Unset], data)
347
-
348
- serverless_config = _parse_serverless_config(d.pop("serverless_config", UNSET))
288
+ _serverless_config = d.pop("serverless_config", UNSET)
289
+ serverless_config: Union[Unset, DeploymentServerlessConfig]
290
+ if isinstance(_serverless_config, Unset):
291
+ serverless_config = UNSET
292
+ else:
293
+ serverless_config = DeploymentServerlessConfig.from_dict(_serverless_config)
349
294
 
350
295
  store_id = d.pop("store_id", UNSET)
351
296