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.
- beamlit/agents/__init__.py +4 -0
- beamlit/agents/chat.py +87 -0
- beamlit/agents/decorator.py +147 -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 +36 -5
- beamlit/authentication/clientcredentials.py +18 -20
- beamlit/authentication/credentials.py +18 -11
- beamlit/authentication/device_mode.py +15 -12
- beamlit/common/__init__.py +13 -0
- beamlit/common/generate.py +31 -19
- beamlit/common/logger.py +9 -12
- beamlit/common/secrets.py +11 -0
- beamlit/common/settings.py +78 -30
- 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/app.py +73 -0
- beamlit/serve/middlewares/__init__.py +4 -0
- beamlit/serve/middlewares/accesslog.py +14 -0
- beamlit/serve/middlewares/processtime.py +12 -0
- {beamlit-0.0.20rc5.dist-info → beamlit-0.0.20rc7.dist-info}/METADATA +7 -1
- beamlit-0.0.20rc7.dist-info/RECORD +293 -0
- beamlit-0.0.20rc5.dist-info/RECORD +0 -282
- {beamlit-0.0.20rc5.dist-info → beamlit-0.0.20rc7.dist-info}/WHEEL +0 -0
@@ -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
|
@@ -17,30 +17,30 @@ class StoreConfiguration:
|
|
17
17
|
"""Store configuration for resources (eg: agent, function, etc)
|
18
18
|
|
19
19
|
Attributes:
|
20
|
-
available_models (Union[Unset,
|
20
|
+
available_models (Union[Unset, list[str]]): Available models for the configuration
|
21
21
|
description (Union[Unset, str]): Store configuration description
|
22
22
|
display_name (Union[Unset, str]): Store configuration display name
|
23
23
|
if_ (Union[Unset, str]): Conditional rendering for the configuration, example: provider === 'openai'
|
24
24
|
name (Union[Unset, str]): Store configuration name
|
25
|
-
options (Union[Unset,
|
25
|
+
options (Union[Unset, list['StoreConfigurationOption']]):
|
26
26
|
required (Union[Unset, bool]): Store configuration required
|
27
27
|
secret (Union[Unset, bool]): Store configuration secret
|
28
|
-
|
28
|
+
type_ (Union[Unset, str]): Store configuration type
|
29
29
|
"""
|
30
30
|
|
31
|
-
available_models: Union[Unset,
|
31
|
+
available_models: Union[Unset, list[str]] = UNSET
|
32
32
|
description: Union[Unset, str] = UNSET
|
33
33
|
display_name: Union[Unset, str] = UNSET
|
34
34
|
if_: Union[Unset, str] = UNSET
|
35
35
|
name: Union[Unset, str] = UNSET
|
36
|
-
options: Union[Unset,
|
36
|
+
options: Union[Unset, list["StoreConfigurationOption"]] = UNSET
|
37
37
|
required: Union[Unset, bool] = UNSET
|
38
38
|
secret: Union[Unset, bool] = UNSET
|
39
|
-
|
39
|
+
type_: Union[Unset, str] = UNSET
|
40
40
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
41
41
|
|
42
42
|
def to_dict(self) -> dict[str, Any]:
|
43
|
-
available_models: Union[Unset,
|
43
|
+
available_models: Union[Unset, list[str]] = UNSET
|
44
44
|
if not isinstance(self.available_models, Unset):
|
45
45
|
available_models = self.available_models
|
46
46
|
|
@@ -52,7 +52,7 @@ class StoreConfiguration:
|
|
52
52
|
|
53
53
|
name = self.name
|
54
54
|
|
55
|
-
options: Union[Unset,
|
55
|
+
options: Union[Unset, list[dict[str, Any]]] = UNSET
|
56
56
|
if not isinstance(self.options, Unset):
|
57
57
|
options = []
|
58
58
|
for options_item_data in self.options:
|
@@ -63,7 +63,7 @@ class StoreConfiguration:
|
|
63
63
|
|
64
64
|
secret = self.secret
|
65
65
|
|
66
|
-
|
66
|
+
type_ = self.type_
|
67
67
|
|
68
68
|
field_dict: dict[str, Any] = {}
|
69
69
|
field_dict.update(self.additional_properties)
|
@@ -84,19 +84,19 @@ class StoreConfiguration:
|
|
84
84
|
field_dict["required"] = required
|
85
85
|
if secret is not UNSET:
|
86
86
|
field_dict["secret"] = secret
|
87
|
-
if
|
88
|
-
field_dict["type"] =
|
87
|
+
if type_ is not UNSET:
|
88
|
+
field_dict["type"] = type_
|
89
89
|
|
90
90
|
return field_dict
|
91
91
|
|
92
92
|
@classmethod
|
93
|
-
def from_dict(cls:
|
93
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
94
94
|
from ..models.store_configuration_option import StoreConfigurationOption
|
95
95
|
|
96
96
|
if not src_dict:
|
97
97
|
return None
|
98
98
|
d = src_dict.copy()
|
99
|
-
available_models = cast(
|
99
|
+
available_models = cast(list[str], d.pop("available_models", UNSET))
|
100
100
|
|
101
101
|
description = d.pop("description", UNSET)
|
102
102
|
|
@@ -117,7 +117,7 @@ class StoreConfiguration:
|
|
117
117
|
|
118
118
|
secret = d.pop("secret", UNSET)
|
119
119
|
|
120
|
-
|
120
|
+
type_ = d.pop("type", UNSET)
|
121
121
|
|
122
122
|
store_configuration = cls(
|
123
123
|
available_models=available_models,
|
@@ -128,7 +128,7 @@ class StoreConfiguration:
|
|
128
128
|
options=options,
|
129
129
|
required=required,
|
130
130
|
secret=secret,
|
131
|
-
|
131
|
+
type_=type_,
|
132
132
|
)
|
133
133
|
|
134
134
|
store_configuration.additional_properties = d
|
@@ -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 StoreConfigurationOption:
|
|
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()
|
beamlit/models/store_function.py
CHANGED
@@ -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,28 +24,28 @@ class StoreFunction:
|
|
24
24
|
created_by (Union[Unset, str]): The user or service account who created the resource
|
25
25
|
updated_at (Union[Unset, str]): The date and time when the resource was updated
|
26
26
|
updated_by (Union[Unset, str]): The user or service account who updated the resource
|
27
|
-
configuration (Union[Unset,
|
27
|
+
configuration (Union[Unset, list['StoreConfiguration']]): Store function configuration
|
28
28
|
description (Union[Unset, str]): Store function description
|
29
29
|
display_name (Union[Unset, str]): Store function display name
|
30
30
|
image (Union[Unset, str]): Store function image
|
31
|
-
kit (Union[Unset,
|
31
|
+
kit (Union[Unset, list['StoreFunctionKit']]): Store function kit
|
32
32
|
labels (Union[Unset, StoreFunctionLabels]): Store function labels
|
33
33
|
name (Union[Unset, str]): Store function name
|
34
|
-
parameters (Union[Unset,
|
34
|
+
parameters (Union[Unset, list['StoreFunctionParameter']]): Store function parameters
|
35
35
|
"""
|
36
36
|
|
37
37
|
created_at: Union[Unset, str] = UNSET
|
38
38
|
created_by: Union[Unset, str] = UNSET
|
39
39
|
updated_at: Union[Unset, str] = UNSET
|
40
40
|
updated_by: Union[Unset, str] = UNSET
|
41
|
-
configuration: Union[Unset,
|
41
|
+
configuration: Union[Unset, list["StoreConfiguration"]] = UNSET
|
42
42
|
description: Union[Unset, str] = UNSET
|
43
43
|
display_name: Union[Unset, str] = UNSET
|
44
44
|
image: Union[Unset, str] = UNSET
|
45
|
-
kit: Union[Unset,
|
45
|
+
kit: Union[Unset, list["StoreFunctionKit"]] = UNSET
|
46
46
|
labels: Union[Unset, "StoreFunctionLabels"] = UNSET
|
47
47
|
name: Union[Unset, str] = UNSET
|
48
|
-
parameters: Union[Unset,
|
48
|
+
parameters: Union[Unset, list["StoreFunctionParameter"]] = UNSET
|
49
49
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
50
50
|
|
51
51
|
def to_dict(self) -> dict[str, Any]:
|
@@ -57,7 +57,7 @@ class StoreFunction:
|
|
57
57
|
|
58
58
|
updated_by = self.updated_by
|
59
59
|
|
60
|
-
configuration: Union[Unset,
|
60
|
+
configuration: Union[Unset, list[dict[str, Any]]] = UNSET
|
61
61
|
if not isinstance(self.configuration, Unset):
|
62
62
|
configuration = []
|
63
63
|
for configuration_item_data in self.configuration:
|
@@ -70,20 +70,20 @@ class StoreFunction:
|
|
70
70
|
|
71
71
|
image = self.image
|
72
72
|
|
73
|
-
kit: Union[Unset,
|
73
|
+
kit: Union[Unset, list[dict[str, Any]]] = UNSET
|
74
74
|
if not isinstance(self.kit, Unset):
|
75
75
|
kit = []
|
76
76
|
for kit_item_data in self.kit:
|
77
77
|
kit_item = kit_item_data.to_dict()
|
78
78
|
kit.append(kit_item)
|
79
79
|
|
80
|
-
labels: Union[Unset,
|
80
|
+
labels: Union[Unset, dict[str, Any]] = UNSET
|
81
81
|
if not isinstance(self.labels, Unset):
|
82
82
|
labels = self.labels.to_dict()
|
83
83
|
|
84
84
|
name = self.name
|
85
85
|
|
86
|
-
parameters: Union[Unset,
|
86
|
+
parameters: Union[Unset, list[dict[str, Any]]] = UNSET
|
87
87
|
if not isinstance(self.parameters, Unset):
|
88
88
|
parameters = []
|
89
89
|
for parameters_item_data in self.parameters:
|
@@ -121,7 +121,7 @@ class StoreFunction:
|
|
121
121
|
return field_dict
|
122
122
|
|
123
123
|
@classmethod
|
124
|
-
def from_dict(cls:
|
124
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
125
125
|
from ..models.store_configuration import StoreConfiguration
|
126
126
|
from ..models.store_function_kit import StoreFunctionKit
|
127
127
|
from ..models.store_function_labels import StoreFunctionLabels
|
@@ -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
|
@@ -55,7 +55,7 @@ class StoreFunctionConfiguration:
|
|
55
55
|
return field_dict
|
56
56
|
|
57
57
|
@classmethod
|
58
|
-
def from_dict(cls:
|
58
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
59
59
|
if not src_dict:
|
60
60
|
return None
|
61
61
|
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
|
@@ -20,13 +20,13 @@ class StoreFunctionKit:
|
|
20
20
|
description (Union[Unset, str]): Description of the function kit, very important for the agent to work with your
|
21
21
|
kit
|
22
22
|
name (Union[Unset, str]): The kit name, very important for the agent to work with your kit
|
23
|
-
parameters (Union[Unset,
|
23
|
+
parameters (Union[Unset, list['StoreFunctionParameter']]): Kit parameters, for your kit to be callable with an
|
24
24
|
Agent
|
25
25
|
"""
|
26
26
|
|
27
27
|
description: Union[Unset, str] = UNSET
|
28
28
|
name: Union[Unset, str] = UNSET
|
29
|
-
parameters: Union[Unset,
|
29
|
+
parameters: Union[Unset, list["StoreFunctionParameter"]] = UNSET
|
30
30
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
31
31
|
|
32
32
|
def to_dict(self) -> dict[str, Any]:
|
@@ -34,7 +34,7 @@ class StoreFunctionKit:
|
|
34
34
|
|
35
35
|
name = self.name
|
36
36
|
|
37
|
-
parameters: Union[Unset,
|
37
|
+
parameters: Union[Unset, list[dict[str, Any]]] = UNSET
|
38
38
|
if not isinstance(self.parameters, Unset):
|
39
39
|
parameters = []
|
40
40
|
for parameters_item_data in self.parameters:
|
@@ -54,7 +54,7 @@ class StoreFunctionKit:
|
|
54
54
|
return field_dict
|
55
55
|
|
56
56
|
@classmethod
|
57
|
-
def from_dict(cls:
|
57
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
58
58
|
from ..models.store_function_parameter import StoreFunctionParameter
|
59
59
|
|
60
60
|
if not src_dict:
|
@@ -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 StoreFunctionLabels:
|
|
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 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
|
@@ -16,13 +16,13 @@ class StoreFunctionParameter:
|
|
16
16
|
description (Union[Unset, str]): Store function parameter description
|
17
17
|
name (Union[Unset, str]): Store function parameter name
|
18
18
|
required (Union[Unset, bool]): Store function parameter required
|
19
|
-
|
19
|
+
type_ (Union[Unset, str]): Store function parameter type
|
20
20
|
"""
|
21
21
|
|
22
22
|
description: Union[Unset, str] = UNSET
|
23
23
|
name: Union[Unset, str] = UNSET
|
24
24
|
required: Union[Unset, bool] = UNSET
|
25
|
-
|
25
|
+
type_: Union[Unset, str] = UNSET
|
26
26
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
27
27
|
|
28
28
|
def to_dict(self) -> dict[str, Any]:
|
@@ -32,7 +32,7 @@ class StoreFunctionParameter:
|
|
32
32
|
|
33
33
|
required = self.required
|
34
34
|
|
35
|
-
|
35
|
+
type_ = self.type_
|
36
36
|
|
37
37
|
field_dict: dict[str, Any] = {}
|
38
38
|
field_dict.update(self.additional_properties)
|
@@ -43,13 +43,13 @@ class StoreFunctionParameter:
|
|
43
43
|
field_dict["name"] = name
|
44
44
|
if required is not UNSET:
|
45
45
|
field_dict["required"] = required
|
46
|
-
if
|
47
|
-
field_dict["type"] =
|
46
|
+
if type_ is not UNSET:
|
47
|
+
field_dict["type"] = type_
|
48
48
|
|
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()
|
@@ -59,13 +59,13 @@ class StoreFunctionParameter:
|
|
59
59
|
|
60
60
|
required = d.pop("required", UNSET)
|
61
61
|
|
62
|
-
|
62
|
+
type_ = d.pop("type", UNSET)
|
63
63
|
|
64
64
|
store_function_parameter = cls(
|
65
65
|
description=description,
|
66
66
|
name=name,
|
67
67
|
required=required,
|
68
|
-
|
68
|
+
type_=type_,
|
69
69
|
)
|
70
70
|
|
71
71
|
store_function_parameter.additional_properties = d
|
@@ -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
|
@@ -36,7 +36,7 @@ class UpdateWorkspaceServiceAccountBody:
|
|
36
36
|
return field_dict
|
37
37
|
|
38
38
|
@classmethod
|
39
|
-
def from_dict(cls:
|
39
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
40
40
|
if not src_dict:
|
41
41
|
return None
|
42
42
|
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
|
@@ -54,7 +54,7 @@ class UpdateWorkspaceServiceAccountResponse200:
|
|
54
54
|
return field_dict
|
55
55
|
|
56
56
|
@classmethod
|
57
|
-
def from_dict(cls:
|
57
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
58
58
|
if not src_dict:
|
59
59
|
return None
|
60
60
|
d = src_dict.copy()
|
@@ -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
|
@@ -30,7 +30,7 @@ class UpdateWorkspaceUserRoleBody:
|
|
30
30
|
return field_dict
|
31
31
|
|
32
32
|
@classmethod
|
33
|
-
def from_dict(cls:
|
33
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
34
34
|
if not src_dict:
|
35
35
|
return None
|
36
36
|
d = src_dict.copy()
|
beamlit/models/workspace.py
CHANGED
@@ -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
|
@@ -46,7 +46,7 @@ class Workspace:
|
|
46
46
|
|
47
47
|
display_name = self.display_name
|
48
48
|
|
49
|
-
labels: Union[Unset,
|
49
|
+
labels: Union[Unset, dict[str, Any]] = UNSET
|
50
50
|
if not isinstance(self.labels, Unset):
|
51
51
|
labels = self.labels.to_dict()
|
52
52
|
|
@@ -73,7 +73,7 @@ class Workspace:
|
|
73
73
|
return field_dict
|
74
74
|
|
75
75
|
@classmethod
|
76
|
-
def from_dict(cls:
|
76
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
77
77
|
from ..models.workspace_labels import WorkspaceLabels
|
78
78
|
|
79
79
|
if not src_dict:
|
@@ -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 WorkspaceLabels:
|
|
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/workspace_user.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
|
@@ -67,7 +67,7 @@ class WorkspaceUser:
|
|
67
67
|
return field_dict
|
68
68
|
|
69
69
|
@classmethod
|
70
|
-
def from_dict(cls:
|
70
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
71
71
|
if not src_dict:
|
72
72
|
return None
|
73
73
|
d = src_dict.copy()
|
beamlit/run.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import urllib.parse
|
2
|
-
from
|
3
|
-
from typing import Any, Callable, Dict, List, Optional
|
2
|
+
from typing import Any
|
4
3
|
|
5
4
|
import requests
|
5
|
+
|
6
6
|
from beamlit.client import AuthenticatedClient
|
7
7
|
from beamlit.common.settings import get_settings
|
8
8
|
|
@@ -18,10 +18,10 @@ class RunClient:
|
|
18
18
|
environment: str,
|
19
19
|
method: str,
|
20
20
|
path: str = "",
|
21
|
-
headers:
|
22
|
-
json:
|
23
|
-
data:
|
24
|
-
params:
|
21
|
+
headers: dict[str, str] | None = None,
|
22
|
+
json: dict[str, Any] | None = None,
|
23
|
+
data: str | None = None,
|
24
|
+
params: dict[str, str] | None = None,
|
25
25
|
) -> requests.Response:
|
26
26
|
settings = get_settings()
|
27
27
|
headers = headers or {}
|
beamlit/serve/app.py
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
import importlib
|
2
|
+
import traceback
|
3
|
+
from logging import getLogger
|
4
|
+
from uuid import uuid4
|
5
|
+
|
6
|
+
from asgi_correlation_id import CorrelationIdMiddleware
|
7
|
+
from fastapi import FastAPI, Request, Response
|
8
|
+
from fastapi.responses import JSONResponse
|
9
|
+
|
10
|
+
from beamlit.common.settings import get_settings, init
|
11
|
+
|
12
|
+
from .middlewares import AccessLogMiddleware, AddProcessTimeHeader
|
13
|
+
|
14
|
+
|
15
|
+
def import_module():
|
16
|
+
settings = get_settings()
|
17
|
+
main_module = importlib.import_module(".".join(settings.server.module.split(".")[0:-1]))
|
18
|
+
func = getattr(main_module, settings.server.module.split(".")[-1])
|
19
|
+
return func
|
20
|
+
|
21
|
+
|
22
|
+
settings = init()
|
23
|
+
logger = getLogger(__name__)
|
24
|
+
logger.info(f"Importing server module: {settings.server.module}")
|
25
|
+
func = import_module()
|
26
|
+
logger.info(
|
27
|
+
f"Running server with environment {settings.environment}"
|
28
|
+
f" on {settings.server.host}:{settings.server.port}"
|
29
|
+
)
|
30
|
+
|
31
|
+
app = FastAPI(docs_url=None, redoc_url=None)
|
32
|
+
app.add_middleware(
|
33
|
+
CorrelationIdMiddleware,
|
34
|
+
header_name="x-beamlit-request-id",
|
35
|
+
generator=lambda: str(uuid4()),
|
36
|
+
)
|
37
|
+
app.add_middleware(AddProcessTimeHeader)
|
38
|
+
app.add_middleware(AccessLogMiddleware)
|
39
|
+
|
40
|
+
|
41
|
+
@app.get("/health")
|
42
|
+
async def health():
|
43
|
+
return {"status": "ok"}
|
44
|
+
|
45
|
+
|
46
|
+
@app.post("/")
|
47
|
+
async def root(request: Request):
|
48
|
+
settings = get_settings()
|
49
|
+
logger = getLogger(__name__)
|
50
|
+
try:
|
51
|
+
body = await request.json()
|
52
|
+
response = await func(body)
|
53
|
+
if isinstance(response, Response):
|
54
|
+
return response
|
55
|
+
if type(response) is str:
|
56
|
+
return Response(
|
57
|
+
content=response,
|
58
|
+
headers={"Content-Type": "text/plain"},
|
59
|
+
media_type="text/plain",
|
60
|
+
status_code=200,
|
61
|
+
)
|
62
|
+
return JSONResponse(status_code=200, content=response)
|
63
|
+
except ValueError as e:
|
64
|
+
content = {"error": str(e)}
|
65
|
+
if settings.environment == "development":
|
66
|
+
content["traceback"] = str(traceback.format_exc())
|
67
|
+
logger.error(f"{content}")
|
68
|
+
return JSONResponse(status_code=400, content=content)
|
69
|
+
except Exception as e:
|
70
|
+
content = {"error": f"Internal server error, {e}"}
|
71
|
+
if settings.environment == "development":
|
72
|
+
content["traceback"] = str(traceback.format_exc())
|
73
|
+
return JSONResponse(status_code=500, content=content)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from logging import getLogger
|
2
|
+
|
3
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
4
|
+
|
5
|
+
|
6
|
+
class AccessLogMiddleware(BaseHTTPMiddleware):
|
7
|
+
async def dispatch(self, request, call_next):
|
8
|
+
logger = getLogger(__name__)
|
9
|
+
response = await call_next(request)
|
10
|
+
process_time = response.headers.get("X-Process-Time")
|
11
|
+
rid_header = response.headers.get("X-Request-Id")
|
12
|
+
request_id = rid_header or response.headers.get("X-Beamlit-Request-Id")
|
13
|
+
logger.info(f"{request.method} {request.url.path} {response.status_code} {process_time}ms rid={request_id}")
|
14
|
+
return response
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import time
|
2
|
+
|
3
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
4
|
+
|
5
|
+
|
6
|
+
class AddProcessTimeHeader(BaseHTTPMiddleware):
|
7
|
+
async def dispatch(self, request, call_next):
|
8
|
+
start_time = time.perf_counter()
|
9
|
+
response = await call_next(request)
|
10
|
+
process_time = (time.perf_counter() - start_time) * 1000
|
11
|
+
response.headers["X-Process-Time"] = f"{process_time:.2f}"
|
12
|
+
return response
|
@@ -1,11 +1,17 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: beamlit
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.20rc7
|
4
4
|
Summary: Add your description here
|
5
5
|
Author-email: cploujoux <ch.ploujoux@gmail.com>
|
6
6
|
Requires-Python: >=3.12
|
7
|
+
Requires-Dist: asgi-correlation-id<5.0.0,>=4.3.4
|
7
8
|
Requires-Dist: attrs>=21.3.0
|
9
|
+
Requires-Dist: fastapi[standard]<0.116.0,>=0.115.4
|
8
10
|
Requires-Dist: httpx<0.28.0,>=0.20.0
|
11
|
+
Requires-Dist: langchain-community<0.4.0,>=0.3.3
|
12
|
+
Requires-Dist: langchain-core<0.4.0,>=0.3.13
|
13
|
+
Requires-Dist: langchain-openai<0.3.0,>=0.2.4
|
14
|
+
Requires-Dist: langgraph<0.3.0,>=0.2.40
|
9
15
|
Requires-Dist: pydantic-settings<2.7.0,>=2.6.1
|
10
16
|
Requires-Dist: pydantic<2.11.0,>=2.10.3
|
11
17
|
Requires-Dist: python-dateutil>=2.8.0
|