beamlit 0.0.19__py3-none-any.whl → 0.0.20__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/create_agent.py +14 -9
- beamlit/api/agents/delete_agent_history.py +159 -0
- beamlit/api/agents/get_agent_deployment_logs.py +11 -11
- beamlit/api/{authentication_providers/list_organizations_for_authentication_provider.py → agents/get_agent_environment_logs.py} +30 -42
- beamlit/api/{authentication_providers/get_model_with_repo_for_authentication_provider.py → agents/get_agent_history.py} +43 -68
- beamlit/api/agents/list_agent_deployment_history.py +11 -11
- beamlit/api/agents/list_agent_deployments.py +11 -11
- beamlit/api/agents/list_agent_history.py +151 -0
- beamlit/api/agents/list_agents.py +11 -11
- beamlit/api/agents/put_agent_history.py +185 -0
- beamlit/api/agents/update_agent.py +14 -9
- beamlit/api/environments/list_environments.py +11 -11
- beamlit/api/functions/create_function.py +14 -9
- beamlit/api/functions/get_function_deployment_logs.py +11 -11
- beamlit/api/functions/get_function_environment_logs.py +151 -0
- beamlit/api/functions/list_function_deployments.py +11 -11
- beamlit/api/functions/list_functions.py +11 -11
- beamlit/api/functions/update_function.py +14 -9
- beamlit/api/history/get_agents_history.py +11 -11
- beamlit/api/history/list_agents_history.py +11 -11
- beamlit/api/integrations/create_integration_connection.py +167 -0
- beamlit/api/integrations/delete_integration_connection.py +158 -0
- beamlit/api/integrations/get_integration.py +97 -0
- beamlit/api/integrations/get_integration_connection.py +154 -0
- beamlit/api/integrations/get_integration_connection_model.py +97 -0
- beamlit/api/integrations/get_integration_model.py +97 -0
- beamlit/api/integrations/list_integration_connection_models.py +97 -0
- beamlit/api/integrations/list_integration_connections.py +139 -0
- beamlit/api/integrations/list_integration_models.py +97 -0
- beamlit/api/integrations/update_integration_connection.py +180 -0
- 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/{authentication_providers/list_models_for_authentication_provider.py → models/get_model_environment_logs.py} +30 -38
- 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 +29 -8
- beamlit/authentication/apikey.py +8 -2
- beamlit/authentication/authentication.py +66 -3
- beamlit/authentication/clientcredentials.py +108 -0
- beamlit/authentication/credentials.py +22 -8
- beamlit/authentication/device_mode.py +23 -13
- beamlit/common/__init__.py +13 -0
- beamlit/common/generate.py +183 -0
- beamlit/common/logger.py +29 -0
- beamlit/common/secrets.py +11 -0
- beamlit/common/settings.py +156 -0
- beamlit/common/utils.py +15 -0
- beamlit/functions/__init__.py +5 -0
- beamlit/functions/decorator.py +90 -0
- beamlit/functions/github/__init__.py +3 -0
- beamlit/functions/github/github.py +21 -0
- beamlit/functions/github/kit/__init__.py +7 -0
- beamlit/functions/github/kit/pull_request.py +51 -0
- beamlit/functions/math/__init__.py +3 -0
- beamlit/functions/math/math.py +40 -0
- beamlit/functions/search/__init__.py +3 -0
- beamlit/functions/search/search.py +15 -0
- beamlit/models/__init__.py +24 -0
- beamlit/models/acl.py +4 -2
- beamlit/models/agent.py +5 -3
- beamlit/models/agent_chain.py +4 -2
- beamlit/models/agent_configuration.py +4 -2
- beamlit/models/agent_deployment.py +41 -28
- beamlit/models/agent_deployment_configuration.py +4 -2
- beamlit/models/agent_deployment_configuration_type_0.py +43 -0
- beamlit/models/agent_deployment_history.py +7 -5
- beamlit/models/agent_deployment_history_event.py +11 -9
- beamlit/models/agent_deployment_pod_template.py +4 -2
- beamlit/models/agent_deployment_pod_template_type_0.py +43 -0
- beamlit/models/agent_history.py +165 -0
- beamlit/models/agent_history_event.py +131 -0
- beamlit/models/agent_metadata.py +144 -0
- beamlit/models/agent_release.py +4 -2
- beamlit/models/agent_spec.py +248 -0
- beamlit/models/agent_with_deployments.py +176 -0
- beamlit/models/api_key.py +4 -2
- beamlit/models/authentication_provider_model.py +8 -6
- beamlit/models/authentication_provider_organization.py +4 -2
- beamlit/models/configuration.py +12 -10
- beamlit/models/continent.py +4 -2
- beamlit/models/core_spec.py +185 -0
- beamlit/models/country.py +4 -2
- beamlit/models/create_api_key_for_service_account_body.py +4 -2
- beamlit/models/create_workspace_service_account_body.py +4 -2
- beamlit/models/create_workspace_service_account_response_200.py +4 -2
- beamlit/models/delete_workspace_service_account_response_200.py +4 -2
- beamlit/models/deployment_configuration.py +4 -2
- beamlit/models/deployment_configurations.py +22 -7
- beamlit/models/deployment_serverless_config.py +4 -2
- beamlit/models/deployment_serverless_config_type_0.py +220 -0
- beamlit/models/environment.py +9 -7
- beamlit/models/environment_metrics.py +26 -5
- beamlit/models/environment_spec.py +61 -0
- beamlit/models/flavor.py +11 -9
- beamlit/models/function.py +5 -3
- beamlit/models/function_configuration.py +4 -2
- beamlit/models/function_deployment.py +33 -20
- beamlit/models/function_deployment_configuration.py +4 -2
- beamlit/models/function_deployment_configuration_type_0.py +43 -0
- beamlit/models/function_deployment_pod_template.py +4 -2
- beamlit/models/function_deployment_pod_template_type_0.py +43 -0
- beamlit/models/function_kit.py +7 -5
- beamlit/models/function_metadata.py +144 -0
- beamlit/models/function_provider_ref.py +4 -2
- beamlit/models/function_release.py +4 -2
- beamlit/models/function_spec.py +246 -0
- beamlit/models/function_with_deployments.py +176 -0
- beamlit/models/get_workspace_service_accounts_response_200_item.py +4 -2
- beamlit/models/increase_and_rate_metric.py +104 -0
- beamlit/models/integration.py +198 -0
- beamlit/models/integration_config.py +45 -0
- beamlit/models/integration_connection.py +198 -0
- beamlit/models/integration_connection_config.py +45 -0
- beamlit/models/integration_connection_secret.py +61 -0
- beamlit/models/integration_connection_spec.py +99 -0
- beamlit/models/integration_model.py +144 -0
- beamlit/models/integration_secret.py +61 -0
- beamlit/models/invite_workspace_user_body.py +4 -2
- beamlit/models/labels_type_0.py +4 -2
- beamlit/models/location.py +7 -5
- beamlit/models/location_response.py +7 -5
- beamlit/models/metadata.py +135 -0
- beamlit/models/{labels.py → metadata_labels.py} +5 -5
- beamlit/models/metric.py +4 -2
- beamlit/models/metrics.py +68 -25
- beamlit/models/model.py +5 -3
- beamlit/models/model_deployment.py +27 -14
- beamlit/models/model_deployment_log.py +4 -2
- beamlit/models/model_deployment_metrics.py +11 -9
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +7 -5
- beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +5 -3
- beamlit/models/model_deployment_pod_template.py +4 -2
- beamlit/models/model_deployment_pod_template_type_0.py +43 -0
- beamlit/models/model_metadata.py +144 -0
- beamlit/models/model_metrics.py +8 -6
- beamlit/models/model_provider.py +13 -11
- beamlit/models/model_provider_ref.py +4 -2
- beamlit/models/model_release.py +4 -2
- beamlit/models/model_spec.py +194 -0
- beamlit/models/model_with_deployments.py +8 -6
- beamlit/models/owner_fields.py +68 -0
- beamlit/models/pending_invitation.py +4 -2
- beamlit/models/pending_invitation_accept.py +5 -3
- beamlit/models/pending_invitation_render.py +7 -5
- beamlit/models/pending_invitation_render_invited_by.py +4 -2
- beamlit/models/pending_invitation_render_workspace.py +4 -2
- beamlit/models/pending_invitation_workspace_details.py +8 -6
- beamlit/models/pod_template_spec.py +43 -0
- beamlit/models/policy.py +22 -20
- beamlit/models/policy_location.py +11 -9
- beamlit/models/policy_spec.py +125 -0
- beamlit/models/provider_config.py +9 -16
- beamlit/models/qps.py +4 -2
- beamlit/models/resource_deployment_log.py +4 -2
- beamlit/models/resource_deployment_metrics.py +119 -9
- beamlit/models/resource_deployment_metrics_inference_per_region.py +77 -0
- beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +79 -0
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +7 -5
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +79 -0
- beamlit/models/resource_deployment_metrics_query_per_region_per_code.py +75 -0
- beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +73 -0
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +5 -3
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +73 -0
- beamlit/models/resource_environment_metrics.py +210 -0
- beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +79 -0
- beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +73 -0
- beamlit/models/resource_log.py +68 -0
- beamlit/models/resource_metrics.py +44 -6
- beamlit/models/runtime.py +25 -23
- beamlit/models/runtime_readiness_probe.py +4 -2
- beamlit/models/runtime_readiness_probe_type_0.py +43 -0
- beamlit/models/runtime_resources.py +4 -2
- beamlit/models/runtime_type_0.py +111 -0
- beamlit/models/runtime_type_0_readiness_probe.py +43 -0
- beamlit/models/runtime_type_0_readiness_probe_type_0.py +43 -0
- beamlit/models/runtime_type_0_resources.py +59 -0
- beamlit/models/serverless_config.py +4 -2
- beamlit/models/spec_configuration.py +68 -0
- beamlit/models/standard_fields_dynamo_db.py +4 -2
- beamlit/models/store_agent.py +8 -6
- beamlit/models/store_agent_configuration.py +4 -2
- beamlit/models/store_agent_labels.py +4 -2
- beamlit/models/store_agent_labels_type_0.py +43 -0
- beamlit/models/store_configuration.py +18 -16
- beamlit/models/store_configuration_option.py +4 -2
- beamlit/models/store_function.py +14 -12
- beamlit/models/store_function_configuration.py +4 -2
- beamlit/models/store_function_kit.py +7 -5
- beamlit/models/store_function_labels.py +4 -2
- beamlit/models/store_function_labels_type_0.py +43 -0
- beamlit/models/store_function_parameter.py +11 -9
- beamlit/models/time_fields.py +68 -0
- beamlit/models/update_workspace_service_account_body.py +4 -2
- beamlit/models/update_workspace_service_account_response_200.py +4 -2
- beamlit/models/update_workspace_user_role_body.py +4 -2
- beamlit/models/websocket_channel.py +86 -0
- beamlit/models/workspace.py +5 -3
- beamlit/models/workspace_labels.py +4 -2
- beamlit/models/workspace_user.py +4 -2
- beamlit/run.py +49 -0
- beamlit/serve/app.py +78 -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.19.dist-info → beamlit-0.0.20.dist-info}/METADATA +11 -2
- beamlit-0.0.20.dist-info/RECORD +301 -0
- beamlit-0.0.19.dist-info/RECORD +0 -211
- /beamlit/api/{authentication_providers → integrations}/__init__.py +0 -0
- {beamlit-0.0.19.dist-info → beamlit-0.0.20.dist-info}/WHEEL +0 -0
@@ -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,15 @@ 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
|
+
if not src_dict:
|
54
|
+
return None
|
53
55
|
d = src_dict.copy()
|
54
56
|
description = d.pop("description", UNSET)
|
55
57
|
|
@@ -57,13 +59,13 @@ class StoreFunctionParameter:
|
|
57
59
|
|
58
60
|
required = d.pop("required", UNSET)
|
59
61
|
|
60
|
-
|
62
|
+
type_ = d.pop("type", UNSET)
|
61
63
|
|
62
64
|
store_function_parameter = cls(
|
63
65
|
description=description,
|
64
66
|
name=name,
|
65
67
|
required=required,
|
66
|
-
|
68
|
+
type_=type_,
|
67
69
|
)
|
68
70
|
|
69
71
|
store_function_parameter.additional_properties = d
|
@@ -0,0 +1,68 @@
|
|
1
|
+
from typing import Any, Type, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="TimeFields")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class TimeFields:
|
13
|
+
"""Time fields for Persistance
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
created_at (Union[Unset, str]): The date and time when the resource was created
|
17
|
+
updated_at (Union[Unset, str]): The date and time when the resource was updated
|
18
|
+
"""
|
19
|
+
|
20
|
+
created_at: Union[Unset, str] = UNSET
|
21
|
+
updated_at: Union[Unset, str] = UNSET
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
23
|
+
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
25
|
+
created_at = self.created_at
|
26
|
+
|
27
|
+
updated_at = self.updated_at
|
28
|
+
|
29
|
+
field_dict: dict[str, Any] = {}
|
30
|
+
field_dict.update(self.additional_properties)
|
31
|
+
field_dict.update({})
|
32
|
+
if created_at is not UNSET:
|
33
|
+
field_dict["createdAt"] = created_at
|
34
|
+
if updated_at is not UNSET:
|
35
|
+
field_dict["updatedAt"] = updated_at
|
36
|
+
|
37
|
+
return field_dict
|
38
|
+
|
39
|
+
@classmethod
|
40
|
+
def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
|
41
|
+
d = src_dict.copy()
|
42
|
+
created_at = d.pop("createdAt", UNSET)
|
43
|
+
|
44
|
+
updated_at = d.pop("updatedAt", UNSET)
|
45
|
+
|
46
|
+
time_fields = cls(
|
47
|
+
created_at=created_at,
|
48
|
+
updated_at=updated_at,
|
49
|
+
)
|
50
|
+
|
51
|
+
time_fields.additional_properties = d
|
52
|
+
return time_fields
|
53
|
+
|
54
|
+
@property
|
55
|
+
def additional_keys(self) -> list[str]:
|
56
|
+
return list(self.additional_properties.keys())
|
57
|
+
|
58
|
+
def __getitem__(self, key: str) -> Any:
|
59
|
+
return self.additional_properties[key]
|
60
|
+
|
61
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
62
|
+
self.additional_properties[key] = value
|
63
|
+
|
64
|
+
def __delitem__(self, key: str) -> None:
|
65
|
+
del self.additional_properties[key]
|
66
|
+
|
67
|
+
def __contains__(self, key: str) -> bool:
|
68
|
+
return key in self.additional_properties
|
@@ -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,9 @@ 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
|
+
if not src_dict:
|
41
|
+
return None
|
40
42
|
d = src_dict.copy()
|
41
43
|
description = d.pop("description", UNSET)
|
42
44
|
|
@@ -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,9 @@ 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
|
+
if not src_dict:
|
59
|
+
return None
|
58
60
|
d = src_dict.copy()
|
59
61
|
client_id = d.pop("client_id", UNSET)
|
60
62
|
|
@@ -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,9 @@ 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
|
+
if not src_dict:
|
35
|
+
return None
|
34
36
|
d = src_dict.copy()
|
35
37
|
role = d.pop("role")
|
36
38
|
|
@@ -0,0 +1,86 @@
|
|
1
|
+
from typing import Any, Type, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="WebsocketChannel")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class WebsocketChannel:
|
13
|
+
"""WebSocket connection details
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
created_at (Union[Unset, str]): The date and time when the resource was created
|
17
|
+
updated_at (Union[Unset, str]): The date and time when the resource was updated
|
18
|
+
connection_id (Union[Unset, str]): Unique connection ID
|
19
|
+
workspace (Union[Unset, str]): Workspace the connection belongs to
|
20
|
+
"""
|
21
|
+
|
22
|
+
created_at: Union[Unset, str] = UNSET
|
23
|
+
updated_at: Union[Unset, str] = UNSET
|
24
|
+
connection_id: Union[Unset, str] = UNSET
|
25
|
+
workspace: Union[Unset, str] = UNSET
|
26
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
27
|
+
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
29
|
+
created_at = self.created_at
|
30
|
+
|
31
|
+
updated_at = self.updated_at
|
32
|
+
|
33
|
+
connection_id = self.connection_id
|
34
|
+
|
35
|
+
workspace = self.workspace
|
36
|
+
|
37
|
+
field_dict: dict[str, Any] = {}
|
38
|
+
field_dict.update(self.additional_properties)
|
39
|
+
field_dict.update({})
|
40
|
+
if created_at is not UNSET:
|
41
|
+
field_dict["createdAt"] = created_at
|
42
|
+
if updated_at is not UNSET:
|
43
|
+
field_dict["updatedAt"] = updated_at
|
44
|
+
if connection_id is not UNSET:
|
45
|
+
field_dict["connection_id"] = connection_id
|
46
|
+
if workspace is not UNSET:
|
47
|
+
field_dict["workspace"] = workspace
|
48
|
+
|
49
|
+
return field_dict
|
50
|
+
|
51
|
+
@classmethod
|
52
|
+
def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
|
53
|
+
d = src_dict.copy()
|
54
|
+
created_at = d.pop("createdAt", UNSET)
|
55
|
+
|
56
|
+
updated_at = d.pop("updatedAt", UNSET)
|
57
|
+
|
58
|
+
connection_id = d.pop("connection_id", UNSET)
|
59
|
+
|
60
|
+
workspace = d.pop("workspace", UNSET)
|
61
|
+
|
62
|
+
websocket_channel = cls(
|
63
|
+
created_at=created_at,
|
64
|
+
updated_at=updated_at,
|
65
|
+
connection_id=connection_id,
|
66
|
+
workspace=workspace,
|
67
|
+
)
|
68
|
+
|
69
|
+
websocket_channel.additional_properties = d
|
70
|
+
return websocket_channel
|
71
|
+
|
72
|
+
@property
|
73
|
+
def additional_keys(self) -> list[str]:
|
74
|
+
return list(self.additional_properties.keys())
|
75
|
+
|
76
|
+
def __getitem__(self, key: str) -> Any:
|
77
|
+
return self.additional_properties[key]
|
78
|
+
|
79
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
80
|
+
self.additional_properties[key] = value
|
81
|
+
|
82
|
+
def __delitem__(self, key: str) -> None:
|
83
|
+
del self.additional_properties[key]
|
84
|
+
|
85
|
+
def __contains__(self, key: str) -> bool:
|
86
|
+
return key in self.additional_properties
|
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,9 +73,11 @@ 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
|
+
if not src_dict:
|
80
|
+
return None
|
79
81
|
d = src_dict.copy()
|
80
82
|
created_at = d.pop("created_at", UNSET)
|
81
83
|
|
@@ -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,9 @@ 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
|
+
if not src_dict:
|
24
|
+
return None
|
23
25
|
d = src_dict.copy()
|
24
26
|
workspace_labels = cls()
|
25
27
|
|
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,9 @@ 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
|
+
if not src_dict:
|
72
|
+
return None
|
71
73
|
d = src_dict.copy()
|
72
74
|
accepted = d.pop("accepted", UNSET)
|
73
75
|
|
beamlit/run.py
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
import urllib.parse
|
2
|
+
from typing import Any
|
3
|
+
|
4
|
+
import requests
|
5
|
+
|
6
|
+
from beamlit.client import AuthenticatedClient
|
7
|
+
from beamlit.common.settings import get_settings
|
8
|
+
|
9
|
+
|
10
|
+
class RunClient:
|
11
|
+
def __init__(self, client: AuthenticatedClient):
|
12
|
+
self.client = client
|
13
|
+
|
14
|
+
def run(
|
15
|
+
self,
|
16
|
+
resource_type: str,
|
17
|
+
resource_name: str,
|
18
|
+
environment: str,
|
19
|
+
method: str,
|
20
|
+
path: str = "",
|
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
|
+
) -> requests.Response:
|
26
|
+
settings = get_settings()
|
27
|
+
headers = headers or {}
|
28
|
+
params = params or {}
|
29
|
+
|
30
|
+
# Build the path
|
31
|
+
if path:
|
32
|
+
path = f"{settings.workspace}/{resource_type}s/{resource_name}/{path}"
|
33
|
+
else:
|
34
|
+
path = f"{settings.workspace}/{resource_type}s/{resource_name}"
|
35
|
+
|
36
|
+
client = self.client.get_httpx_client()
|
37
|
+
url = urllib.parse.urljoin(settings.run_url, path)
|
38
|
+
|
39
|
+
kwargs = {
|
40
|
+
"headers": headers,
|
41
|
+
"params": {"environment": environment, **params},
|
42
|
+
}
|
43
|
+
if data:
|
44
|
+
kwargs["data"] = data
|
45
|
+
if json:
|
46
|
+
kwargs["json"] = json
|
47
|
+
|
48
|
+
response = client.request(method, url, **kwargs)
|
49
|
+
return response
|
beamlit/serve/app.py
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
import importlib
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
import traceback
|
5
|
+
from logging import getLogger
|
6
|
+
from uuid import uuid4
|
7
|
+
|
8
|
+
from asgi_correlation_id import CorrelationIdMiddleware
|
9
|
+
from fastapi import FastAPI, Request, Response
|
10
|
+
from fastapi.responses import JSONResponse
|
11
|
+
|
12
|
+
from beamlit.common.settings import get_settings, init
|
13
|
+
|
14
|
+
from .middlewares import AccessLogMiddleware, AddProcessTimeHeader
|
15
|
+
|
16
|
+
sys.path.insert(0, os.getcwd())
|
17
|
+
sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
18
|
+
|
19
|
+
|
20
|
+
def import_module():
|
21
|
+
settings = get_settings()
|
22
|
+
main_module = importlib.import_module(".".join(settings.server.module.split(".")[0:-1]))
|
23
|
+
func = getattr(main_module, settings.server.module.split(".")[-1])
|
24
|
+
return func
|
25
|
+
|
26
|
+
|
27
|
+
settings = init()
|
28
|
+
logger = getLogger(__name__)
|
29
|
+
logger.info(f"Importing server module: {settings.server.module}")
|
30
|
+
func = import_module()
|
31
|
+
logger.info(
|
32
|
+
f"Running server with environment {settings.environment}"
|
33
|
+
f" on {settings.server.host}:{settings.server.port}"
|
34
|
+
)
|
35
|
+
|
36
|
+
app = FastAPI(docs_url=None, redoc_url=None)
|
37
|
+
app.add_middleware(
|
38
|
+
CorrelationIdMiddleware,
|
39
|
+
header_name="x-beamlit-request-id",
|
40
|
+
generator=lambda: str(uuid4()),
|
41
|
+
)
|
42
|
+
app.add_middleware(AddProcessTimeHeader)
|
43
|
+
app.add_middleware(AccessLogMiddleware)
|
44
|
+
|
45
|
+
|
46
|
+
@app.get("/health")
|
47
|
+
async def health():
|
48
|
+
return {"status": "ok"}
|
49
|
+
|
50
|
+
|
51
|
+
@app.post("/")
|
52
|
+
async def root(request: Request):
|
53
|
+
settings = get_settings()
|
54
|
+
logger = getLogger(__name__)
|
55
|
+
try:
|
56
|
+
body = await request.json()
|
57
|
+
response = await func(body)
|
58
|
+
if isinstance(response, Response):
|
59
|
+
return response
|
60
|
+
if type(response) is str:
|
61
|
+
return Response(
|
62
|
+
content=response,
|
63
|
+
headers={"Content-Type": "text/plain"},
|
64
|
+
media_type="text/plain",
|
65
|
+
status_code=200,
|
66
|
+
)
|
67
|
+
return JSONResponse(status_code=200, content=response)
|
68
|
+
except ValueError as e:
|
69
|
+
content = {"error": str(e)}
|
70
|
+
if settings.environment == "development":
|
71
|
+
content["traceback"] = str(traceback.format_exc())
|
72
|
+
logger.error(f"{content}")
|
73
|
+
return JSONResponse(status_code=400, content=content)
|
74
|
+
except Exception as e:
|
75
|
+
content = {"error": f"Internal server error, {e}"}
|
76
|
+
if settings.environment == "development":
|
77
|
+
content["traceback"] = str(traceback.format_exc())
|
78
|
+
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,13 +1,22 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: beamlit
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.20
|
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
|
15
|
+
Requires-Dist: pydantic-settings<2.7.0,>=2.6.1
|
16
|
+
Requires-Dist: pydantic<2.11.0,>=2.10.3
|
9
17
|
Requires-Dist: python-dateutil>=2.8.0
|
10
|
-
Requires-Dist: pyyaml
|
18
|
+
Requires-Dist: pyyaml<6.1.0,>=6.0.2
|
19
|
+
Requires-Dist: requests<2.33.0,>=2.32.3
|
11
20
|
Description-Content-Type: text/markdown
|
12
21
|
|
13
22
|
# beamlit
|