beamlit 0.0.33rc49__py3-none-any.whl → 0.0.34__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/__init__.py +2 -1
- beamlit/agents/chat.py +16 -4
- beamlit/agents/decorator.py +68 -155
- beamlit/agents/thread.py +14 -0
- beamlit/api/workspaces/workspace_quotas_request.py +97 -0
- beamlit/authentication/clientcredentials.py +5 -3
- beamlit/authentication/device_mode.py +4 -4
- beamlit/common/__init__.py +1 -2
- beamlit/common/instrumentation.py +202 -34
- beamlit/common/settings.py +7 -64
- beamlit/deploy/deploy.py +64 -60
- beamlit/deploy/format.py +10 -0
- beamlit/functions/__init__.py +2 -2
- beamlit/functions/decorator.py +149 -1
- beamlit/functions/github/github.py +0 -1
- beamlit/models/__init__.py +51 -11
- beamlit/models/agent.py +27 -15
- beamlit/models/agent_metadata.py +1 -1
- beamlit/models/agent_render.py +45 -0
- beamlit/models/agent_spec.py +32 -5
- beamlit/models/core_event.py +88 -0
- beamlit/models/core_spec.py +14 -5
- beamlit/models/core_spec_configurations.py +1 -1
- beamlit/models/core_status.py +3 -20
- beamlit/models/environment.py +2 -2
- beamlit/models/environment_metadata.py +1 -1
- beamlit/models/function.py +27 -15
- beamlit/models/function_metadata.py +1 -1
- beamlit/models/function_render.py +45 -0
- beamlit/models/function_spec.py +14 -5
- beamlit/models/histogram_bucket.py +79 -0
- beamlit/models/histogram_stats.py +88 -0
- beamlit/models/increase_and_rate_metric.py +0 -9
- beamlit/models/integration_connection.py +2 -2
- beamlit/models/integration_connection_spec.py +11 -2
- beamlit/models/integration_repository.py +88 -0
- beamlit/models/last_n_requests_metric.py +88 -0
- beamlit/models/latency_metric.py +124 -0
- beamlit/models/metadata.py +1 -1
- beamlit/models/metric.py +18 -9
- beamlit/models/metrics.py +81 -46
- beamlit/models/metrics_models.py +45 -0
- beamlit/models/metrics_request_total_per_code.py +45 -0
- beamlit/models/metrics_rps_per_code.py +45 -0
- beamlit/models/model.py +27 -15
- beamlit/models/model_metadata.py +1 -1
- beamlit/models/model_provider.py +2 -2
- beamlit/models/model_render.py +45 -0
- beamlit/models/model_spec.py +14 -14
- beamlit/models/pending_invitation_accept.py +1 -1
- beamlit/models/pending_invitation_render.py +3 -3
- beamlit/models/policy.py +2 -2
- beamlit/models/provider_config.py +1 -1
- beamlit/models/repository.py +70 -0
- beamlit/models/repository_type_0.py +70 -0
- beamlit/models/request_duration_over_time_metric.py +97 -0
- beamlit/models/request_duration_over_time_metrics.py +74 -0
- beamlit/models/request_total_by_origin_metric.py +103 -0
- beamlit/models/request_total_by_origin_metric_request_total_by_origin.py +45 -0
- beamlit/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +45 -0
- beamlit/models/request_total_metric.py +115 -0
- beamlit/models/request_total_metric_request_total_per_code.py +45 -0
- beamlit/models/request_total_metric_rps_per_code.py +45 -0
- beamlit/models/resource_deployment_metrics.py +6 -4
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +1 -1
- beamlit/models/resource_environment_metrics.py +155 -75
- beamlit/models/resource_environment_metrics_request_total_per_code.py +45 -0
- beamlit/models/resource_environment_metrics_rps_per_code.py +45 -0
- beamlit/models/resource_metrics.py +1 -1
- beamlit/models/runtime.py +2 -2
- beamlit/models/store_agent.py +1 -1
- beamlit/models/store_function.py +1 -1
- beamlit/models/token_rate_metric.py +88 -0
- beamlit/models/token_rate_metrics.py +106 -0
- beamlit/models/token_total_metric.py +106 -0
- beamlit/models/workspace.py +17 -8
- beamlit/serve/app.py +9 -13
- {beamlit-0.0.33rc49.dist-info → beamlit-0.0.34.dist-info}/METADATA +21 -3
- {beamlit-0.0.33rc49.dist-info → beamlit-0.0.34.dist-info}/RECORD +80 -52
- beamlit/common/generate.py +0 -196
- {beamlit-0.0.33rc49.dist-info → beamlit-0.0.34.dist-info}/WHEEL +0 -0
@@ -6,14 +6,18 @@ from attrs import field as _attrs_field
|
|
6
6
|
from ..types import UNSET, Unset
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
|
+
from ..models.latency_metric import LatencyMetric
|
9
10
|
from ..models.metric import Metric
|
10
|
-
from ..models.
|
11
|
-
from ..models.
|
12
|
-
|
11
|
+
from ..models.request_duration_over_time_metrics import RequestDurationOverTimeMetrics
|
12
|
+
from ..models.request_total_by_origin_metric import RequestTotalByOriginMetric
|
13
|
+
from ..models.resource_environment_metrics_request_total_per_code import (
|
14
|
+
ResourceEnvironmentMetricsRequestTotalPerCode,
|
13
15
|
)
|
14
|
-
from ..models.
|
15
|
-
|
16
|
+
from ..models.resource_environment_metrics_rps_per_code import (
|
17
|
+
ResourceEnvironmentMetricsRpsPerCode,
|
16
18
|
)
|
19
|
+
from ..models.token_rate_metrics import TokenRateMetrics
|
20
|
+
from ..models.token_total_metric import TokenTotalMetric
|
17
21
|
|
18
22
|
|
19
23
|
T = TypeVar("T", bound="ResourceEnvironmentMetrics")
|
@@ -25,23 +29,31 @@ class ResourceEnvironmentMetrics:
|
|
25
29
|
|
26
30
|
Attributes:
|
27
31
|
inference_global (Union[Unset, list['Metric']]): Array of metrics
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
last_n_requests (Union[Unset, list['Metric']]): Array of metrics
|
33
|
+
latency (Union[Unset, LatencyMetric]): Latency metrics
|
34
|
+
request_duration_over_time (Union[Unset, RequestDurationOverTimeMetrics]): Request duration over time metrics
|
35
|
+
request_total (Union[Unset, float]): Number of requests for the resource globally
|
36
|
+
request_total_by_origin (Union[Unset, RequestTotalByOriginMetric]): Request total by origin metric
|
37
|
+
request_total_per_code (Union[Unset, ResourceEnvironmentMetricsRequestTotalPerCode]): Number of requests for the
|
38
|
+
resource globally per code
|
39
|
+
rps (Union[Unset, float]): Number of requests per second for the resource globally
|
40
|
+
rps_per_code (Union[Unset, ResourceEnvironmentMetricsRpsPerCode]): Number of requests per second for the
|
41
|
+
resource globally per code
|
42
|
+
token_rate (Union[Unset, TokenRateMetrics]): Token rate metrics
|
43
|
+
token_total (Union[Unset, TokenTotalMetric]): Token total metric
|
37
44
|
"""
|
38
45
|
|
39
46
|
inference_global: Union[Unset, list["Metric"]] = UNSET
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
last_n_requests: Union[Unset, list["Metric"]] = UNSET
|
48
|
+
latency: Union[Unset, "LatencyMetric"] = UNSET
|
49
|
+
request_duration_over_time: Union[Unset, "RequestDurationOverTimeMetrics"] = UNSET
|
50
|
+
request_total: Union[Unset, float] = UNSET
|
51
|
+
request_total_by_origin: Union[Unset, "RequestTotalByOriginMetric"] = UNSET
|
52
|
+
request_total_per_code: Union[Unset, "ResourceEnvironmentMetricsRequestTotalPerCode"] = UNSET
|
53
|
+
rps: Union[Unset, float] = UNSET
|
54
|
+
rps_per_code: Union[Unset, "ResourceEnvironmentMetricsRpsPerCode"] = UNSET
|
55
|
+
token_rate: Union[Unset, "TokenRateMetrics"] = UNSET
|
56
|
+
token_total: Union[Unset, "TokenTotalMetric"] = UNSET
|
45
57
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
46
58
|
|
47
59
|
def to_dict(self) -> dict[str, Any]:
|
@@ -52,52 +64,87 @@ class ResourceEnvironmentMetrics:
|
|
52
64
|
componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
|
53
65
|
inference_global.append(componentsschemas_array_metric_item)
|
54
66
|
|
55
|
-
|
56
|
-
if not isinstance(self.
|
57
|
-
|
67
|
+
last_n_requests: Union[Unset, list[dict[str, Any]]] = UNSET
|
68
|
+
if not isinstance(self.last_n_requests, Unset):
|
69
|
+
last_n_requests = []
|
70
|
+
for componentsschemas_array_metric_item_data in self.last_n_requests:
|
71
|
+
componentsschemas_array_metric_item = componentsschemas_array_metric_item_data.to_dict()
|
72
|
+
last_n_requests.append(componentsschemas_array_metric_item)
|
73
|
+
|
74
|
+
latency: Union[Unset, dict[str, Any]] = UNSET
|
75
|
+
if self.latency and not isinstance(self.latency, Unset):
|
76
|
+
latency = self.latency.to_dict()
|
77
|
+
|
78
|
+
request_duration_over_time: Union[Unset, dict[str, Any]] = UNSET
|
79
|
+
if self.request_duration_over_time and not isinstance(self.request_duration_over_time, Unset):
|
80
|
+
request_duration_over_time = self.request_duration_over_time.to_dict()
|
81
|
+
|
82
|
+
request_total = self.request_total
|
58
83
|
|
59
|
-
|
84
|
+
request_total_by_origin: Union[Unset, dict[str, Any]] = UNSET
|
85
|
+
if self.request_total_by_origin and not isinstance(self.request_total_by_origin, Unset):
|
86
|
+
request_total_by_origin = self.request_total_by_origin.to_dict()
|
60
87
|
|
61
|
-
|
62
|
-
if not isinstance(self.
|
63
|
-
|
88
|
+
request_total_per_code: Union[Unset, dict[str, Any]] = UNSET
|
89
|
+
if self.request_total_per_code and not isinstance(self.request_total_per_code, Unset):
|
90
|
+
request_total_per_code = self.request_total_per_code.to_dict()
|
64
91
|
|
65
|
-
|
66
|
-
if not isinstance(self.query_per_region, Unset):
|
67
|
-
query_per_region = self.query_per_region.to_dict()
|
92
|
+
rps = self.rps
|
68
93
|
|
69
|
-
|
70
|
-
if not isinstance(self.
|
71
|
-
|
94
|
+
rps_per_code: Union[Unset, dict[str, Any]] = UNSET
|
95
|
+
if self.rps_per_code and not isinstance(self.rps_per_code, Unset):
|
96
|
+
rps_per_code = self.rps_per_code.to_dict()
|
97
|
+
|
98
|
+
token_rate: Union[Unset, dict[str, Any]] = UNSET
|
99
|
+
if self.token_rate and not isinstance(self.token_rate, Unset):
|
100
|
+
token_rate = self.token_rate.to_dict()
|
101
|
+
|
102
|
+
token_total: Union[Unset, dict[str, Any]] = UNSET
|
103
|
+
if self.token_total and not isinstance(self.token_total, Unset):
|
104
|
+
token_total = self.token_total.to_dict()
|
72
105
|
|
73
106
|
field_dict: dict[str, Any] = {}
|
74
107
|
field_dict.update(self.additional_properties)
|
75
108
|
field_dict.update({})
|
76
109
|
if inference_global is not UNSET:
|
77
110
|
field_dict["inferenceGlobal"] = inference_global
|
78
|
-
if
|
79
|
-
field_dict["
|
80
|
-
if
|
81
|
-
field_dict["
|
82
|
-
if
|
83
|
-
field_dict["
|
84
|
-
if
|
85
|
-
field_dict["
|
86
|
-
if
|
87
|
-
field_dict["
|
111
|
+
if last_n_requests is not UNSET:
|
112
|
+
field_dict["lastNRequests"] = last_n_requests
|
113
|
+
if latency is not UNSET:
|
114
|
+
field_dict["latency"] = latency
|
115
|
+
if request_duration_over_time is not UNSET:
|
116
|
+
field_dict["requestDurationOverTime"] = request_duration_over_time
|
117
|
+
if request_total is not UNSET:
|
118
|
+
field_dict["requestTotal"] = request_total
|
119
|
+
if request_total_by_origin is not UNSET:
|
120
|
+
field_dict["requestTotalByOrigin"] = request_total_by_origin
|
121
|
+
if request_total_per_code is not UNSET:
|
122
|
+
field_dict["requestTotalPerCode"] = request_total_per_code
|
123
|
+
if rps is not UNSET:
|
124
|
+
field_dict["rps"] = rps
|
125
|
+
if rps_per_code is not UNSET:
|
126
|
+
field_dict["rpsPerCode"] = rps_per_code
|
127
|
+
if token_rate is not UNSET:
|
128
|
+
field_dict["tokenRate"] = token_rate
|
129
|
+
if token_total is not UNSET:
|
130
|
+
field_dict["tokenTotal"] = token_total
|
88
131
|
|
89
132
|
return field_dict
|
90
133
|
|
91
134
|
@classmethod
|
92
135
|
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
136
|
+
from ..models.latency_metric import LatencyMetric
|
93
137
|
from ..models.metric import Metric
|
94
|
-
from ..models.
|
95
|
-
from ..models.
|
96
|
-
|
138
|
+
from ..models.request_duration_over_time_metrics import RequestDurationOverTimeMetrics
|
139
|
+
from ..models.request_total_by_origin_metric import RequestTotalByOriginMetric
|
140
|
+
from ..models.resource_environment_metrics_request_total_per_code import (
|
141
|
+
ResourceEnvironmentMetricsRequestTotalPerCode,
|
97
142
|
)
|
98
|
-
from ..models.
|
99
|
-
|
143
|
+
from ..models.resource_environment_metrics_rps_per_code import (
|
144
|
+
ResourceEnvironmentMetricsRpsPerCode,
|
100
145
|
)
|
146
|
+
from ..models.token_rate_metrics import TokenRateMetrics
|
147
|
+
from ..models.token_total_metric import TokenTotalMetric
|
101
148
|
|
102
149
|
if not src_dict:
|
103
150
|
return None
|
@@ -109,45 +156,78 @@ class ResourceEnvironmentMetrics:
|
|
109
156
|
|
110
157
|
inference_global.append(componentsschemas_array_metric_item)
|
111
158
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
159
|
+
last_n_requests = []
|
160
|
+
_last_n_requests = d.pop("lastNRequests", UNSET)
|
161
|
+
for componentsschemas_array_metric_item_data in _last_n_requests or []:
|
162
|
+
componentsschemas_array_metric_item = Metric.from_dict(componentsschemas_array_metric_item_data)
|
163
|
+
|
164
|
+
last_n_requests.append(componentsschemas_array_metric_item)
|
165
|
+
|
166
|
+
_latency = d.pop("latency", UNSET)
|
167
|
+
latency: Union[Unset, LatencyMetric]
|
168
|
+
if isinstance(_latency, Unset):
|
169
|
+
latency = UNSET
|
170
|
+
else:
|
171
|
+
latency = LatencyMetric.from_dict(_latency)
|
172
|
+
|
173
|
+
_request_duration_over_time = d.pop("requestDurationOverTime", UNSET)
|
174
|
+
request_duration_over_time: Union[Unset, RequestDurationOverTimeMetrics]
|
175
|
+
if isinstance(_request_duration_over_time, Unset):
|
176
|
+
request_duration_over_time = UNSET
|
177
|
+
else:
|
178
|
+
request_duration_over_time = RequestDurationOverTimeMetrics.from_dict(_request_duration_over_time)
|
179
|
+
|
180
|
+
request_total = d.pop("requestTotal", UNSET)
|
181
|
+
|
182
|
+
_request_total_by_origin = d.pop("requestTotalByOrigin", UNSET)
|
183
|
+
request_total_by_origin: Union[Unset, RequestTotalByOriginMetric]
|
184
|
+
if isinstance(_request_total_by_origin, Unset):
|
185
|
+
request_total_by_origin = UNSET
|
186
|
+
else:
|
187
|
+
request_total_by_origin = RequestTotalByOriginMetric.from_dict(_request_total_by_origin)
|
188
|
+
|
189
|
+
_request_total_per_code = d.pop("requestTotalPerCode", UNSET)
|
190
|
+
request_total_per_code: Union[Unset, ResourceEnvironmentMetricsRequestTotalPerCode]
|
191
|
+
if isinstance(_request_total_per_code, Unset):
|
192
|
+
request_total_per_code = UNSET
|
116
193
|
else:
|
117
|
-
|
194
|
+
request_total_per_code = ResourceEnvironmentMetricsRequestTotalPerCode.from_dict(_request_total_per_code)
|
118
195
|
|
119
|
-
|
196
|
+
rps = d.pop("rps", UNSET)
|
120
197
|
|
121
|
-
|
122
|
-
|
123
|
-
if isinstance(
|
124
|
-
|
198
|
+
_rps_per_code = d.pop("rpsPerCode", UNSET)
|
199
|
+
rps_per_code: Union[Unset, ResourceEnvironmentMetricsRpsPerCode]
|
200
|
+
if isinstance(_rps_per_code, Unset):
|
201
|
+
rps_per_code = UNSET
|
125
202
|
else:
|
126
|
-
|
203
|
+
rps_per_code = ResourceEnvironmentMetricsRpsPerCode.from_dict(_rps_per_code)
|
127
204
|
|
128
|
-
|
129
|
-
|
130
|
-
if isinstance(
|
131
|
-
|
205
|
+
_token_rate = d.pop("tokenRate", UNSET)
|
206
|
+
token_rate: Union[Unset, TokenRateMetrics]
|
207
|
+
if isinstance(_token_rate, Unset):
|
208
|
+
token_rate = UNSET
|
132
209
|
else:
|
133
|
-
|
210
|
+
token_rate = TokenRateMetrics.from_dict(_token_rate)
|
134
211
|
|
135
|
-
|
136
|
-
|
137
|
-
if isinstance(
|
138
|
-
|
212
|
+
_token_total = d.pop("tokenTotal", UNSET)
|
213
|
+
token_total: Union[Unset, TokenTotalMetric]
|
214
|
+
if isinstance(_token_total, Unset):
|
215
|
+
token_total = UNSET
|
139
216
|
else:
|
140
|
-
|
141
|
-
_query_per_region_per_code
|
142
|
-
)
|
217
|
+
token_total = TokenTotalMetric.from_dict(_token_total)
|
143
218
|
|
144
219
|
resource_environment_metrics = cls(
|
145
220
|
inference_global=inference_global,
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
221
|
+
last_n_requests=last_n_requests,
|
222
|
+
latency=latency,
|
223
|
+
request_duration_over_time=request_duration_over_time,
|
224
|
+
request_total=request_total,
|
225
|
+
request_total_by_origin=request_total_by_origin,
|
226
|
+
request_total_per_code=request_total_per_code,
|
227
|
+
rps=rps,
|
228
|
+
rps_per_code=rps_per_code,
|
229
|
+
token_rate=token_rate,
|
230
|
+
token_total=token_total,
|
151
231
|
)
|
152
232
|
|
153
233
|
resource_environment_metrics.additional_properties = d
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Any, TypeVar
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
T = TypeVar("T", bound="ResourceEnvironmentMetricsRequestTotalPerCode")
|
7
|
+
|
8
|
+
|
9
|
+
@_attrs_define
|
10
|
+
class ResourceEnvironmentMetricsRequestTotalPerCode:
|
11
|
+
"""Number of requests for the resource globally per code"""
|
12
|
+
|
13
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
14
|
+
|
15
|
+
def to_dict(self) -> dict[str, Any]:
|
16
|
+
field_dict: dict[str, Any] = {}
|
17
|
+
field_dict.update(self.additional_properties)
|
18
|
+
|
19
|
+
return field_dict
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
23
|
+
if not src_dict:
|
24
|
+
return None
|
25
|
+
d = src_dict.copy()
|
26
|
+
resource_environment_metrics_request_total_per_code = cls()
|
27
|
+
|
28
|
+
resource_environment_metrics_request_total_per_code.additional_properties = d
|
29
|
+
return resource_environment_metrics_request_total_per_code
|
30
|
+
|
31
|
+
@property
|
32
|
+
def additional_keys(self) -> list[str]:
|
33
|
+
return list(self.additional_properties.keys())
|
34
|
+
|
35
|
+
def __getitem__(self, key: str) -> Any:
|
36
|
+
return self.additional_properties[key]
|
37
|
+
|
38
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
39
|
+
self.additional_properties[key] = value
|
40
|
+
|
41
|
+
def __delitem__(self, key: str) -> None:
|
42
|
+
del self.additional_properties[key]
|
43
|
+
|
44
|
+
def __contains__(self, key: str) -> bool:
|
45
|
+
return key in self.additional_properties
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Any, TypeVar
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
T = TypeVar("T", bound="ResourceEnvironmentMetricsRpsPerCode")
|
7
|
+
|
8
|
+
|
9
|
+
@_attrs_define
|
10
|
+
class ResourceEnvironmentMetricsRpsPerCode:
|
11
|
+
"""Number of requests per second for the resource globally per code"""
|
12
|
+
|
13
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
14
|
+
|
15
|
+
def to_dict(self) -> dict[str, Any]:
|
16
|
+
field_dict: dict[str, Any] = {}
|
17
|
+
field_dict.update(self.additional_properties)
|
18
|
+
|
19
|
+
return field_dict
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
23
|
+
if not src_dict:
|
24
|
+
return None
|
25
|
+
d = src_dict.copy()
|
26
|
+
resource_environment_metrics_rps_per_code = cls()
|
27
|
+
|
28
|
+
resource_environment_metrics_rps_per_code.additional_properties = d
|
29
|
+
return resource_environment_metrics_rps_per_code
|
30
|
+
|
31
|
+
@property
|
32
|
+
def additional_keys(self) -> list[str]:
|
33
|
+
return list(self.additional_properties.keys())
|
34
|
+
|
35
|
+
def __getitem__(self, key: str) -> Any:
|
36
|
+
return self.additional_properties[key]
|
37
|
+
|
38
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
39
|
+
self.additional_properties[key] = value
|
40
|
+
|
41
|
+
def __delitem__(self, key: str) -> None:
|
42
|
+
del self.additional_properties[key]
|
43
|
+
|
44
|
+
def __contains__(self, key: str) -> bool:
|
45
|
+
return key in self.additional_properties
|
@@ -36,7 +36,7 @@ class ResourceMetrics:
|
|
36
36
|
inference_global.append(componentsschemas_array_metric_item)
|
37
37
|
|
38
38
|
query_per_region: Union[Unset, dict[str, Any]] = UNSET
|
39
|
-
if not isinstance(self.query_per_region, Unset):
|
39
|
+
if self.query_per_region and not isinstance(self.query_per_region, Unset):
|
40
40
|
query_per_region = self.query_per_region.to_dict()
|
41
41
|
|
42
42
|
field_dict: dict[str, Any] = {}
|
beamlit/models/runtime.py
CHANGED
@@ -64,11 +64,11 @@ class Runtime:
|
|
64
64
|
model = self.model
|
65
65
|
|
66
66
|
readiness_probe: Union[Unset, dict[str, Any]] = UNSET
|
67
|
-
if not isinstance(self.readiness_probe, Unset):
|
67
|
+
if self.readiness_probe and not isinstance(self.readiness_probe, Unset):
|
68
68
|
readiness_probe = self.readiness_probe.to_dict()
|
69
69
|
|
70
70
|
resources: Union[Unset, dict[str, Any]] = UNSET
|
71
|
-
if not isinstance(self.resources, Unset):
|
71
|
+
if self.resources and not isinstance(self.resources, Unset):
|
72
72
|
resources = self.resources.to_dict()
|
73
73
|
|
74
74
|
serving_port = self.serving_port
|
beamlit/models/store_agent.py
CHANGED
beamlit/models/store_function.py
CHANGED
@@ -0,0 +1,88 @@
|
|
1
|
+
from typing import Any, 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="TokenRateMetric")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class TokenRateMetric:
|
13
|
+
"""Token rate metric
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
model (Union[Unset, str]): Model ID
|
17
|
+
timestamp (Union[Unset, str]): Timestamp
|
18
|
+
token_total (Union[Unset, float]): Total tokens
|
19
|
+
trend (Union[Unset, float]): Trend
|
20
|
+
"""
|
21
|
+
|
22
|
+
model: Union[Unset, str] = UNSET
|
23
|
+
timestamp: Union[Unset, str] = UNSET
|
24
|
+
token_total: Union[Unset, float] = UNSET
|
25
|
+
trend: Union[Unset, float] = UNSET
|
26
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
27
|
+
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
29
|
+
model = self.model
|
30
|
+
|
31
|
+
timestamp = self.timestamp
|
32
|
+
|
33
|
+
token_total = self.token_total
|
34
|
+
|
35
|
+
trend = self.trend
|
36
|
+
|
37
|
+
field_dict: dict[str, Any] = {}
|
38
|
+
field_dict.update(self.additional_properties)
|
39
|
+
field_dict.update({})
|
40
|
+
if model is not UNSET:
|
41
|
+
field_dict["model"] = model
|
42
|
+
if timestamp is not UNSET:
|
43
|
+
field_dict["timestamp"] = timestamp
|
44
|
+
if token_total is not UNSET:
|
45
|
+
field_dict["tokenTotal"] = token_total
|
46
|
+
if trend is not UNSET:
|
47
|
+
field_dict["trend"] = trend
|
48
|
+
|
49
|
+
return field_dict
|
50
|
+
|
51
|
+
@classmethod
|
52
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
53
|
+
if not src_dict:
|
54
|
+
return None
|
55
|
+
d = src_dict.copy()
|
56
|
+
model = d.pop("model", UNSET)
|
57
|
+
|
58
|
+
timestamp = d.pop("timestamp", UNSET)
|
59
|
+
|
60
|
+
token_total = d.pop("tokenTotal", UNSET)
|
61
|
+
|
62
|
+
trend = d.pop("trend", UNSET)
|
63
|
+
|
64
|
+
token_rate_metric = cls(
|
65
|
+
model=model,
|
66
|
+
timestamp=timestamp,
|
67
|
+
token_total=token_total,
|
68
|
+
trend=trend,
|
69
|
+
)
|
70
|
+
|
71
|
+
token_rate_metric.additional_properties = d
|
72
|
+
return token_rate_metric
|
73
|
+
|
74
|
+
@property
|
75
|
+
def additional_keys(self) -> list[str]:
|
76
|
+
return list(self.additional_properties.keys())
|
77
|
+
|
78
|
+
def __getitem__(self, key: str) -> Any:
|
79
|
+
return self.additional_properties[key]
|
80
|
+
|
81
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
82
|
+
self.additional_properties[key] = value
|
83
|
+
|
84
|
+
def __delitem__(self, key: str) -> None:
|
85
|
+
del self.additional_properties[key]
|
86
|
+
|
87
|
+
def __contains__(self, key: str) -> bool:
|
88
|
+
return key in self.additional_properties
|
@@ -0,0 +1,106 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Any, 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
|
+
if TYPE_CHECKING:
|
9
|
+
from ..models.token_rate_metric import TokenRateMetric
|
10
|
+
|
11
|
+
|
12
|
+
T = TypeVar("T", bound="TokenRateMetrics")
|
13
|
+
|
14
|
+
|
15
|
+
@_attrs_define
|
16
|
+
class TokenRateMetrics:
|
17
|
+
"""Token rate metrics
|
18
|
+
|
19
|
+
Attributes:
|
20
|
+
token_rate (Union[Unset, TokenRateMetric]): Token rate metric
|
21
|
+
token_rate_input (Union[Unset, TokenRateMetric]): Token rate metric
|
22
|
+
token_rate_output (Union[Unset, TokenRateMetric]): Token rate metric
|
23
|
+
"""
|
24
|
+
|
25
|
+
token_rate: Union[Unset, "TokenRateMetric"] = UNSET
|
26
|
+
token_rate_input: Union[Unset, "TokenRateMetric"] = UNSET
|
27
|
+
token_rate_output: Union[Unset, "TokenRateMetric"] = UNSET
|
28
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
29
|
+
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
31
|
+
token_rate: Union[Unset, dict[str, Any]] = UNSET
|
32
|
+
if self.token_rate and not isinstance(self.token_rate, Unset):
|
33
|
+
token_rate = self.token_rate.to_dict()
|
34
|
+
|
35
|
+
token_rate_input: Union[Unset, dict[str, Any]] = UNSET
|
36
|
+
if self.token_rate_input and not isinstance(self.token_rate_input, Unset):
|
37
|
+
token_rate_input = self.token_rate_input.to_dict()
|
38
|
+
|
39
|
+
token_rate_output: Union[Unset, dict[str, Any]] = UNSET
|
40
|
+
if self.token_rate_output and not isinstance(self.token_rate_output, Unset):
|
41
|
+
token_rate_output = self.token_rate_output.to_dict()
|
42
|
+
|
43
|
+
field_dict: dict[str, Any] = {}
|
44
|
+
field_dict.update(self.additional_properties)
|
45
|
+
field_dict.update({})
|
46
|
+
if token_rate is not UNSET:
|
47
|
+
field_dict["tokenRate"] = token_rate
|
48
|
+
if token_rate_input is not UNSET:
|
49
|
+
field_dict["tokenRateInput"] = token_rate_input
|
50
|
+
if token_rate_output is not UNSET:
|
51
|
+
field_dict["tokenRateOutput"] = token_rate_output
|
52
|
+
|
53
|
+
return field_dict
|
54
|
+
|
55
|
+
@classmethod
|
56
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
57
|
+
from ..models.token_rate_metric import TokenRateMetric
|
58
|
+
|
59
|
+
if not src_dict:
|
60
|
+
return None
|
61
|
+
d = src_dict.copy()
|
62
|
+
_token_rate = d.pop("tokenRate", UNSET)
|
63
|
+
token_rate: Union[Unset, TokenRateMetric]
|
64
|
+
if isinstance(_token_rate, Unset):
|
65
|
+
token_rate = UNSET
|
66
|
+
else:
|
67
|
+
token_rate = TokenRateMetric.from_dict(_token_rate)
|
68
|
+
|
69
|
+
_token_rate_input = d.pop("tokenRateInput", UNSET)
|
70
|
+
token_rate_input: Union[Unset, TokenRateMetric]
|
71
|
+
if isinstance(_token_rate_input, Unset):
|
72
|
+
token_rate_input = UNSET
|
73
|
+
else:
|
74
|
+
token_rate_input = TokenRateMetric.from_dict(_token_rate_input)
|
75
|
+
|
76
|
+
_token_rate_output = d.pop("tokenRateOutput", UNSET)
|
77
|
+
token_rate_output: Union[Unset, TokenRateMetric]
|
78
|
+
if isinstance(_token_rate_output, Unset):
|
79
|
+
token_rate_output = UNSET
|
80
|
+
else:
|
81
|
+
token_rate_output = TokenRateMetric.from_dict(_token_rate_output)
|
82
|
+
|
83
|
+
token_rate_metrics = cls(
|
84
|
+
token_rate=token_rate,
|
85
|
+
token_rate_input=token_rate_input,
|
86
|
+
token_rate_output=token_rate_output,
|
87
|
+
)
|
88
|
+
|
89
|
+
token_rate_metrics.additional_properties = d
|
90
|
+
return token_rate_metrics
|
91
|
+
|
92
|
+
@property
|
93
|
+
def additional_keys(self) -> list[str]:
|
94
|
+
return list(self.additional_properties.keys())
|
95
|
+
|
96
|
+
def __getitem__(self, key: str) -> Any:
|
97
|
+
return self.additional_properties[key]
|
98
|
+
|
99
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
100
|
+
self.additional_properties[key] = value
|
101
|
+
|
102
|
+
def __delitem__(self, key: str) -> None:
|
103
|
+
del self.additional_properties[key]
|
104
|
+
|
105
|
+
def __contains__(self, key: str) -> bool:
|
106
|
+
return key in self.additional_properties
|