beamlit 0.0.20rc5__py3-none-any.whl → 0.0.20rc6__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/agents/__init__.py +4 -0
- beamlit/agents/chat.py +87 -0
- beamlit/agents/decorator.py +129 -0
- beamlit/api/agents/delete_agent_history.py +6 -2
- beamlit/api/agents/get_agent_deployment_logs.py +11 -11
- beamlit/api/agents/get_agent_history.py +6 -2
- beamlit/api/agents/list_agent_deployment_history.py +11 -11
- beamlit/api/agents/list_agent_deployments.py +11 -11
- beamlit/api/agents/list_agents.py +11 -11
- beamlit/api/agents/put_agent_history.py +6 -2
- beamlit/api/environments/list_environments.py +11 -11
- beamlit/api/functions/get_function_deployment_logs.py +11 -11
- beamlit/api/functions/list_function_deployments.py +11 -11
- beamlit/api/functions/list_functions.py +11 -11
- beamlit/api/history/get_agents_history.py +11 -11
- beamlit/api/history/list_agents_history.py +11 -11
- beamlit/api/integrations/list_integration_connections.py +11 -11
- beamlit/api/invitations/list_all_pending_invitations.py +11 -11
- beamlit/api/locations/list_locations.py +11 -11
- beamlit/api/model_providers/list_model_providers.py +11 -11
- beamlit/api/models/get_model_deployment_logs.py +11 -11
- beamlit/api/models/list_model_deployments.py +11 -11
- beamlit/api/models/list_models.py +11 -11
- beamlit/api/policies/list_policies.py +11 -11
- beamlit/api/service_accounts/get_workspace_service_accounts.py +11 -11
- beamlit/api/service_accounts/list_api_keys_for_service_account.py +11 -11
- beamlit/api/store/list_store_agents.py +11 -11
- beamlit/api/store/list_store_functions.py +11 -11
- beamlit/api/workspaces/list_workspace_users.py +11 -11
- beamlit/api/workspaces/list_workspaces.py +11 -11
- beamlit/authentication/__init__.py +26 -10
- beamlit/authentication/apikey.py +4 -4
- beamlit/authentication/authentication.py +35 -6
- beamlit/authentication/clientcredentials.py +18 -20
- beamlit/authentication/credentials.py +9 -8
- beamlit/authentication/device_mode.py +15 -12
- beamlit/common/__init__.py +13 -0
- beamlit/common/generate.py +25 -13
- beamlit/common/logger.py +9 -12
- beamlit/common/secrets.py +11 -0
- beamlit/common/settings.py +29 -11
- beamlit/common/utils.py +4 -2
- beamlit/functions/__init__.py +5 -0
- beamlit/functions/decorator.py +90 -0
- beamlit/models/acl.py +2 -2
- beamlit/models/agent.py +3 -3
- beamlit/models/agent_chain.py +2 -2
- beamlit/models/agent_configuration.py +2 -2
- beamlit/models/agent_deployment.py +25 -25
- beamlit/models/agent_deployment_configuration.py +2 -2
- beamlit/models/agent_deployment_history.py +5 -5
- beamlit/models/agent_deployment_history_event.py +9 -9
- beamlit/models/agent_deployment_pod_template.py +2 -2
- beamlit/models/agent_release.py +2 -2
- beamlit/models/agent_spec.py +15 -5
- beamlit/models/agent_with_deployments.py +6 -6
- beamlit/models/api_key.py +2 -2
- beamlit/models/authentication_provider_model.py +6 -6
- beamlit/models/authentication_provider_organization.py +2 -2
- beamlit/models/configuration.py +10 -10
- beamlit/models/continent.py +2 -2
- beamlit/models/core_spec.py +9 -3
- beamlit/models/country.py +2 -2
- beamlit/models/create_api_key_for_service_account_body.py +2 -2
- beamlit/models/create_workspace_service_account_body.py +2 -2
- beamlit/models/create_workspace_service_account_response_200.py +2 -2
- beamlit/models/delete_workspace_service_account_response_200.py +2 -2
- beamlit/models/deployment_configuration.py +2 -2
- beamlit/models/deployment_configurations.py +2 -2
- beamlit/models/deployment_serverless_config.py +2 -2
- beamlit/models/deployment_serverless_config_type_0.py +3 -1
- beamlit/models/environment.py +7 -7
- beamlit/models/environment_metrics.py +8 -8
- beamlit/models/flavor.py +9 -9
- beamlit/models/function.py +3 -3
- beamlit/models/function_configuration.py +2 -2
- beamlit/models/function_deployment.py +24 -24
- beamlit/models/function_deployment_configuration.py +2 -2
- beamlit/models/function_deployment_pod_template.py +2 -2
- beamlit/models/function_kit.py +5 -5
- beamlit/models/function_provider_ref.py +2 -2
- beamlit/models/function_release.py +2 -2
- beamlit/models/function_spec.py +9 -3
- beamlit/models/function_with_deployments.py +6 -6
- beamlit/models/get_workspace_service_accounts_response_200_item.py +2 -2
- beamlit/models/increase_and_rate_metric.py +5 -5
- beamlit/models/integration.py +12 -12
- beamlit/models/integration_config.py +2 -2
- beamlit/models/integration_connection.py +5 -5
- beamlit/models/integration_connection_config.py +2 -2
- beamlit/models/integration_connection_secret.py +2 -2
- beamlit/models/integration_model.py +6 -6
- beamlit/models/integration_secret.py +2 -2
- beamlit/models/invite_workspace_user_body.py +2 -2
- beamlit/models/labels_type_0.py +2 -2
- beamlit/models/location.py +5 -5
- beamlit/models/location_response.py +5 -5
- beamlit/models/metric.py +2 -2
- beamlit/models/metrics.py +8 -8
- beamlit/models/model.py +3 -3
- beamlit/models/model_deployment.py +18 -18
- beamlit/models/model_deployment_log.py +2 -2
- beamlit/models/model_deployment_metrics.py +9 -9
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +5 -5
- beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +3 -3
- beamlit/models/model_deployment_pod_template.py +2 -2
- beamlit/models/model_metrics.py +6 -6
- beamlit/models/model_provider.py +11 -11
- beamlit/models/model_provider_ref.py +2 -2
- beamlit/models/model_release.py +2 -2
- beamlit/models/model_spec.py +9 -3
- beamlit/models/model_with_deployments.py +6 -6
- beamlit/models/pending_invitation.py +2 -2
- beamlit/models/pending_invitation_accept.py +3 -3
- beamlit/models/pending_invitation_render.py +5 -5
- beamlit/models/pending_invitation_render_invited_by.py +2 -2
- beamlit/models/pending_invitation_render_workspace.py +2 -2
- beamlit/models/pending_invitation_workspace_details.py +6 -6
- beamlit/models/policy.py +20 -20
- beamlit/models/policy_location.py +9 -9
- beamlit/models/policy_spec.py +9 -3
- beamlit/models/provider_config.py +7 -7
- beamlit/models/qps.py +2 -2
- beamlit/models/resource_deployment_log.py +2 -2
- beamlit/models/resource_deployment_metrics.py +16 -16
- beamlit/models/resource_deployment_metrics_inference_per_region.py +5 -5
- beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +6 -2
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +5 -5
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +6 -2
- beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +3 -3
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +3 -3
- beamlit/models/resource_environment_metrics.py +62 -24
- beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +6 -2
- beamlit/models/resource_metrics.py +10 -10
- beamlit/models/runtime.py +23 -23
- beamlit/models/runtime_readiness_probe.py +2 -2
- beamlit/models/runtime_resources.py +2 -2
- beamlit/models/serverless_config.py +2 -2
- beamlit/models/standard_fields_dynamo_db.py +2 -2
- beamlit/models/store_agent.py +6 -6
- beamlit/models/store_agent_configuration.py +2 -2
- beamlit/models/store_agent_labels.py +2 -2
- beamlit/models/store_configuration.py +16 -16
- beamlit/models/store_configuration_option.py +2 -2
- beamlit/models/store_function.py +12 -12
- beamlit/models/store_function_configuration.py +2 -2
- beamlit/models/store_function_kit.py +5 -5
- beamlit/models/store_function_labels.py +2 -2
- beamlit/models/store_function_parameter.py +9 -9
- beamlit/models/update_workspace_service_account_body.py +2 -2
- beamlit/models/update_workspace_service_account_response_200.py +2 -2
- beamlit/models/update_workspace_user_role_body.py +2 -2
- beamlit/models/workspace.py +3 -3
- beamlit/models/workspace_labels.py +2 -2
- beamlit/models/workspace_user.py +2 -2
- beamlit/run.py +6 -6
- beamlit/serve.py +120 -0
- {beamlit-0.0.20rc5.dist-info → beamlit-0.0.20rc6.dist-info}/METADATA +5 -1
- beamlit-0.0.20rc6.dist-info/RECORD +290 -0
- beamlit-0.0.20rc5.dist-info/RECORD +0 -282
- {beamlit-0.0.20rc5.dist-info → beamlit-0.0.20rc6.dist-info}/WHEEL +0 -0
@@ -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,
|
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:
|
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,
|
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[
|
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:
|
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:
|
beamlit/models/agent_chain.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
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:
|
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,
|
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:
|
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,
|
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,
|
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,
|
39
|
-
functions (Union[Unset,
|
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,
|
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,
|
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,
|
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,
|
64
|
-
functions: Union[Unset,
|
65
|
-
integration_connections: Union[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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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[
|
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,
|
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,
|
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,
|
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,
|
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:
|
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(
|
249
|
+
functions = cast(list[str], d.pop("functions", UNSET))
|
250
250
|
|
251
|
-
integration_connections = cast(
|
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(
|
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,
|
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:
|
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,
|
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,
|
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,
|
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,
|
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:
|
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,
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
77
|
-
field_dict["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:
|
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
|
-
|
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
|
-
|
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,
|
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:
|
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()
|
beamlit/models/agent_release.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
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:
|
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()
|
beamlit/models/agent_spec.py
CHANGED
@@ -64,7 +64,9 @@ class AgentSpec:
|
|
64
64
|
if not isinstance(self.flavors, Unset):
|
65
65
|
flavors = []
|
66
66
|
for componentsschemas_flavors_item_data in self.flavors:
|
67
|
-
componentsschemas_flavors_item =
|
67
|
+
componentsschemas_flavors_item = (
|
68
|
+
componentsschemas_flavors_item_data.to_dict()
|
69
|
+
)
|
68
70
|
flavors.append(componentsschemas_flavors_item)
|
69
71
|
|
70
72
|
integration_connections: Union[Unset, List[str]] = UNSET
|
@@ -91,7 +93,9 @@ class AgentSpec:
|
|
91
93
|
if not isinstance(self.agent_chain, Unset):
|
92
94
|
agent_chain = []
|
93
95
|
for componentsschemas_agent_chains_item_data in self.agent_chain:
|
94
|
-
componentsschemas_agent_chains_item =
|
96
|
+
componentsschemas_agent_chains_item = (
|
97
|
+
componentsschemas_agent_chains_item_data.to_dict()
|
98
|
+
)
|
95
99
|
agent_chain.append(componentsschemas_agent_chains_item)
|
96
100
|
|
97
101
|
description = self.description
|
@@ -158,11 +162,15 @@ class AgentSpec:
|
|
158
162
|
flavors = []
|
159
163
|
_flavors = d.pop("flavors", UNSET)
|
160
164
|
for componentsschemas_flavors_item_data in _flavors or []:
|
161
|
-
componentsschemas_flavors_item = Flavor.from_dict(
|
165
|
+
componentsschemas_flavors_item = Flavor.from_dict(
|
166
|
+
componentsschemas_flavors_item_data
|
167
|
+
)
|
162
168
|
|
163
169
|
flavors.append(componentsschemas_flavors_item)
|
164
170
|
|
165
|
-
integration_connections = cast(
|
171
|
+
integration_connections = cast(
|
172
|
+
List[str], d.pop("integrationConnections", UNSET)
|
173
|
+
)
|
166
174
|
|
167
175
|
_pod_template = d.pop("podTemplate", UNSET)
|
168
176
|
pod_template: Union[Unset, PodTemplateSpec]
|
@@ -190,7 +198,9 @@ class AgentSpec:
|
|
190
198
|
agent_chain = []
|
191
199
|
_agent_chain = d.pop("agentChain", UNSET)
|
192
200
|
for componentsschemas_agent_chains_item_data in _agent_chain or []:
|
193
|
-
componentsschemas_agent_chains_item = AgentChain.from_dict(
|
201
|
+
componentsschemas_agent_chains_item = AgentChain.from_dict(
|
202
|
+
componentsschemas_agent_chains_item_data
|
203
|
+
)
|
194
204
|
|
195
205
|
agent_chain.append(componentsschemas_agent_chains_item)
|
196
206
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import TYPE_CHECKING, Any,
|
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
|
@@ -26,7 +26,7 @@ class AgentWithDeployments:
|
|
26
26
|
labels (Union['LabelsType0', None, Unset]): Labels
|
27
27
|
name (Union[Unset, str]): Agent name
|
28
28
|
workspace (Union[Unset, str]): Workspace name
|
29
|
-
deployments (Union[Unset,
|
29
|
+
deployments (Union[Unset, list['AgentDeployment']]):
|
30
30
|
"""
|
31
31
|
|
32
32
|
created_at: Union[Unset, str] = UNSET
|
@@ -37,7 +37,7 @@ class AgentWithDeployments:
|
|
37
37
|
labels: Union["LabelsType0", None, Unset] = UNSET
|
38
38
|
name: Union[Unset, str] = UNSET
|
39
39
|
workspace: Union[Unset, str] = UNSET
|
40
|
-
deployments: Union[Unset,
|
40
|
+
deployments: Union[Unset, list["AgentDeployment"]] = UNSET
|
41
41
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
42
42
|
|
43
43
|
def to_dict(self) -> dict[str, Any]:
|
@@ -53,7 +53,7 @@ class AgentWithDeployments:
|
|
53
53
|
|
54
54
|
display_name = self.display_name
|
55
55
|
|
56
|
-
labels: Union[
|
56
|
+
labels: Union[None, Unset, dict[str, Any]]
|
57
57
|
if isinstance(self.labels, Unset):
|
58
58
|
labels = UNSET
|
59
59
|
elif isinstance(self.labels, LabelsType0):
|
@@ -65,7 +65,7 @@ class AgentWithDeployments:
|
|
65
65
|
|
66
66
|
workspace = self.workspace
|
67
67
|
|
68
|
-
deployments: Union[Unset,
|
68
|
+
deployments: Union[Unset, list[dict[str, Any]]] = UNSET
|
69
69
|
if not isinstance(self.deployments, Unset):
|
70
70
|
deployments = []
|
71
71
|
for componentsschemas_agent_deployments_item_data in self.deployments:
|
@@ -97,7 +97,7 @@ class AgentWithDeployments:
|
|
97
97
|
return field_dict
|
98
98
|
|
99
99
|
@classmethod
|
100
|
-
def from_dict(cls:
|
100
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
101
101
|
from ..models.agent_deployment import AgentDeployment
|
102
102
|
from ..models.labels_type_0 import LabelsType0
|
103
103
|
|
beamlit/models/api_key.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
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
|
@@ -85,7 +85,7 @@ class ApiKey:
|
|
85
85
|
return field_dict
|
86
86
|
|
87
87
|
@classmethod
|
88
|
-
def from_dict(cls:
|
88
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
89
89
|
if not src_dict:
|
90
90
|
return None
|
91
91
|
d = src_dict.copy()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
1
|
+
from typing import Any, TypeVar, Union, cast
|
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 AuthenticationProviderModel:
|
|
21
21
|
name (Union[Unset, str]): Provider model name
|
22
22
|
pipeline_tag (Union[Unset, str]): Provider model pipeline tag
|
23
23
|
private (Union[Unset, bool]): Provider model private
|
24
|
-
tags (Union[Unset,
|
24
|
+
tags (Union[Unset, list[str]]): Provider model tags
|
25
25
|
trending_score (Union[Unset, int]): Provider model trending score
|
26
26
|
"""
|
27
27
|
|
@@ -33,7 +33,7 @@ class AuthenticationProviderModel:
|
|
33
33
|
name: Union[Unset, str] = UNSET
|
34
34
|
pipeline_tag: Union[Unset, str] = UNSET
|
35
35
|
private: Union[Unset, bool] = UNSET
|
36
|
-
tags: Union[Unset,
|
36
|
+
tags: Union[Unset, list[str]] = UNSET
|
37
37
|
trending_score: Union[Unset, int] = UNSET
|
38
38
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
39
39
|
|
@@ -54,7 +54,7 @@ class AuthenticationProviderModel:
|
|
54
54
|
|
55
55
|
private = self.private
|
56
56
|
|
57
|
-
tags: Union[Unset,
|
57
|
+
tags: Union[Unset, list[str]] = UNSET
|
58
58
|
if not isinstance(self.tags, Unset):
|
59
59
|
tags = self.tags
|
60
60
|
|
@@ -87,7 +87,7 @@ class AuthenticationProviderModel:
|
|
87
87
|
return field_dict
|
88
88
|
|
89
89
|
@classmethod
|
90
|
-
def from_dict(cls:
|
90
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
91
91
|
if not src_dict:
|
92
92
|
return None
|
93
93
|
d = src_dict.copy()
|
@@ -107,7 +107,7 @@ class AuthenticationProviderModel:
|
|
107
107
|
|
108
108
|
private = d.pop("private", UNSET)
|
109
109
|
|
110
|
-
tags = cast(
|
110
|
+
tags = cast(list[str], d.pop("tags", UNSET))
|
111
111
|
|
112
112
|
trending_score = d.pop("trending_score", UNSET)
|
113
113
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
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
|
@@ -49,7 +49,7 @@ class AuthenticationProviderOrganization:
|
|
49
49
|
return field_dict
|
50
50
|
|
51
51
|
@classmethod
|
52
|
-
def from_dict(cls:
|
52
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
53
53
|
if not src_dict:
|
54
54
|
return None
|
55
55
|
d = src_dict.copy()
|