beamlit 0.0.56rc106__py3-none-any.whl → 0.0.57__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- beamlit/agents/chain.py +0 -2
- beamlit/agents/chat.py +20 -8
- beamlit/agents/decorator.py +112 -99
- beamlit/agents/thread.py +5 -9
- beamlit/api/agents/delete_agent.py +1 -22
- beamlit/api/agents/get_agent.py +1 -22
- beamlit/api/agents/get_agent_metrics.py +13 -34
- beamlit/api/agents/get_agent_trace_ids.py +44 -14
- beamlit/api/agents/{list_agent_history.py → list_agent_revisions.py} +21 -17
- beamlit/api/agents/list_agents.py +4 -36
- beamlit/api/default/get_trace_ids.py +0 -15
- beamlit/api/default/list_mcp_hub_definitions.py +12 -12
- beamlit/api/functions/delete_function.py +1 -22
- beamlit/api/functions/get_function.py +1 -22
- beamlit/api/functions/get_function_metrics.py +13 -34
- beamlit/api/functions/get_function_trace_ids.py +44 -14
- beamlit/api/functions/{create_function_release.py → list_function_revisions.py} +26 -18
- beamlit/api/functions/list_functions.py +4 -36
- beamlit/api/knowledgebases/create_knowledgebase.py +4 -4
- beamlit/api/knowledgebases/delete_knowledgebase.py +5 -26
- beamlit/api/knowledgebases/get_knowledgebase.py +1 -22
- beamlit/api/{environments/get_environment_metrics.py → knowledgebases/list_knowledgebase_revisions.py} +34 -34
- beamlit/api/knowledgebases/list_knowledgebases.py +4 -36
- beamlit/api/models/create_model.py +4 -8
- beamlit/api/models/delete_model.py +1 -22
- beamlit/api/models/get_model.py +1 -22
- beamlit/api/models/get_model_metrics.py +13 -34
- beamlit/api/models/get_model_trace_ids.py +44 -14
- beamlit/api/models/{release_model.py → list_model_revisions.py} +26 -22
- beamlit/api/models/list_models.py +4 -36
- beamlit/api/models/update_model.py +4 -8
- beamlit/authentication/authentication.py +11 -8
- beamlit/authentication/clientcredentials.py +15 -28
- beamlit/authentication/credentials.py +2 -7
- beamlit/common/settings.py +1 -4
- beamlit/deploy/deploy.py +15 -9
- beamlit/functions/common.py +16 -16
- beamlit/functions/local/local.py +4 -5
- beamlit/functions/mcp/client.py +96 -0
- beamlit/functions/mcp/mcp.py +56 -43
- beamlit/functions/remote/remote.py +9 -11
- beamlit/models/__init__.py +8 -38
- beamlit/models/agent.py +6 -6
- beamlit/models/function.py +6 -6
- beamlit/models/knowledgebase.py +6 -6
- beamlit/models/last_n_requests_metric.py +0 -9
- beamlit/models/model.py +7 -7
- beamlit/models/{resource_environment_metrics.py → resource_metrics.py} +20 -26
- beamlit/models/{resource_environment_metrics_request_total_per_code.py → resource_metrics_request_total_per_code.py} +5 -5
- beamlit/models/{resource_environment_metrics_rps_per_code.py → resource_metrics_rps_per_code.py} +5 -5
- beamlit/models/{model_release.py → revision_metadata.py} +20 -20
- beamlit/models/runtime.py +2 -2
- beamlit/models/workspace.py +0 -9
- beamlit/run.py +3 -7
- beamlit/serve/app.py +4 -8
- {beamlit-0.0.56rc106.dist-info → beamlit-0.0.57.dist-info}/METADATA +2 -1
- {beamlit-0.0.56rc106.dist-info → beamlit-0.0.57.dist-info}/RECORD +63 -91
- beamlit/api/agents/create_agent_release.py +0 -146
- beamlit/api/agents/delete_agent_history.py +0 -155
- beamlit/api/agents/get_agent_history.py +0 -155
- beamlit/api/agents/put_agent_history.py +0 -181
- beamlit/api/environments/__init__.py +0 -0
- beamlit/api/environments/create_environment.py +0 -167
- beamlit/api/environments/delete_environment.py +0 -154
- beamlit/api/environments/get_environment.py +0 -154
- beamlit/api/environments/list_environments.py +0 -139
- beamlit/api/environments/update_environment.py +0 -180
- beamlit/api/generation/__init__.py +0 -0
- beamlit/api/generation/run_information_generation_agent.py +0 -168
- beamlit/api/history/__init__.py +0 -0
- beamlit/api/history/get_agents_history.py +0 -155
- beamlit/api/history/list_agents_history.py +0 -131
- beamlit/models/agent_history.py +0 -167
- beamlit/models/agent_history_event.py +0 -133
- beamlit/models/agent_information_request.py +0 -63
- beamlit/models/agent_information_response.py +0 -79
- beamlit/models/agent_release.py +0 -70
- beamlit/models/environment.py +0 -96
- beamlit/models/environment_metadata.py +0 -148
- beamlit/models/environment_metrics.py +0 -77
- beamlit/models/environment_spec.py +0 -63
- beamlit/models/function_release.py +0 -70
- beamlit/models/knowledgebase_release.py +0 -70
- beamlit/models/mcp_hub_artifact.py +0 -188
- beamlit/models/mcp_hub_artifact_entrypoint.py +0 -45
- beamlit/models/mcp_hub_artifact_form.py +0 -45
- /beamlit/api/agents/{get_agent_environment_logs.py → get_agent_logs.py} +0 -0
- /beamlit/api/functions/{get_function_environment_logs.py → get_function_logs.py} +0 -0
- /beamlit/api/models/{get_model_environment_logs.py → get_model_logs.py} +0 -0
- {beamlit-0.0.56rc106.dist-info → beamlit-0.0.57.dist-info}/WHEEL +0 -0
- {beamlit-0.0.56rc106.dist-info → beamlit-0.0.57.dist-info}/entry_points.txt +0 -0
- {beamlit-0.0.56rc106.dist-info → beamlit-0.0.57.dist-info}/licenses/LICENSE +0 -0
beamlit/models/model.py
CHANGED
@@ -7,7 +7,7 @@ from ..types import UNSET, Unset
|
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
9
|
from ..models.core_event import CoreEvent
|
10
|
-
from ..models.
|
10
|
+
from ..models.metadata import Metadata
|
11
11
|
from ..models.model_spec import ModelSpec
|
12
12
|
|
13
13
|
|
@@ -16,17 +16,17 @@ T = TypeVar("T", bound="Model")
|
|
16
16
|
|
17
17
|
@_attrs_define
|
18
18
|
class Model:
|
19
|
-
"""Logical object representing a model
|
19
|
+
"""Logical object representing a model
|
20
20
|
|
21
21
|
Attributes:
|
22
22
|
events (Union[Unset, list['CoreEvent']]): Core events
|
23
|
-
metadata (Union[Unset,
|
23
|
+
metadata (Union[Unset, Metadata]): Metadata
|
24
24
|
spec (Union[Unset, ModelSpec]): Model specification
|
25
25
|
status (Union[Unset, str]): Model status
|
26
26
|
"""
|
27
27
|
|
28
28
|
events: Union[Unset, list["CoreEvent"]] = UNSET
|
29
|
-
metadata: Union[Unset, "
|
29
|
+
metadata: Union[Unset, "Metadata"] = UNSET
|
30
30
|
spec: Union[Unset, "ModelSpec"] = UNSET
|
31
31
|
status: Union[Unset, str] = UNSET
|
32
32
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
@@ -70,7 +70,7 @@ class Model:
|
|
70
70
|
@classmethod
|
71
71
|
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
72
72
|
from ..models.core_event import CoreEvent
|
73
|
-
from ..models.
|
73
|
+
from ..models.metadata import Metadata
|
74
74
|
from ..models.model_spec import ModelSpec
|
75
75
|
|
76
76
|
if not src_dict:
|
@@ -84,11 +84,11 @@ class Model:
|
|
84
84
|
events.append(componentsschemas_core_events_item)
|
85
85
|
|
86
86
|
_metadata = d.pop("metadata", UNSET)
|
87
|
-
metadata: Union[Unset,
|
87
|
+
metadata: Union[Unset, Metadata]
|
88
88
|
if isinstance(_metadata, Unset):
|
89
89
|
metadata = UNSET
|
90
90
|
else:
|
91
|
-
metadata =
|
91
|
+
metadata = Metadata.from_dict(_metadata)
|
92
92
|
|
93
93
|
_spec = d.pop("spec", UNSET)
|
94
94
|
spec: Union[Unset, ModelSpec]
|
@@ -10,21 +10,17 @@ if TYPE_CHECKING:
|
|
10
10
|
from ..models.metric import Metric
|
11
11
|
from ..models.request_duration_over_time_metrics import RequestDurationOverTimeMetrics
|
12
12
|
from ..models.request_total_by_origin_metric import RequestTotalByOriginMetric
|
13
|
-
from ..models.
|
14
|
-
|
15
|
-
)
|
16
|
-
from ..models.resource_environment_metrics_rps_per_code import (
|
17
|
-
ResourceEnvironmentMetricsRpsPerCode,
|
18
|
-
)
|
13
|
+
from ..models.resource_metrics_request_total_per_code import ResourceMetricsRequestTotalPerCode
|
14
|
+
from ..models.resource_metrics_rps_per_code import ResourceMetricsRpsPerCode
|
19
15
|
from ..models.token_rate_metrics import TokenRateMetrics
|
20
16
|
from ..models.token_total_metric import TokenTotalMetric
|
21
17
|
|
22
18
|
|
23
|
-
T = TypeVar("T", bound="
|
19
|
+
T = TypeVar("T", bound="ResourceMetrics")
|
24
20
|
|
25
21
|
|
26
22
|
@_attrs_define
|
27
|
-
class
|
23
|
+
class ResourceMetrics:
|
28
24
|
"""Metrics for a single resource deployment (eg. model deployment, function deployment)
|
29
25
|
|
30
26
|
Attributes:
|
@@ -34,11 +30,11 @@ class ResourceEnvironmentMetrics:
|
|
34
30
|
request_duration_over_time (Union[Unset, RequestDurationOverTimeMetrics]): Request duration over time metrics
|
35
31
|
request_total (Union[Unset, float]): Number of requests for the resource globally
|
36
32
|
request_total_by_origin (Union[Unset, RequestTotalByOriginMetric]): Request total by origin metric
|
37
|
-
request_total_per_code (Union[Unset,
|
38
|
-
|
33
|
+
request_total_per_code (Union[Unset, ResourceMetricsRequestTotalPerCode]): Number of requests for the resource
|
34
|
+
globally per code
|
39
35
|
rps (Union[Unset, float]): Number of requests per second for the resource globally
|
40
|
-
rps_per_code (Union[Unset,
|
41
|
-
|
36
|
+
rps_per_code (Union[Unset, ResourceMetricsRpsPerCode]): Number of requests per second for the resource globally
|
37
|
+
per code
|
42
38
|
token_rate (Union[Unset, TokenRateMetrics]): Token rate metrics
|
43
39
|
token_total (Union[Unset, TokenTotalMetric]): Token total metric
|
44
40
|
"""
|
@@ -49,9 +45,9 @@ class ResourceEnvironmentMetrics:
|
|
49
45
|
request_duration_over_time: Union[Unset, "RequestDurationOverTimeMetrics"] = UNSET
|
50
46
|
request_total: Union[Unset, float] = UNSET
|
51
47
|
request_total_by_origin: Union[Unset, "RequestTotalByOriginMetric"] = UNSET
|
52
|
-
request_total_per_code: Union[Unset, "
|
48
|
+
request_total_per_code: Union[Unset, "ResourceMetricsRequestTotalPerCode"] = UNSET
|
53
49
|
rps: Union[Unset, float] = UNSET
|
54
|
-
rps_per_code: Union[Unset, "
|
50
|
+
rps_per_code: Union[Unset, "ResourceMetricsRpsPerCode"] = UNSET
|
55
51
|
token_rate: Union[Unset, "TokenRateMetrics"] = UNSET
|
56
52
|
token_total: Union[Unset, "TokenTotalMetric"] = UNSET
|
57
53
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
@@ -163,12 +159,10 @@ class ResourceEnvironmentMetrics:
|
|
163
159
|
from ..models.metric import Metric
|
164
160
|
from ..models.request_duration_over_time_metrics import RequestDurationOverTimeMetrics
|
165
161
|
from ..models.request_total_by_origin_metric import RequestTotalByOriginMetric
|
166
|
-
from ..models.
|
167
|
-
|
168
|
-
)
|
169
|
-
from ..models.resource_environment_metrics_rps_per_code import (
|
170
|
-
ResourceEnvironmentMetricsRpsPerCode,
|
162
|
+
from ..models.resource_metrics_request_total_per_code import (
|
163
|
+
ResourceMetricsRequestTotalPerCode,
|
171
164
|
)
|
165
|
+
from ..models.resource_metrics_rps_per_code import ResourceMetricsRpsPerCode
|
172
166
|
from ..models.token_rate_metrics import TokenRateMetrics
|
173
167
|
from ..models.token_total_metric import TokenTotalMetric
|
174
168
|
|
@@ -213,20 +207,20 @@ class ResourceEnvironmentMetrics:
|
|
213
207
|
request_total_by_origin = RequestTotalByOriginMetric.from_dict(_request_total_by_origin)
|
214
208
|
|
215
209
|
_request_total_per_code = d.pop("requestTotalPerCode", UNSET)
|
216
|
-
request_total_per_code: Union[Unset,
|
210
|
+
request_total_per_code: Union[Unset, ResourceMetricsRequestTotalPerCode]
|
217
211
|
if isinstance(_request_total_per_code, Unset):
|
218
212
|
request_total_per_code = UNSET
|
219
213
|
else:
|
220
|
-
request_total_per_code =
|
214
|
+
request_total_per_code = ResourceMetricsRequestTotalPerCode.from_dict(_request_total_per_code)
|
221
215
|
|
222
216
|
rps = d.pop("rps", UNSET)
|
223
217
|
|
224
218
|
_rps_per_code = d.pop("rpsPerCode", UNSET)
|
225
|
-
rps_per_code: Union[Unset,
|
219
|
+
rps_per_code: Union[Unset, ResourceMetricsRpsPerCode]
|
226
220
|
if isinstance(_rps_per_code, Unset):
|
227
221
|
rps_per_code = UNSET
|
228
222
|
else:
|
229
|
-
rps_per_code =
|
223
|
+
rps_per_code = ResourceMetricsRpsPerCode.from_dict(_rps_per_code)
|
230
224
|
|
231
225
|
_token_rate = d.pop("tokenRate", UNSET)
|
232
226
|
token_rate: Union[Unset, TokenRateMetrics]
|
@@ -242,7 +236,7 @@ class ResourceEnvironmentMetrics:
|
|
242
236
|
else:
|
243
237
|
token_total = TokenTotalMetric.from_dict(_token_total)
|
244
238
|
|
245
|
-
|
239
|
+
resource_metrics = cls(
|
246
240
|
inference_global=inference_global,
|
247
241
|
last_n_requests=last_n_requests,
|
248
242
|
latency=latency,
|
@@ -256,8 +250,8 @@ class ResourceEnvironmentMetrics:
|
|
256
250
|
token_total=token_total,
|
257
251
|
)
|
258
252
|
|
259
|
-
|
260
|
-
return
|
253
|
+
resource_metrics.additional_properties = d
|
254
|
+
return resource_metrics
|
261
255
|
|
262
256
|
@property
|
263
257
|
def additional_keys(self) -> list[str]:
|
@@ -3,11 +3,11 @@ from typing import Any, TypeVar
|
|
3
3
|
from attrs import define as _attrs_define
|
4
4
|
from attrs import field as _attrs_field
|
5
5
|
|
6
|
-
T = TypeVar("T", bound="
|
6
|
+
T = TypeVar("T", bound="ResourceMetricsRequestTotalPerCode")
|
7
7
|
|
8
8
|
|
9
9
|
@_attrs_define
|
10
|
-
class
|
10
|
+
class ResourceMetricsRequestTotalPerCode:
|
11
11
|
"""Number of requests for the resource globally per code"""
|
12
12
|
|
13
13
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
@@ -23,10 +23,10 @@ class ResourceEnvironmentMetricsRequestTotalPerCode:
|
|
23
23
|
if not src_dict:
|
24
24
|
return None
|
25
25
|
d = src_dict.copy()
|
26
|
-
|
26
|
+
resource_metrics_request_total_per_code = cls()
|
27
27
|
|
28
|
-
|
29
|
-
return
|
28
|
+
resource_metrics_request_total_per_code.additional_properties = d
|
29
|
+
return resource_metrics_request_total_per_code
|
30
30
|
|
31
31
|
@property
|
32
32
|
def additional_keys(self) -> list[str]:
|
beamlit/models/{resource_environment_metrics_rps_per_code.py → resource_metrics_rps_per_code.py}
RENAMED
@@ -3,11 +3,11 @@ from typing import Any, TypeVar
|
|
3
3
|
from attrs import define as _attrs_define
|
4
4
|
from attrs import field as _attrs_field
|
5
5
|
|
6
|
-
T = TypeVar("T", bound="
|
6
|
+
T = TypeVar("T", bound="ResourceMetricsRpsPerCode")
|
7
7
|
|
8
8
|
|
9
9
|
@_attrs_define
|
10
|
-
class
|
10
|
+
class ResourceMetricsRpsPerCode:
|
11
11
|
"""Number of requests per second for the resource globally per code"""
|
12
12
|
|
13
13
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
@@ -23,10 +23,10 @@ class ResourceEnvironmentMetricsRpsPerCode:
|
|
23
23
|
if not src_dict:
|
24
24
|
return None
|
25
25
|
d = src_dict.copy()
|
26
|
-
|
26
|
+
resource_metrics_rps_per_code = cls()
|
27
27
|
|
28
|
-
|
29
|
-
return
|
28
|
+
resource_metrics_rps_per_code.additional_properties = d
|
29
|
+
return resource_metrics_rps_per_code
|
30
30
|
|
31
31
|
@property
|
32
32
|
def additional_keys(self) -> list[str]:
|
@@ -5,34 +5,34 @@ from attrs import field as _attrs_field
|
|
5
5
|
|
6
6
|
from ..types import UNSET, Unset
|
7
7
|
|
8
|
-
T = TypeVar("T", bound="
|
8
|
+
T = TypeVar("T", bound="RevisionMetadata")
|
9
9
|
|
10
10
|
|
11
11
|
@_attrs_define
|
12
|
-
class
|
13
|
-
"""
|
12
|
+
class RevisionMetadata:
|
13
|
+
"""Revision metadata
|
14
14
|
|
15
15
|
Attributes:
|
16
|
-
|
17
|
-
|
16
|
+
created_at (Union[Unset, str]): Revision created at
|
17
|
+
id (Union[Unset, str]): Revision ID
|
18
18
|
"""
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
created_at: Union[Unset, str] = UNSET
|
21
|
+
id: Union[Unset, str] = UNSET
|
22
22
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
23
23
|
|
24
24
|
def to_dict(self) -> dict[str, Any]:
|
25
|
-
|
25
|
+
created_at = self.created_at
|
26
26
|
|
27
|
-
|
27
|
+
id = self.id
|
28
28
|
|
29
29
|
field_dict: dict[str, Any] = {}
|
30
30
|
field_dict.update(self.additional_properties)
|
31
31
|
field_dict.update({})
|
32
|
-
if
|
33
|
-
field_dict["
|
34
|
-
if
|
35
|
-
field_dict["
|
32
|
+
if created_at is not UNSET:
|
33
|
+
field_dict["createdAt"] = created_at
|
34
|
+
if id is not UNSET:
|
35
|
+
field_dict["id"] = id
|
36
36
|
|
37
37
|
return field_dict
|
38
38
|
|
@@ -41,17 +41,17 @@ class ModelRelease:
|
|
41
41
|
if not src_dict:
|
42
42
|
return None
|
43
43
|
d = src_dict.copy()
|
44
|
-
|
44
|
+
created_at = d.pop("createdAt", UNSET)
|
45
45
|
|
46
|
-
|
46
|
+
id = d.pop("id", UNSET)
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
revision_metadata = cls(
|
49
|
+
created_at=created_at,
|
50
|
+
id=id,
|
51
51
|
)
|
52
52
|
|
53
|
-
|
54
|
-
return
|
53
|
+
revision_metadata.additional_properties = d
|
54
|
+
return revision_metadata
|
55
55
|
|
56
56
|
@property
|
57
57
|
def additional_keys(self) -> list[str]:
|
beamlit/models/runtime.py
CHANGED
@@ -22,8 +22,8 @@ class Runtime:
|
|
22
22
|
command (Union[Unset, list[Any]]): The command to run the deployment
|
23
23
|
endpoint_name (Union[Unset, str]): Endpoint Name of the model. In case of hf_private_endpoint, it is the
|
24
24
|
endpoint name. In case of hf_public_endpoint, it is not used.
|
25
|
-
envs (Union[Unset, list[Any]]): The
|
26
|
-
|
25
|
+
envs (Union[Unset, list[Any]]): The env variables to set in the deployment. Should be a list of Kubernetes
|
26
|
+
EnvVar types
|
27
27
|
image (Union[Unset, str]): The Docker image for the deployment
|
28
28
|
metric_port (Union[Unset, int]): The port to serve the metrics on
|
29
29
|
model (Union[Unset, str]): The slug name of the origin model at HuggingFace.
|
beamlit/models/workspace.py
CHANGED
@@ -22,7 +22,6 @@ class Workspace:
|
|
22
22
|
created_by (Union[Unset, str]): The user or service account who created the resource
|
23
23
|
updated_by (Union[Unset, str]): The user or service account who updated the resource
|
24
24
|
account_id (Union[Unset, str]): Workspace account id
|
25
|
-
default_environment (Union[Unset, str]): Workspace environment
|
26
25
|
display_name (Union[Unset, str]): Workspace display name
|
27
26
|
labels (Union[Unset, WorkspaceLabels]): Workspace labels
|
28
27
|
name (Union[Unset, str]): Workspace name
|
@@ -34,7 +33,6 @@ class Workspace:
|
|
34
33
|
created_by: Union[Unset, str] = UNSET
|
35
34
|
updated_by: Union[Unset, str] = UNSET
|
36
35
|
account_id: Union[Unset, str] = UNSET
|
37
|
-
default_environment: Union[Unset, str] = UNSET
|
38
36
|
display_name: Union[Unset, str] = UNSET
|
39
37
|
labels: Union[Unset, "WorkspaceLabels"] = UNSET
|
40
38
|
name: Union[Unset, str] = UNSET
|
@@ -52,8 +50,6 @@ class Workspace:
|
|
52
50
|
|
53
51
|
account_id = self.account_id
|
54
52
|
|
55
|
-
default_environment = self.default_environment
|
56
|
-
|
57
53
|
display_name = self.display_name
|
58
54
|
|
59
55
|
labels: Union[Unset, dict[str, Any]] = UNSET
|
@@ -79,8 +75,6 @@ class Workspace:
|
|
79
75
|
field_dict["updatedBy"] = updated_by
|
80
76
|
if account_id is not UNSET:
|
81
77
|
field_dict["accountId"] = account_id
|
82
|
-
if default_environment is not UNSET:
|
83
|
-
field_dict["defaultEnvironment"] = default_environment
|
84
78
|
if display_name is not UNSET:
|
85
79
|
field_dict["displayName"] = display_name
|
86
80
|
if labels is not UNSET:
|
@@ -109,8 +103,6 @@ class Workspace:
|
|
109
103
|
|
110
104
|
account_id = d.pop("accountId", UNSET)
|
111
105
|
|
112
|
-
default_environment = d.pop("defaultEnvironment", UNSET)
|
113
|
-
|
114
106
|
display_name = d.pop("displayName", UNSET)
|
115
107
|
|
116
108
|
_labels = d.pop("labels", UNSET)
|
@@ -130,7 +122,6 @@ class Workspace:
|
|
130
122
|
created_by=created_by,
|
131
123
|
updated_by=updated_by,
|
132
124
|
account_id=account_id,
|
133
|
-
default_environment=default_environment,
|
134
125
|
display_name=display_name,
|
135
126
|
labels=labels,
|
136
127
|
name=name,
|
beamlit/run.py
CHANGED
@@ -14,8 +14,7 @@ class RunClient:
|
|
14
14
|
"""Provides functionality for executing HTTP requests against Beamlit resources.
|
15
15
|
|
16
16
|
This module contains the RunClient class which handles authenticated HTTP requests to Beamlit
|
17
|
-
resources. It allows users to interact with different resource types (like functions or services)
|
18
|
-
in specific environments, supporting various HTTP methods and request parameters.
|
17
|
+
resources. It allows users to interact with different resource types (like functions or services), supporting various HTTP methods and request parameters.
|
19
18
|
|
20
19
|
Example:
|
21
20
|
```python
|
@@ -24,7 +23,6 @@ class RunClient:
|
|
24
23
|
response = run_client.run(
|
25
24
|
resource_type="function",
|
26
25
|
resource_name="my-function",
|
27
|
-
environment="prod",
|
28
26
|
method="POST",
|
29
27
|
json={"key": "value"}
|
30
28
|
)
|
@@ -41,7 +39,6 @@ class RunClient:
|
|
41
39
|
self,
|
42
40
|
resource_type: str,
|
43
41
|
resource_name: str,
|
44
|
-
environment: str,
|
45
42
|
method: str,
|
46
43
|
path: str = "",
|
47
44
|
headers: dict[str, str] | None = None,
|
@@ -56,7 +53,6 @@ class RunClient:
|
|
56
53
|
Args:
|
57
54
|
resource_type (str): The type of resource to interact with (e.g., 'function', 'service').
|
58
55
|
resource_name (str): The name of the specific resource.
|
59
|
-
environment (str): The environment to execute the request in.
|
60
56
|
method (str): The HTTP method to use (e.g., 'GET', 'POST', 'PUT', 'DELETE').
|
61
57
|
path (str, optional): Additional path segments to append to the resource URL. Defaults to "".
|
62
58
|
headers (dict[str, str] | None, optional): HTTP headers to include in the request. Defaults to None.
|
@@ -78,7 +74,7 @@ class RunClient:
|
|
78
74
|
|
79
75
|
if cloud and path and service_name:
|
80
76
|
url = f"https://{service_name}.{settings.run_internal_hostname}/{path}"
|
81
|
-
|
77
|
+
|
82
78
|
if cloud and not path and service_name:
|
83
79
|
url = f"https://{service_name}.{settings.run_internal_hostname}"
|
84
80
|
|
@@ -90,7 +86,7 @@ class RunClient:
|
|
90
86
|
|
91
87
|
kwargs = {
|
92
88
|
"headers": headers,
|
93
|
-
"params": {
|
89
|
+
"params": {**params},
|
94
90
|
}
|
95
91
|
if data:
|
96
92
|
kwargs["data"] = data
|
beamlit/serve/app.py
CHANGED
@@ -44,7 +44,7 @@ logger = getLogger(__name__)
|
|
44
44
|
logger.info(f"Importing server module: {settings.server.module}")
|
45
45
|
func = import_module()
|
46
46
|
logger.info(
|
47
|
-
f"Running server
|
47
|
+
f"Running server"
|
48
48
|
f" on {settings.server.host}:{settings.server.port}"
|
49
49
|
)
|
50
50
|
func_params = inspect.signature(func).parameters
|
@@ -96,7 +96,6 @@ if websocket_detected:
|
|
96
96
|
else:
|
97
97
|
@app.post("/")
|
98
98
|
async def root(request: Request):
|
99
|
-
settings = get_settings()
|
100
99
|
logger = getLogger(__name__)
|
101
100
|
try:
|
102
101
|
original_func = getattr(func, "__wrapped__", func)
|
@@ -117,19 +116,16 @@ else:
|
|
117
116
|
return JSONResponse(status_code=200, content=response)
|
118
117
|
except ValueError as e:
|
119
118
|
content = {"error": str(e)}
|
120
|
-
|
121
|
-
content["traceback"] = str(traceback.format_exc())
|
119
|
+
content["traceback"] = str(traceback.format_exc())
|
122
120
|
logger.error(str(traceback.format_exc()))
|
123
121
|
return JSONResponse(status_code=400, content=content)
|
124
122
|
except HTTPError as e:
|
125
123
|
content = {"error": e.message, "status_code": e.status_code}
|
126
|
-
|
127
|
-
content["traceback"] = str(traceback.format_exc())
|
124
|
+
content["traceback"] = str(traceback.format_exc())
|
128
125
|
logger.error(f"{e.status_code} {str(traceback.format_exc())}")
|
129
126
|
return JSONResponse(status_code=e.status_code, content=content)
|
130
127
|
except Exception as e:
|
131
128
|
content = {"error": f"Internal server error, {e}"}
|
132
|
-
|
133
|
-
content["traceback"] = str(traceback.format_exc())
|
129
|
+
content["traceback"] = str(traceback.format_exc())
|
134
130
|
logger.error(str(traceback.format_exc()))
|
135
131
|
return JSONResponse(status_code=500, content=content)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: beamlit
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.57
|
4
4
|
Summary: Add your description here
|
5
5
|
Author-email: cploujoux <ch.ploujoux@gmail.com>
|
6
6
|
License-File: LICENSE
|
@@ -43,6 +43,7 @@ Requires-Dist: pyjwt>=2.10.1
|
|
43
43
|
Requires-Dist: python-dateutil>=2.8.0
|
44
44
|
Requires-Dist: pyyaml<6.1.0,>=6.0.2
|
45
45
|
Requires-Dist: requests<2.33.0,>=2.32.3
|
46
|
+
Requires-Dist: websocket>=0.2.1
|
46
47
|
Requires-Dist: websockets>=14.1
|
47
48
|
Description-Content-Type: text/markdown
|
48
49
|
|