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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. beamlit/agents/__init__.py +4 -0
  2. beamlit/agents/chat.py +87 -0
  3. beamlit/agents/decorator.py +147 -0
  4. beamlit/api/agents/delete_agent_history.py +6 -2
  5. beamlit/api/agents/get_agent_deployment_logs.py +11 -11
  6. beamlit/api/agents/get_agent_history.py +6 -2
  7. beamlit/api/agents/list_agent_deployment_history.py +11 -11
  8. beamlit/api/agents/list_agent_deployments.py +11 -11
  9. beamlit/api/agents/list_agents.py +11 -11
  10. beamlit/api/agents/put_agent_history.py +6 -2
  11. beamlit/api/environments/list_environments.py +11 -11
  12. beamlit/api/functions/get_function_deployment_logs.py +11 -11
  13. beamlit/api/functions/list_function_deployments.py +11 -11
  14. beamlit/api/functions/list_functions.py +11 -11
  15. beamlit/api/history/get_agents_history.py +11 -11
  16. beamlit/api/history/list_agents_history.py +11 -11
  17. beamlit/api/integrations/list_integration_connections.py +11 -11
  18. beamlit/api/invitations/list_all_pending_invitations.py +11 -11
  19. beamlit/api/locations/list_locations.py +11 -11
  20. beamlit/api/model_providers/list_model_providers.py +11 -11
  21. beamlit/api/models/get_model_deployment_logs.py +11 -11
  22. beamlit/api/models/list_model_deployments.py +11 -11
  23. beamlit/api/models/list_models.py +11 -11
  24. beamlit/api/policies/list_policies.py +11 -11
  25. beamlit/api/service_accounts/get_workspace_service_accounts.py +11 -11
  26. beamlit/api/service_accounts/list_api_keys_for_service_account.py +11 -11
  27. beamlit/api/store/list_store_agents.py +11 -11
  28. beamlit/api/store/list_store_functions.py +11 -11
  29. beamlit/api/workspaces/list_workspace_users.py +11 -11
  30. beamlit/api/workspaces/list_workspaces.py +11 -11
  31. beamlit/authentication/__init__.py +26 -10
  32. beamlit/authentication/apikey.py +4 -4
  33. beamlit/authentication/authentication.py +36 -5
  34. beamlit/authentication/clientcredentials.py +18 -20
  35. beamlit/authentication/credentials.py +18 -11
  36. beamlit/authentication/device_mode.py +15 -12
  37. beamlit/common/__init__.py +13 -0
  38. beamlit/common/generate.py +31 -19
  39. beamlit/common/logger.py +9 -12
  40. beamlit/common/secrets.py +11 -0
  41. beamlit/common/settings.py +78 -30
  42. beamlit/common/utils.py +4 -2
  43. beamlit/functions/__init__.py +5 -0
  44. beamlit/functions/decorator.py +90 -0
  45. beamlit/models/acl.py +2 -2
  46. beamlit/models/agent.py +3 -3
  47. beamlit/models/agent_chain.py +2 -2
  48. beamlit/models/agent_configuration.py +2 -2
  49. beamlit/models/agent_deployment.py +25 -25
  50. beamlit/models/agent_deployment_configuration.py +2 -2
  51. beamlit/models/agent_deployment_history.py +5 -5
  52. beamlit/models/agent_deployment_history_event.py +9 -9
  53. beamlit/models/agent_deployment_pod_template.py +2 -2
  54. beamlit/models/agent_release.py +2 -2
  55. beamlit/models/agent_spec.py +15 -5
  56. beamlit/models/agent_with_deployments.py +6 -6
  57. beamlit/models/api_key.py +2 -2
  58. beamlit/models/authentication_provider_model.py +6 -6
  59. beamlit/models/authentication_provider_organization.py +2 -2
  60. beamlit/models/configuration.py +10 -10
  61. beamlit/models/continent.py +2 -2
  62. beamlit/models/core_spec.py +9 -3
  63. beamlit/models/country.py +2 -2
  64. beamlit/models/create_api_key_for_service_account_body.py +2 -2
  65. beamlit/models/create_workspace_service_account_body.py +2 -2
  66. beamlit/models/create_workspace_service_account_response_200.py +2 -2
  67. beamlit/models/delete_workspace_service_account_response_200.py +2 -2
  68. beamlit/models/deployment_configuration.py +2 -2
  69. beamlit/models/deployment_configurations.py +2 -2
  70. beamlit/models/deployment_serverless_config.py +2 -2
  71. beamlit/models/deployment_serverless_config_type_0.py +3 -1
  72. beamlit/models/environment.py +7 -7
  73. beamlit/models/environment_metrics.py +8 -8
  74. beamlit/models/flavor.py +9 -9
  75. beamlit/models/function.py +3 -3
  76. beamlit/models/function_configuration.py +2 -2
  77. beamlit/models/function_deployment.py +24 -24
  78. beamlit/models/function_deployment_configuration.py +2 -2
  79. beamlit/models/function_deployment_pod_template.py +2 -2
  80. beamlit/models/function_kit.py +5 -5
  81. beamlit/models/function_provider_ref.py +2 -2
  82. beamlit/models/function_release.py +2 -2
  83. beamlit/models/function_spec.py +9 -3
  84. beamlit/models/function_with_deployments.py +6 -6
  85. beamlit/models/get_workspace_service_accounts_response_200_item.py +2 -2
  86. beamlit/models/increase_and_rate_metric.py +5 -5
  87. beamlit/models/integration.py +12 -12
  88. beamlit/models/integration_config.py +2 -2
  89. beamlit/models/integration_connection.py +5 -5
  90. beamlit/models/integration_connection_config.py +2 -2
  91. beamlit/models/integration_connection_secret.py +2 -2
  92. beamlit/models/integration_model.py +6 -6
  93. beamlit/models/integration_secret.py +2 -2
  94. beamlit/models/invite_workspace_user_body.py +2 -2
  95. beamlit/models/labels_type_0.py +2 -2
  96. beamlit/models/location.py +5 -5
  97. beamlit/models/location_response.py +5 -5
  98. beamlit/models/metric.py +2 -2
  99. beamlit/models/metrics.py +8 -8
  100. beamlit/models/model.py +3 -3
  101. beamlit/models/model_deployment.py +18 -18
  102. beamlit/models/model_deployment_log.py +2 -2
  103. beamlit/models/model_deployment_metrics.py +9 -9
  104. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +5 -5
  105. beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +3 -3
  106. beamlit/models/model_deployment_pod_template.py +2 -2
  107. beamlit/models/model_metrics.py +6 -6
  108. beamlit/models/model_provider.py +11 -11
  109. beamlit/models/model_provider_ref.py +2 -2
  110. beamlit/models/model_release.py +2 -2
  111. beamlit/models/model_spec.py +9 -3
  112. beamlit/models/model_with_deployments.py +6 -6
  113. beamlit/models/pending_invitation.py +2 -2
  114. beamlit/models/pending_invitation_accept.py +3 -3
  115. beamlit/models/pending_invitation_render.py +5 -5
  116. beamlit/models/pending_invitation_render_invited_by.py +2 -2
  117. beamlit/models/pending_invitation_render_workspace.py +2 -2
  118. beamlit/models/pending_invitation_workspace_details.py +6 -6
  119. beamlit/models/policy.py +20 -20
  120. beamlit/models/policy_location.py +9 -9
  121. beamlit/models/policy_spec.py +9 -3
  122. beamlit/models/provider_config.py +7 -7
  123. beamlit/models/qps.py +2 -2
  124. beamlit/models/resource_deployment_log.py +2 -2
  125. beamlit/models/resource_deployment_metrics.py +16 -16
  126. beamlit/models/resource_deployment_metrics_inference_per_region.py +5 -5
  127. beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +6 -2
  128. beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +5 -5
  129. beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +6 -2
  130. beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +3 -3
  131. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +3 -3
  132. beamlit/models/resource_environment_metrics.py +62 -24
  133. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +6 -2
  134. beamlit/models/resource_metrics.py +10 -10
  135. beamlit/models/runtime.py +23 -23
  136. beamlit/models/runtime_readiness_probe.py +2 -2
  137. beamlit/models/runtime_resources.py +2 -2
  138. beamlit/models/serverless_config.py +2 -2
  139. beamlit/models/standard_fields_dynamo_db.py +2 -2
  140. beamlit/models/store_agent.py +6 -6
  141. beamlit/models/store_agent_configuration.py +2 -2
  142. beamlit/models/store_agent_labels.py +2 -2
  143. beamlit/models/store_configuration.py +16 -16
  144. beamlit/models/store_configuration_option.py +2 -2
  145. beamlit/models/store_function.py +12 -12
  146. beamlit/models/store_function_configuration.py +2 -2
  147. beamlit/models/store_function_kit.py +5 -5
  148. beamlit/models/store_function_labels.py +2 -2
  149. beamlit/models/store_function_parameter.py +9 -9
  150. beamlit/models/update_workspace_service_account_body.py +2 -2
  151. beamlit/models/update_workspace_service_account_response_200.py +2 -2
  152. beamlit/models/update_workspace_user_role_body.py +2 -2
  153. beamlit/models/workspace.py +3 -3
  154. beamlit/models/workspace_labels.py +2 -2
  155. beamlit/models/workspace_user.py +2 -2
  156. beamlit/run.py +6 -6
  157. beamlit/serve/app.py +73 -0
  158. beamlit/serve/middlewares/__init__.py +4 -0
  159. beamlit/serve/middlewares/accesslog.py +14 -0
  160. beamlit/serve/middlewares/processtime.py +12 -0
  161. {beamlit-0.0.20rc5.dist-info → beamlit-0.0.20rc7.dist-info}/METADATA +7 -1
  162. beamlit-0.0.20rc7.dist-info/RECORD +293 -0
  163. beamlit-0.0.20rc5.dist-info/RECORD +0 -282
  164. {beamlit-0.0.20rc5.dist-info → beamlit-0.0.20rc7.dist-info}/WHEEL +0 -0
@@ -1,26 +1,56 @@
1
1
  import os
2
2
  from logging import getLogger
3
- from typing import Dict, List, Tuple, Type, Union
3
+ from typing import List, Tuple, Type, Union
4
+
5
+ from langchain_core.language_models.chat_models import BaseChatModel
6
+ from langgraph.graph.graph import CompiledGraph
7
+ from pydantic import Field
8
+ from pydantic_settings import (
9
+ BaseSettings,
10
+ PydanticBaseSettingsSource,
11
+ SettingsConfigDict,
12
+ YamlConfigSettingsSource,
13
+ )
4
14
 
5
15
  from beamlit.api.functions import get_function_deployment
6
16
  from beamlit.api.models import get_model_deployment
7
17
  from beamlit.client import AuthenticatedClient
8
18
  from beamlit.common.logger import init as init_logger
9
- from beamlit.models.agent_chain import AgentChain
10
19
  from beamlit.models.agent_deployment import AgentDeployment
11
20
  from beamlit.models.function_deployment import FunctionDeployment
12
21
  from beamlit.models.model_deployment import ModelDeployment
13
22
  from beamlit.types import UNSET, Unset
14
- from pydantic import Field
15
- from pydantic_settings import (BaseSettings, PydanticBaseSettingsSource,
16
- SettingsConfigDict, YamlConfigSettingsSource)
17
23
 
18
24
  global SETTINGS
19
25
  SETTINGS = None
20
26
 
27
+
21
28
  def get_settings():
22
29
  return SETTINGS
23
30
 
31
+
32
+ class SettingsAgent(BaseSettings):
33
+ agent: Union[None, CompiledGraph, BaseChatModel] = None
34
+ chain: Union[Unset, List[AgentDeployment]] = UNSET
35
+ model: Union[Unset, ModelDeployment] = UNSET
36
+ functions: Union[Unset, List[FunctionDeployment]] = UNSET
37
+ functions_directory: str = Field(default="src/functions")
38
+ chat_model: Union[None, BaseChatModel] = None
39
+ module: str = Field(default="main.main")
40
+
41
+
42
+ class SettingsAuthentication(BaseSettings):
43
+ api_key: Union[None, str] = None
44
+ jwt: Union[None, str] = None
45
+ client_credentials: Union[None, str] = None
46
+
47
+
48
+ class SettingsServer(BaseSettings):
49
+ module: str = Field(default="main.main")
50
+ port: int = Field(default=80)
51
+ host: str = Field(default="0.0.0.0")
52
+
53
+
24
54
  class Settings(BaseSettings):
25
55
  model_config = SettingsConfigDict(
26
56
  yaml_file="beamlit.yaml",
@@ -28,20 +58,15 @@ class Settings(BaseSettings):
28
58
  )
29
59
 
30
60
  workspace: str
31
- type: str
32
- name: str
33
- environment: str = Field(default="production")
61
+ environment: str
62
+ type: str = Field(default="agent")
63
+ name: str = Field(default="beamlit-agent")
34
64
  base_url: str = Field(default="https://api.beamlit.dev/v0")
35
65
  run_url: str = Field(default="https://run.beamlit.dev")
36
- port: int = Field(default=80)
37
- host: str = Field(default="0.0.0.0")
38
66
  log_level: str = Field(default="INFO")
39
- api_key: Union[None, str] = None
40
- jwt: Union[None, str] = None
41
- client_credentials: Union[None, str] = None
42
- agent_chain: Union[Unset, List[AgentDeployment]] = UNSET
43
- agent_functions: Union[Unset, List[FunctionDeployment]] = UNSET
44
- agent_model: Union[Unset, ModelDeployment] = UNSET
67
+ agent: SettingsAgent = SettingsAgent()
68
+ server: SettingsServer = SettingsServer()
69
+ authentication: SettingsAuthentication = SettingsAuthentication()
45
70
 
46
71
  @classmethod
47
72
  def settings_customise_sources(
@@ -52,21 +77,31 @@ class Settings(BaseSettings):
52
77
  dotenv_settings: PydanticBaseSettingsSource,
53
78
  file_secret_settings: PydanticBaseSettingsSource,
54
79
  ) -> Tuple[PydanticBaseSettingsSource, ...]:
55
- return (env_settings, dotenv_settings, file_secret_settings, YamlConfigSettingsSource(settings_cls), init_settings, )
56
-
57
- def init_agent(client: AuthenticatedClient, destination: str = f"{os.getcwd()}/src/beamlit_generated.py"):
80
+ return (
81
+ env_settings,
82
+ dotenv_settings,
83
+ file_secret_settings,
84
+ YamlConfigSettingsSource(settings_cls),
85
+ init_settings,
86
+ )
87
+
88
+
89
+ def init_agent(
90
+ client: AuthenticatedClient,
91
+ destination: str = f"{os.getcwd()}/src/beamlit_generated.py",
92
+ ):
58
93
  from beamlit.api.agents import get_agent_deployment
59
94
  from beamlit.common.generate import generate
60
95
 
61
96
  logger = getLogger(__name__)
62
-
97
+ settings = get_settings()
63
98
  # Init configuration from environment variables
64
- if SETTINGS.agent_functions or SETTINGS.agent_chain:
99
+ if settings.agent.functions or settings.agent.chain:
65
100
  return
66
101
 
67
102
  # Init configuration from beamlit control plane
68
- name = SETTINGS.name
69
- env = SETTINGS.environment
103
+ name = settings.name
104
+ env = settings.environment
70
105
 
71
106
  agent_deployment = get_agent_deployment.sync(name, env, client=client)
72
107
  function_deployments = []
@@ -75,7 +110,7 @@ def init_agent(client: AuthenticatedClient, destination: str = f"{os.getcwd()}/s
75
110
  for function in agent_deployment.functions:
76
111
  function_deployment = get_function_deployment.sync(function, env, client=client)
77
112
  function_deployments.append(function_deployment)
78
- SETTINGS.agent_functions = function_deployments
113
+ settings.agent.functions = function_deployments
79
114
 
80
115
  if agent_deployment.agent_chain:
81
116
  for chain in agent_deployment.agent_chain:
@@ -84,24 +119,37 @@ def init_agent(client: AuthenticatedClient, destination: str = f"{os.getcwd()}/s
84
119
  if chain.description:
85
120
  agent_deployment.description = chain.description
86
121
  agent_chain_deployments.append(agent_deployment)
87
- SETTINGS.agent_chain = agent_chain_deployments
122
+ settings.agent.chain = agent_chain_deployments
88
123
  if agent_deployment.model:
89
- model_deployment = get_model_deployment.sync(agent_deployment.model, env , client=client)
90
- SETTINGS.agent_model = model_deployment
124
+ model_deployment = get_model_deployment.sync(agent_deployment.model, env, client=client)
125
+ settings.agent.model = model_deployment
91
126
 
92
127
  content_generate = generate(destination, dry_run=True)
93
128
  compared_content = None
94
129
  if os.path.exists(destination):
95
- compared_content = open(destination, "r").read()
130
+ compared_content = open(destination).read()
96
131
 
97
- if not os.path.exists(destination) or (compared_content and content_generate != compared_content):
132
+ if not os.path.exists(destination) or (
133
+ compared_content and content_generate != compared_content
134
+ ):
98
135
  logger.info("Generating agent code")
99
136
  generate(destination)
100
137
 
138
+
101
139
  def init() -> Settings:
102
140
  """Parse the beamlit.yaml file to get configurations."""
141
+ from beamlit.authentication.credentials import current_context
142
+
103
143
  global SETTINGS
104
144
 
105
- SETTINGS = Settings()
145
+ context = current_context()
146
+ kwargs = {}
147
+ if context.workspace:
148
+ kwargs["workspace"] = context.workspace
149
+ if context.environment:
150
+ kwargs["environment"] = context.environment
151
+
152
+ SETTINGS = Settings(**kwargs)
106
153
  init_logger(SETTINGS.log_level)
154
+
107
155
  return SETTINGS
beamlit/common/utils.py CHANGED
@@ -9,5 +9,7 @@ def copy_folder(source_folder: str, destination_folder: str):
9
9
  if not os.path.exists(f"{destination_folder}/{file}"):
10
10
  os.makedirs(f"{destination_folder}/{file}")
11
11
  copy_folder(f"{source_folder}/{file}", f"{destination_folder}/{file}")
12
- elif not os.path.exists(f"{destination_folder}/{file}") or not filecmp.cmp(f"{source_folder}/{file}", f"{destination_folder}/{file}"):
13
- shutil.copy(f"{source_folder}/{file}", f"{destination_folder}/{file}")
12
+ elif not os.path.exists(f"{destination_folder}/{file}") or not filecmp.cmp(
13
+ f"{source_folder}/{file}", f"{destination_folder}/{file}"
14
+ ):
15
+ shutil.copy(f"{source_folder}/{file}", f"{destination_folder}/{file}")
@@ -0,0 +1,5 @@
1
+ """Functions package providing function decorators and utilities."""
2
+
3
+ from .decorator import function, kit
4
+
5
+ __all__ = ["function", "kit"]
@@ -0,0 +1,90 @@
1
+ """Decorators for creating function tools with Beamlit and LangChain integration."""
2
+
3
+ from collections.abc import Callable
4
+ from logging import getLogger
5
+
6
+ from langchain_core.tools import create_schema_from_function, tool
7
+
8
+ from beamlit.authentication import new_client
9
+ from beamlit.common.settings import get_settings
10
+ from beamlit.models import FunctionDeployment, FunctionKit
11
+ from beamlit.run import RunClient
12
+
13
+ logger = getLogger(__name__)
14
+
15
+
16
+ def get_remote_function(func: Callable, bl_function: FunctionDeployment):
17
+ settings = get_settings()
18
+
19
+ def _partial(*args, **kwargs):
20
+ # Get function signature parameters
21
+ try:
22
+ client = new_client()
23
+ run_client = RunClient(client)
24
+ name = (bl_function and bl_function.function) or func.__name__
25
+ logger.debug(
26
+ f"Calling remote function: NAME={name}"
27
+ f" PARAMS={kwargs} ENVIRONMENT={settings.environment}"
28
+ )
29
+ response = run_client.run(
30
+ resource_type="function",
31
+ resource_name=name,
32
+ environment=settings.environment,
33
+ method="POST",
34
+ headers={},
35
+ json=kwargs,
36
+ )
37
+ if response.status_code >= 400:
38
+ content = f"{response.status_code}:{response.text}"
39
+ return f"Error calling remote function: {content}"
40
+ logger.debug(
41
+ f"Response from remote function: NAME={name}"
42
+ f" RESPONSE={response.json()} ENVIRONMENT={settings.environment}"
43
+ )
44
+ return response.json()
45
+ except Exception as e:
46
+ logger.error(f"Error calling function {bl_function.id}: {e}")
47
+ raise e
48
+
49
+ remote_func = _partial
50
+ remote_func.__name__ = func.__name__
51
+ remote_func.__doc__ = func.__doc__
52
+ return remote_func
53
+
54
+
55
+ def kit(bl_kit: FunctionKit = None, **kwargs: dict) -> Callable:
56
+ """Create function tools with Beamlit and LangChain integration."""
57
+
58
+ def wrapper(func: Callable) -> Callable:
59
+ if bl_kit and not func.__doc__ and bl_kit.description:
60
+ func.__doc__ = bl_kit.description
61
+ return tool(func, **kwargs)
62
+
63
+ return wrapper
64
+
65
+
66
+ def function(
67
+ *args, bl_function: FunctionDeployment = None, kit=False, **kwargs: dict
68
+ ) -> Callable:
69
+ """Create function tools with Beamlit and LangChain integration."""
70
+ settings = get_settings()
71
+
72
+ def wrapper(func: Callable) -> Callable:
73
+ if bl_function and not func.__doc__ and bl_function.description:
74
+ func.__doc__ = bl_function.description
75
+ if (
76
+ settings.environment == "development"
77
+ or settings.environment == "production"
78
+ ):
79
+ remote_func = get_remote_function(func, bl_function)
80
+ if not kwargs.get("args_schema"):
81
+ kwargs["args_schema"] = create_schema_from_function(
82
+ func.__name__,
83
+ func,
84
+ parse_docstring=func.__doc__,
85
+ )
86
+ return tool(remote_func, **kwargs)
87
+ return tool(func, **kwargs)
88
+
89
+ return wrapper
90
+ return wrapper
beamlit/models/acl.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar, Union
1
+ from typing import Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -91,7 +91,7 @@ class ACL:
91
91
  return field_dict
92
92
 
93
93
  @classmethod
94
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
94
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
95
95
  if not src_dict:
96
96
  return None
97
97
  d = src_dict.copy()
beamlit/models/agent.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -50,7 +50,7 @@ class Agent:
50
50
 
51
51
  display_name = self.display_name
52
52
 
53
- labels: Union[Dict[str, Any], None, Unset]
53
+ labels: Union[None, Unset, dict[str, Any]]
54
54
  if isinstance(self.labels, Unset):
55
55
  labels = UNSET
56
56
  elif isinstance(self.labels, LabelsType0):
@@ -85,7 +85,7 @@ class Agent:
85
85
  return field_dict
86
86
 
87
87
  @classmethod
88
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
88
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
89
89
  from ..models.labels_type_0 import LabelsType0
90
90
 
91
91
  if not src_dict:
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar, Union
1
+ from typing import Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -43,7 +43,7 @@ class AgentChain:
43
43
  return field_dict
44
44
 
45
45
  @classmethod
46
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
46
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
47
47
  if not src_dict:
48
48
  return None
49
49
  d = src_dict.copy()
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar, Union
1
+ from typing import Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -37,7 +37,7 @@ class AgentConfiguration:
37
37
  return field_dict
38
38
 
39
39
  @classmethod
40
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
40
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
41
41
  if not src_dict:
42
42
  return None
43
43
  d = src_dict.copy()
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -28,22 +28,22 @@ class AgentDeployment:
28
28
  updated_at (Union[Unset, str]): The date and time when the resource was updated
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
- agent_chain (Union[Unset, List['AgentChain']]): Agent chaining configuration
31
+ agent_chain (Union[Unset, list['AgentChain']]): Agent chaining configuration
32
32
  configuration (Union[Unset, AgentDeploymentConfiguration]): Agent configuration, this is a key value storage. In
33
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
36
  enabled (Union[Unset, bool]): Whether the agent deployment is enabled
37
37
  environment (Union[Unset, str]): The name of the environment
38
- flavors (Union[Unset, List['Flavor']]): Types of hardware available for deployments
39
- functions (Union[Unset, List[str]]): Functions used by the agent, those functions needs to be created before
38
+ flavors (Union[Unset, list['Flavor']]): Types of hardware available for deployments
39
+ functions (Union[Unset, list[str]]): Functions used by the agent, those functions needs to be created before
40
40
  setting it here
41
- integration_connections (Union[Unset, List[str]]):
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
44
  pod_template (Union[Unset, AgentDeploymentPodTemplate]): The pod template, should be a valid Kubernetes pod
45
45
  template
46
- policies (Union[Unset, List[str]]):
46
+ policies (Union[Unset, list[str]]):
47
47
  runtime (Union[Unset, Runtime]): Set of configurations for a deployment
48
48
  serverless_config (Union[Unset, DeploymentServerlessConfig]): Configuration for a serverless deployment
49
49
  store_id (Union[Unset, str]): Create from a store registered function
@@ -55,18 +55,18 @@ class AgentDeployment:
55
55
  updated_at: Union[Unset, str] = UNSET
56
56
  updated_by: Union[Unset, str] = UNSET
57
57
  agent: Union[Unset, str] = UNSET
58
- agent_chain: Union[Unset, List["AgentChain"]] = UNSET
58
+ agent_chain: Union[Unset, list["AgentChain"]] = UNSET
59
59
  configuration: Union[Unset, "AgentDeploymentConfiguration"] = UNSET
60
60
  description: Union[Unset, str] = UNSET
61
61
  enabled: Union[Unset, bool] = UNSET
62
62
  environment: Union[Unset, str] = UNSET
63
- flavors: Union[Unset, List["Flavor"]] = UNSET
64
- functions: Union[Unset, List[str]] = UNSET
65
- integration_connections: Union[Unset, List[str]] = UNSET
63
+ flavors: Union[Unset, list["Flavor"]] = UNSET
64
+ functions: Union[Unset, list[str]] = UNSET
65
+ integration_connections: Union[Unset, list[str]] = UNSET
66
66
  labels: Union["LabelsType0", None, Unset] = UNSET
67
67
  model: Union[Unset, str] = UNSET
68
68
  pod_template: Union[Unset, "AgentDeploymentPodTemplate"] = UNSET
69
- policies: Union[Unset, List[str]] = UNSET
69
+ policies: Union[Unset, list[str]] = UNSET
70
70
  runtime: Union[Unset, "Runtime"] = UNSET
71
71
  serverless_config: Union[Unset, "DeploymentServerlessConfig"] = UNSET
72
72
  store_id: Union[Unset, str] = UNSET
@@ -86,14 +86,14 @@ class AgentDeployment:
86
86
 
87
87
  agent = self.agent
88
88
 
89
- agent_chain: Union[Unset, List[Dict[str, Any]]] = UNSET
89
+ agent_chain: Union[Unset, list[dict[str, Any]]] = UNSET
90
90
  if not isinstance(self.agent_chain, Unset):
91
91
  agent_chain = []
92
92
  for agent_chain_item_data in self.agent_chain:
93
93
  agent_chain_item = agent_chain_item_data.to_dict()
94
94
  agent_chain.append(agent_chain_item)
95
95
 
96
- configuration: Union[Unset, Dict[str, Any]] = UNSET
96
+ configuration: Union[Unset, dict[str, Any]] = UNSET
97
97
  if not isinstance(self.configuration, Unset):
98
98
  configuration = self.configuration.to_dict()
99
99
 
@@ -103,22 +103,22 @@ class AgentDeployment:
103
103
 
104
104
  environment = self.environment
105
105
 
106
- flavors: Union[Unset, List[Dict[str, Any]]] = UNSET
106
+ flavors: Union[Unset, list[dict[str, Any]]] = UNSET
107
107
  if not isinstance(self.flavors, Unset):
108
108
  flavors = []
109
109
  for componentsschemas_flavors_item_data in self.flavors:
110
110
  componentsschemas_flavors_item = componentsschemas_flavors_item_data.to_dict()
111
111
  flavors.append(componentsschemas_flavors_item)
112
112
 
113
- functions: Union[Unset, List[str]] = UNSET
113
+ functions: Union[Unset, list[str]] = UNSET
114
114
  if not isinstance(self.functions, Unset):
115
115
  functions = self.functions
116
116
 
117
- integration_connections: Union[Unset, List[str]] = UNSET
117
+ integration_connections: Union[Unset, list[str]] = UNSET
118
118
  if not isinstance(self.integration_connections, Unset):
119
119
  integration_connections = self.integration_connections
120
120
 
121
- labels: Union[Dict[str, Any], None, Unset]
121
+ labels: Union[None, Unset, dict[str, Any]]
122
122
  if isinstance(self.labels, Unset):
123
123
  labels = UNSET
124
124
  elif isinstance(self.labels, LabelsType0):
@@ -128,19 +128,19 @@ class AgentDeployment:
128
128
 
129
129
  model = self.model
130
130
 
131
- pod_template: Union[Unset, Dict[str, Any]] = UNSET
131
+ pod_template: Union[Unset, dict[str, Any]] = UNSET
132
132
  if not isinstance(self.pod_template, Unset):
133
133
  pod_template = self.pod_template.to_dict()
134
134
 
135
- policies: Union[Unset, List[str]] = UNSET
135
+ policies: Union[Unset, list[str]] = UNSET
136
136
  if not isinstance(self.policies, Unset):
137
137
  policies = self.policies
138
138
 
139
- runtime: Union[Unset, Dict[str, Any]] = UNSET
139
+ runtime: Union[Unset, dict[str, Any]] = UNSET
140
140
  if not isinstance(self.runtime, Unset):
141
141
  runtime = self.runtime.to_dict()
142
142
 
143
- serverless_config: Union[Unset, Dict[str, Any]] = UNSET
143
+ serverless_config: Union[Unset, dict[str, Any]] = UNSET
144
144
  if not isinstance(self.serverless_config, Unset):
145
145
  serverless_config = self.serverless_config.to_dict()
146
146
 
@@ -197,7 +197,7 @@ class AgentDeployment:
197
197
  return field_dict
198
198
 
199
199
  @classmethod
200
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
200
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
201
201
  from ..models.agent_chain import AgentChain
202
202
  from ..models.agent_deployment_configuration import AgentDeploymentConfiguration
203
203
  from ..models.agent_deployment_pod_template import AgentDeploymentPodTemplate
@@ -246,9 +246,9 @@ class AgentDeployment:
246
246
 
247
247
  flavors.append(componentsschemas_flavors_item)
248
248
 
249
- functions = cast(List[str], d.pop("functions", UNSET))
249
+ functions = cast(list[str], d.pop("functions", UNSET))
250
250
 
251
- integration_connections = cast(List[str], d.pop("integration_connections", UNSET))
251
+ integration_connections = cast(list[str], d.pop("integration_connections", UNSET))
252
252
 
253
253
  def _parse_labels(data: object) -> Union["LabelsType0", None, Unset]:
254
254
  if data is None:
@@ -276,7 +276,7 @@ class AgentDeployment:
276
276
  else:
277
277
  pod_template = AgentDeploymentPodTemplate.from_dict(_pod_template)
278
278
 
279
- policies = cast(List[str], d.pop("policies", UNSET))
279
+ policies = cast(list[str], d.pop("policies", UNSET))
280
280
 
281
281
  _runtime = d.pop("runtime", UNSET)
282
282
  runtime: Union[Unset, Runtime]
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar
1
+ from typing import Any, TypeVar
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -19,7 +19,7 @@ class AgentDeploymentConfiguration:
19
19
  return field_dict
20
20
 
21
21
  @classmethod
22
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
23
  if not src_dict:
24
24
  return None
25
25
  d = src_dict.copy()
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -24,7 +24,7 @@ class AgentDeploymentHistory:
24
24
  agent (Union[Unset, str]): Agent name
25
25
  end (Union[Unset, str]): End time
26
26
  environment (Union[Unset, str]): Environment name
27
- events (Union[Unset, List['AgentDeploymentHistoryEvent']]): Events
27
+ events (Union[Unset, list['AgentDeploymentHistoryEvent']]): Events
28
28
  request_id (Union[Unset, str]): Request ID
29
29
  start (Union[Unset, str]): Start time
30
30
  status (Union[Unset, str]): Status, eg: running, success, failed
@@ -39,7 +39,7 @@ class AgentDeploymentHistory:
39
39
  agent: Union[Unset, str] = UNSET
40
40
  end: Union[Unset, str] = UNSET
41
41
  environment: Union[Unset, str] = UNSET
42
- events: Union[Unset, List["AgentDeploymentHistoryEvent"]] = UNSET
42
+ events: Union[Unset, list["AgentDeploymentHistoryEvent"]] = UNSET
43
43
  request_id: Union[Unset, str] = UNSET
44
44
  start: Union[Unset, str] = UNSET
45
45
  status: Union[Unset, str] = UNSET
@@ -62,7 +62,7 @@ class AgentDeploymentHistory:
62
62
 
63
63
  environment = self.environment
64
64
 
65
- events: Union[Unset, List[Dict[str, Any]]] = UNSET
65
+ events: Union[Unset, list[dict[str, Any]]] = UNSET
66
66
  if not isinstance(self.events, Unset):
67
67
  events = []
68
68
  for events_item_data in self.events:
@@ -112,7 +112,7 @@ class AgentDeploymentHistory:
112
112
  return field_dict
113
113
 
114
114
  @classmethod
115
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
115
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
116
116
  from ..models.agent_deployment_history_event import AgentDeploymentHistoryEvent
117
117
 
118
118
  if not src_dict:
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar, Union
1
+ from typing import Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -21,7 +21,7 @@ class AgentDeploymentHistoryEvent:
21
21
  status (Union[Unset, str]): Status, eg: running, success, failed
22
22
  sub_function (Union[Unset, str]): Function used in kit if a kit was used
23
23
  took (Union[Unset, int]): Number of milliseconds it took to complete the event
24
- type (Union[Unset, str]): Type, one of function or agent
24
+ type_ (Union[Unset, str]): Type, one of function or agent
25
25
  """
26
26
 
27
27
  end: Union[Unset, str] = UNSET
@@ -32,7 +32,7 @@ class AgentDeploymentHistoryEvent:
32
32
  status: Union[Unset, str] = UNSET
33
33
  sub_function: Union[Unset, str] = UNSET
34
34
  took: Union[Unset, int] = UNSET
35
- type: Union[Unset, str] = UNSET
35
+ type_: Union[Unset, str] = UNSET
36
36
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
37
 
38
38
  def to_dict(self) -> dict[str, Any]:
@@ -52,7 +52,7 @@ class AgentDeploymentHistoryEvent:
52
52
 
53
53
  took = self.took
54
54
 
55
- type = self.type
55
+ type_ = self.type_
56
56
 
57
57
  field_dict: dict[str, Any] = {}
58
58
  field_dict.update(self.additional_properties)
@@ -73,13 +73,13 @@ class AgentDeploymentHistoryEvent:
73
73
  field_dict["sub_function"] = sub_function
74
74
  if took is not UNSET:
75
75
  field_dict["took"] = took
76
- if type is not UNSET:
77
- field_dict["type"] = type
76
+ if type_ is not UNSET:
77
+ field_dict["type"] = type_
78
78
 
79
79
  return field_dict
80
80
 
81
81
  @classmethod
82
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
82
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
83
83
  if not src_dict:
84
84
  return None
85
85
  d = src_dict.copy()
@@ -99,7 +99,7 @@ class AgentDeploymentHistoryEvent:
99
99
 
100
100
  took = d.pop("took", UNSET)
101
101
 
102
- type = d.pop("type", UNSET)
102
+ type_ = d.pop("type", UNSET)
103
103
 
104
104
  agent_deployment_history_event = cls(
105
105
  end=end,
@@ -110,7 +110,7 @@ class AgentDeploymentHistoryEvent:
110
110
  status=status,
111
111
  sub_function=sub_function,
112
112
  took=took,
113
- type=type,
113
+ type_=type_,
114
114
  )
115
115
 
116
116
  agent_deployment_history_event.additional_properties = d
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar
1
+ from typing import Any, TypeVar
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -19,7 +19,7 @@ class AgentDeploymentPodTemplate:
19
19
  return field_dict
20
20
 
21
21
  @classmethod
22
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
23
  if not src_dict:
24
24
  return None
25
25
  d = src_dict.copy()
@@ -1,4 +1,4 @@
1
- from typing import Any, Type, TypeVar, Union
1
+ from typing import Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -37,7 +37,7 @@ class AgentRelease:
37
37
  return field_dict
38
38
 
39
39
  @classmethod
40
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
40
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
41
41
  if not src_dict:
42
42
  return None
43
43
  d = src_dict.copy()