beamlit 0.0.34rc70__py3-none-any.whl → 0.0.34rc72__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.
Files changed (31) hide show
  1. beamlit/deploy/deploy.py +1 -3
  2. beamlit/models/__init__.py +40 -2
  3. beamlit/models/agent.py +4 -13
  4. beamlit/models/core_event.py +9 -0
  5. beamlit/models/function.py +4 -13
  6. beamlit/models/histogram_bucket.py +79 -0
  7. beamlit/models/histogram_stats.py +88 -0
  8. beamlit/models/latency_metric.py +82 -3
  9. beamlit/models/metric.py +4 -4
  10. beamlit/models/metrics.py +56 -21
  11. beamlit/models/metrics_models.py +45 -0
  12. beamlit/models/metrics_request_total_per_code.py +45 -0
  13. beamlit/models/metrics_rps_per_code.py +45 -0
  14. beamlit/models/model.py +4 -13
  15. beamlit/models/request_duration_over_time_metric.py +97 -0
  16. beamlit/models/request_duration_over_time_metrics.py +74 -0
  17. beamlit/models/request_total_by_origin_metric.py +103 -0
  18. beamlit/models/request_total_by_origin_metric_request_total_by_origin.py +45 -0
  19. beamlit/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +45 -0
  20. beamlit/models/request_total_metric.py +40 -13
  21. beamlit/models/request_total_metric_request_total_per_code.py +45 -0
  22. beamlit/models/request_total_metric_rps_per_code.py +45 -0
  23. beamlit/models/resource_environment_metrics.py +112 -12
  24. beamlit/models/resource_environment_metrics_request_total_per_code.py +45 -0
  25. beamlit/models/resource_environment_metrics_rps_per_code.py +45 -0
  26. beamlit/models/token_rate_metric.py +88 -0
  27. beamlit/models/token_rate_metrics.py +106 -0
  28. beamlit/models/token_total_metric.py +106 -0
  29. {beamlit-0.0.34rc70.dist-info → beamlit-0.0.34rc72.dist-info}/METADATA +1 -1
  30. {beamlit-0.0.34rc70.dist-info → beamlit-0.0.34rc72.dist-info}/RECORD +31 -14
  31. {beamlit-0.0.34rc70.dist-info → beamlit-0.0.34rc72.dist-info}/WHEEL +0 -0
beamlit/deploy/deploy.py CHANGED
@@ -35,7 +35,7 @@ def set_default_values(resource: Resource, deployment: Agent | Function):
35
35
  deployment.metadata.workspace = settings.workspace
36
36
  deployment.metadata.environment = settings.environment
37
37
  if not deployment.metadata.name:
38
- deployment.metadata.name = resource.name
38
+ deployment.metadata.name = slugify(resource.name)
39
39
  if not deployment.metadata.display_name:
40
40
  deployment.metadata.display_name = deployment.metadata.name
41
41
  if not deployment.spec.description:
@@ -117,7 +117,6 @@ def get_agent_yaml(
117
117
  agent.spec.functions = [slugify(function.metadata.name) for (_, function) in functions]
118
118
  agent.metadata.labels = agent.metadata.labels and MetadataLabels.from_dict(agent.metadata.labels) or MetadataLabels()
119
119
  agent.metadata.labels["x-beamlit-auto-generated"] = "true"
120
- agent.metadata.name = slugify(agent.metadata.name)
121
120
  agent_yaml = yaml.dump(agent.to_dict())
122
121
  template = f"""
123
122
  apiVersion: beamlit.com/v1alpha1
@@ -140,7 +139,6 @@ def get_function_yaml(function: Function, settings: Settings, client: Authentica
140
139
  """
141
140
  function.metadata.labels = function.metadata.labels and MetadataLabels.from_dict(function.metadata.labels) or MetadataLabels()
142
141
  function.metadata.labels["x-beamlit-auto-generated"] = "true"
143
- function.metadata.name = slugify(function.metadata.name)
144
142
  function_yaml = yaml.dump(function.to_dict())
145
143
  return f"""
146
144
  apiVersion: beamlit.com/v1alpha1
@@ -14,7 +14,6 @@ from .continent import Continent
14
14
  from .core_event import CoreEvent
15
15
  from .core_spec import CoreSpec
16
16
  from .core_spec_configurations import CoreSpecConfigurations
17
- from .core_status import CoreStatus
18
17
  from .country import Country
19
18
  from .create_api_key_for_service_account_body import CreateApiKeyForServiceAccountBody
20
19
  from .create_workspace_service_account_body import CreateWorkspaceServiceAccountBody
@@ -36,6 +35,8 @@ from .get_trace_response_200 import GetTraceResponse200
36
35
  from .get_workspace_service_accounts_response_200_item import (
37
36
  GetWorkspaceServiceAccountsResponse200Item,
38
37
  )
38
+ from .histogram_bucket import HistogramBucket
39
+ from .histogram_stats import HistogramStats
39
40
  from .increase_and_rate_metric import IncreaseAndRateMetric
40
41
  from .integration_config import IntegrationConfig
41
42
  from .integration_connection import IntegrationConnection
@@ -52,6 +53,9 @@ from .metadata import Metadata
52
53
  from .metadata_labels import MetadataLabels
53
54
  from .metric import Metric
54
55
  from .metrics import Metrics
56
+ from .metrics_models import MetricsModels
57
+ from .metrics_request_total_per_code import MetricsRequestTotalPerCode
58
+ from .metrics_rps_per_code import MetricsRpsPerCode
55
59
  from .model import Model
56
60
  from .model_metadata import ModelMetadata
57
61
  from .model_private_cluster import ModelPrivateCluster
@@ -74,7 +78,18 @@ from .private_location import PrivateLocation
74
78
  from .provider_config import ProviderConfig
75
79
  from .qps import QPS
76
80
  from .repository import Repository
81
+ from .request_duration_over_time_metric import RequestDurationOverTimeMetric
82
+ from .request_duration_over_time_metrics import RequestDurationOverTimeMetrics
83
+ from .request_total_by_origin_metric import RequestTotalByOriginMetric
84
+ from .request_total_by_origin_metric_request_total_by_origin import (
85
+ RequestTotalByOriginMetricRequestTotalByOrigin,
86
+ )
87
+ from .request_total_by_origin_metric_request_total_by_origin_and_code import (
88
+ RequestTotalByOriginMetricRequestTotalByOriginAndCode,
89
+ )
77
90
  from .request_total_metric import RequestTotalMetric
91
+ from .request_total_metric_request_total_per_code import RequestTotalMetricRequestTotalPerCode
92
+ from .request_total_metric_rps_per_code import RequestTotalMetricRpsPerCode
78
93
  from .resource_deployment_metrics import ResourceDeploymentMetrics
79
94
  from .resource_deployment_metrics_inference_per_second_per_region import (
80
95
  ResourceDeploymentMetricsInferencePerSecondPerRegion,
@@ -83,6 +98,10 @@ from .resource_deployment_metrics_query_per_second_per_region_per_code import (
83
98
  ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode,
84
99
  )
85
100
  from .resource_environment_metrics import ResourceEnvironmentMetrics
101
+ from .resource_environment_metrics_request_total_per_code import (
102
+ ResourceEnvironmentMetricsRequestTotalPerCode,
103
+ )
104
+ from .resource_environment_metrics_rps_per_code import ResourceEnvironmentMetricsRpsPerCode
86
105
  from .resource_log import ResourceLog
87
106
  from .resource_metrics import ResourceMetrics
88
107
  from .runtime import Runtime
@@ -99,6 +118,9 @@ from .store_function_kit import StoreFunctionKit
99
118
  from .store_function_labels import StoreFunctionLabels
100
119
  from .store_function_parameter import StoreFunctionParameter
101
120
  from .time_fields import TimeFields
121
+ from .token_rate_metric import TokenRateMetric
122
+ from .token_rate_metrics import TokenRateMetrics
123
+ from .token_total_metric import TokenTotalMetric
102
124
  from .trace_ids_response import TraceIdsResponse
103
125
  from .update_workspace_service_account_body import UpdateWorkspaceServiceAccountBody
104
126
  from .update_workspace_service_account_response_200 import UpdateWorkspaceServiceAccountResponse200
@@ -123,7 +145,6 @@ __all__ = (
123
145
  "CoreEvent",
124
146
  "CoreSpec",
125
147
  "CoreSpecConfigurations",
126
- "CoreStatus",
127
148
  "Country",
128
149
  "CreateApiKeyForServiceAccountBody",
129
150
  "CreateWorkspaceServiceAccountBody",
@@ -143,6 +164,8 @@ __all__ = (
143
164
  "GetTraceLogsResponse200",
144
165
  "GetTraceResponse200",
145
166
  "GetWorkspaceServiceAccountsResponse200Item",
167
+ "HistogramBucket",
168
+ "HistogramStats",
146
169
  "IncreaseAndRateMetric",
147
170
  "IntegrationConfig",
148
171
  "IntegrationConnection",
@@ -159,6 +182,9 @@ __all__ = (
159
182
  "MetadataLabels",
160
183
  "Metric",
161
184
  "Metrics",
185
+ "MetricsModels",
186
+ "MetricsRequestTotalPerCode",
187
+ "MetricsRpsPerCode",
162
188
  "Model",
163
189
  "ModelMetadata",
164
190
  "ModelPrivateCluster",
@@ -181,11 +207,20 @@ __all__ = (
181
207
  "ProviderConfig",
182
208
  "QPS",
183
209
  "Repository",
210
+ "RequestDurationOverTimeMetric",
211
+ "RequestDurationOverTimeMetrics",
212
+ "RequestTotalByOriginMetric",
213
+ "RequestTotalByOriginMetricRequestTotalByOrigin",
214
+ "RequestTotalByOriginMetricRequestTotalByOriginAndCode",
184
215
  "RequestTotalMetric",
216
+ "RequestTotalMetricRequestTotalPerCode",
217
+ "RequestTotalMetricRpsPerCode",
185
218
  "ResourceDeploymentMetrics",
186
219
  "ResourceDeploymentMetricsInferencePerSecondPerRegion",
187
220
  "ResourceDeploymentMetricsQueryPerSecondPerRegionPerCode",
188
221
  "ResourceEnvironmentMetrics",
222
+ "ResourceEnvironmentMetricsRequestTotalPerCode",
223
+ "ResourceEnvironmentMetricsRpsPerCode",
189
224
  "ResourceLog",
190
225
  "ResourceMetrics",
191
226
  "Runtime",
@@ -202,6 +237,9 @@ __all__ = (
202
237
  "StoreFunctionLabels",
203
238
  "StoreFunctionParameter",
204
239
  "TimeFields",
240
+ "TokenRateMetric",
241
+ "TokenRateMetrics",
242
+ "TokenTotalMetric",
205
243
  "TraceIdsResponse",
206
244
  "UpdateWorkspaceServiceAccountBody",
207
245
  "UpdateWorkspaceServiceAccountResponse200",
beamlit/models/agent.py CHANGED
@@ -8,7 +8,6 @@ from ..types import UNSET, Unset
8
8
  if TYPE_CHECKING:
9
9
  from ..models.agent_spec import AgentSpec
10
10
  from ..models.core_event import CoreEvent
11
- from ..models.core_status import CoreStatus
12
11
  from ..models.environment_metadata import EnvironmentMetadata
13
12
 
14
13
 
@@ -23,13 +22,13 @@ class Agent:
23
22
  events (Union[Unset, list['CoreEvent']]): Core events
24
23
  metadata (Union[Unset, EnvironmentMetadata]): Environment metadata
25
24
  spec (Union[Unset, AgentSpec]): Agent specification
26
- status (Union[Unset, CoreStatus]): Core status
25
+ status (Union[Unset, str]): Agent status
27
26
  """
28
27
 
29
28
  events: Union[Unset, list["CoreEvent"]] = UNSET
30
29
  metadata: Union[Unset, "EnvironmentMetadata"] = UNSET
31
30
  spec: Union[Unset, "AgentSpec"] = UNSET
32
- status: Union[Unset, "CoreStatus"] = UNSET
31
+ status: Union[Unset, str] = UNSET
33
32
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
34
33
 
35
34
  def to_dict(self) -> dict[str, Any]:
@@ -48,9 +47,7 @@ class Agent:
48
47
  if self.spec and not isinstance(self.spec, Unset):
49
48
  spec = self.spec.to_dict()
50
49
 
51
- status: Union[Unset, dict[str, Any]] = UNSET
52
- if self.status and not isinstance(self.status, Unset):
53
- status = self.status.to_dict()
50
+ status = self.status
54
51
 
55
52
  field_dict: dict[str, Any] = {}
56
53
  field_dict.update(self.additional_properties)
@@ -70,7 +67,6 @@ class Agent:
70
67
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
71
68
  from ..models.agent_spec import AgentSpec
72
69
  from ..models.core_event import CoreEvent
73
- from ..models.core_status import CoreStatus
74
70
  from ..models.environment_metadata import EnvironmentMetadata
75
71
 
76
72
  if not src_dict:
@@ -97,12 +93,7 @@ class Agent:
97
93
  else:
98
94
  spec = AgentSpec.from_dict(_spec)
99
95
 
100
- _status = d.pop("status", UNSET)
101
- status: Union[Unset, CoreStatus]
102
- if isinstance(_status, Unset):
103
- status = UNSET
104
- else:
105
- status = CoreStatus.from_dict(_status)
96
+ status = d.pop("status", UNSET)
106
97
 
107
98
  agent = cls(
108
99
  events=events,
@@ -14,11 +14,13 @@ class CoreEvent:
14
14
 
15
15
  Attributes:
16
16
  message (Union[Unset, str]): Event message
17
+ status (Union[Unset, str]): Event status
17
18
  time (Union[Unset, str]): Event time
18
19
  type_ (Union[Unset, str]): Event type
19
20
  """
20
21
 
21
22
  message: Union[Unset, str] = UNSET
23
+ status: Union[Unset, str] = UNSET
22
24
  time: Union[Unset, str] = UNSET
23
25
  type_: Union[Unset, str] = UNSET
24
26
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
@@ -26,6 +28,8 @@ class CoreEvent:
26
28
  def to_dict(self) -> dict[str, Any]:
27
29
  message = self.message
28
30
 
31
+ status = self.status
32
+
29
33
  time = self.time
30
34
 
31
35
  type_ = self.type_
@@ -35,6 +39,8 @@ class CoreEvent:
35
39
  field_dict.update({})
36
40
  if message is not UNSET:
37
41
  field_dict["message"] = message
42
+ if status is not UNSET:
43
+ field_dict["status"] = status
38
44
  if time is not UNSET:
39
45
  field_dict["time"] = time
40
46
  if type_ is not UNSET:
@@ -49,12 +55,15 @@ class CoreEvent:
49
55
  d = src_dict.copy()
50
56
  message = d.pop("message", UNSET)
51
57
 
58
+ status = d.pop("status", UNSET)
59
+
52
60
  time = d.pop("time", UNSET)
53
61
 
54
62
  type_ = d.pop("type", UNSET)
55
63
 
56
64
  core_event = cls(
57
65
  message=message,
66
+ status=status,
58
67
  time=time,
59
68
  type_=type_,
60
69
  )
@@ -7,7 +7,6 @@ from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from ..models.core_event import CoreEvent
10
- from ..models.core_status import CoreStatus
11
10
  from ..models.environment_metadata import EnvironmentMetadata
12
11
  from ..models.function_spec import FunctionSpec
13
12
 
@@ -23,13 +22,13 @@ class Function:
23
22
  events (Union[Unset, list['CoreEvent']]): Core events
24
23
  metadata (Union[Unset, EnvironmentMetadata]): Environment metadata
25
24
  spec (Union[Unset, FunctionSpec]): Function specification
26
- status (Union[Unset, CoreStatus]): Core status
25
+ status (Union[Unset, str]): Function status
27
26
  """
28
27
 
29
28
  events: Union[Unset, list["CoreEvent"]] = UNSET
30
29
  metadata: Union[Unset, "EnvironmentMetadata"] = UNSET
31
30
  spec: Union[Unset, "FunctionSpec"] = UNSET
32
- status: Union[Unset, "CoreStatus"] = UNSET
31
+ status: Union[Unset, str] = UNSET
33
32
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
34
33
 
35
34
  def to_dict(self) -> dict[str, Any]:
@@ -48,9 +47,7 @@ class Function:
48
47
  if self.spec and not isinstance(self.spec, Unset):
49
48
  spec = self.spec.to_dict()
50
49
 
51
- status: Union[Unset, dict[str, Any]] = UNSET
52
- if self.status and not isinstance(self.status, Unset):
53
- status = self.status.to_dict()
50
+ status = self.status
54
51
 
55
52
  field_dict: dict[str, Any] = {}
56
53
  field_dict.update(self.additional_properties)
@@ -69,7 +66,6 @@ class Function:
69
66
  @classmethod
70
67
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
71
68
  from ..models.core_event import CoreEvent
72
- from ..models.core_status import CoreStatus
73
69
  from ..models.environment_metadata import EnvironmentMetadata
74
70
  from ..models.function_spec import FunctionSpec
75
71
 
@@ -97,12 +93,7 @@ class Function:
97
93
  else:
98
94
  spec = FunctionSpec.from_dict(_spec)
99
95
 
100
- _status = d.pop("status", UNSET)
101
- status: Union[Unset, CoreStatus]
102
- if isinstance(_status, Unset):
103
- status = UNSET
104
- else:
105
- status = CoreStatus.from_dict(_status)
96
+ status = d.pop("status", UNSET)
106
97
 
107
98
  function = cls(
108
99
  events=events,
@@ -0,0 +1,79 @@
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="HistogramBucket")
9
+
10
+
11
+ @_attrs_define
12
+ class HistogramBucket:
13
+ """Histogram bucket
14
+
15
+ Attributes:
16
+ count (Union[Unset, int]): Count
17
+ end (Union[Unset, float]): End
18
+ start (Union[Unset, float]): Start
19
+ """
20
+
21
+ count: Union[Unset, int] = UNSET
22
+ end: Union[Unset, float] = UNSET
23
+ start: Union[Unset, float] = UNSET
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ count = self.count
28
+
29
+ end = self.end
30
+
31
+ start = self.start
32
+
33
+ field_dict: dict[str, Any] = {}
34
+ field_dict.update(self.additional_properties)
35
+ field_dict.update({})
36
+ if count is not UNSET:
37
+ field_dict["count"] = count
38
+ if end is not UNSET:
39
+ field_dict["end"] = end
40
+ if start is not UNSET:
41
+ field_dict["start"] = start
42
+
43
+ return field_dict
44
+
45
+ @classmethod
46
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
47
+ if not src_dict:
48
+ return None
49
+ d = src_dict.copy()
50
+ count = d.pop("count", UNSET)
51
+
52
+ end = d.pop("end", UNSET)
53
+
54
+ start = d.pop("start", UNSET)
55
+
56
+ histogram_bucket = cls(
57
+ count=count,
58
+ end=end,
59
+ start=start,
60
+ )
61
+
62
+ histogram_bucket.additional_properties = d
63
+ return histogram_bucket
64
+
65
+ @property
66
+ def additional_keys(self) -> list[str]:
67
+ return list(self.additional_properties.keys())
68
+
69
+ def __getitem__(self, key: str) -> Any:
70
+ return self.additional_properties[key]
71
+
72
+ def __setitem__(self, key: str, value: Any) -> None:
73
+ self.additional_properties[key] = value
74
+
75
+ def __delitem__(self, key: str) -> None:
76
+ del self.additional_properties[key]
77
+
78
+ def __contains__(self, key: str) -> bool:
79
+ return key in self.additional_properties
@@ -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="HistogramStats")
9
+
10
+
11
+ @_attrs_define
12
+ class HistogramStats:
13
+ """Histogram stats
14
+
15
+ Attributes:
16
+ average (Union[Unset, float]): Average request duration
17
+ p50 (Union[Unset, float]): P50 request duration
18
+ p90 (Union[Unset, float]): P90 request duration
19
+ p99 (Union[Unset, float]): P99 request duration
20
+ """
21
+
22
+ average: Union[Unset, float] = UNSET
23
+ p50: Union[Unset, float] = UNSET
24
+ p90: Union[Unset, float] = UNSET
25
+ p99: 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
+ average = self.average
30
+
31
+ p50 = self.p50
32
+
33
+ p90 = self.p90
34
+
35
+ p99 = self.p99
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update({})
40
+ if average is not UNSET:
41
+ field_dict["average"] = average
42
+ if p50 is not UNSET:
43
+ field_dict["p50"] = p50
44
+ if p90 is not UNSET:
45
+ field_dict["p90"] = p90
46
+ if p99 is not UNSET:
47
+ field_dict["p99"] = p99
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
+ average = d.pop("average", UNSET)
57
+
58
+ p50 = d.pop("p50", UNSET)
59
+
60
+ p90 = d.pop("p90", UNSET)
61
+
62
+ p99 = d.pop("p99", UNSET)
63
+
64
+ histogram_stats = cls(
65
+ average=average,
66
+ p50=p50,
67
+ p90=p90,
68
+ p99=p99,
69
+ )
70
+
71
+ histogram_stats.additional_properties = d
72
+ return histogram_stats
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
@@ -1,29 +1,108 @@
1
- from typing import Any, TypeVar
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
5
5
 
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.histogram_bucket import HistogramBucket
10
+ from ..models.histogram_stats import HistogramStats
11
+
12
+
6
13
  T = TypeVar("T", bound="LatencyMetric")
7
14
 
8
15
 
9
16
  @_attrs_define
10
17
  class LatencyMetric:
11
- """Latency metrics"""
18
+ """Latency metrics
19
+
20
+ Attributes:
21
+ global_histogram (Union[Unset, HistogramBucket]): Histogram bucket
22
+ global_stats (Union[Unset, HistogramStats]): Histogram stats
23
+ histogram_per_code (Union[Unset, HistogramBucket]): Histogram bucket
24
+ stats_per_code (Union[Unset, HistogramStats]): Histogram stats
25
+ """
12
26
 
27
+ global_histogram: Union[Unset, "HistogramBucket"] = UNSET
28
+ global_stats: Union[Unset, "HistogramStats"] = UNSET
29
+ histogram_per_code: Union[Unset, "HistogramBucket"] = UNSET
30
+ stats_per_code: Union[Unset, "HistogramStats"] = UNSET
13
31
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
32
 
15
33
  def to_dict(self) -> dict[str, Any]:
34
+ global_histogram: Union[Unset, dict[str, Any]] = UNSET
35
+ if self.global_histogram and not isinstance(self.global_histogram, Unset):
36
+ global_histogram = self.global_histogram.to_dict()
37
+
38
+ global_stats: Union[Unset, dict[str, Any]] = UNSET
39
+ if self.global_stats and not isinstance(self.global_stats, Unset):
40
+ global_stats = self.global_stats.to_dict()
41
+
42
+ histogram_per_code: Union[Unset, dict[str, Any]] = UNSET
43
+ if self.histogram_per_code and not isinstance(self.histogram_per_code, Unset):
44
+ histogram_per_code = self.histogram_per_code.to_dict()
45
+
46
+ stats_per_code: Union[Unset, dict[str, Any]] = UNSET
47
+ if self.stats_per_code and not isinstance(self.stats_per_code, Unset):
48
+ stats_per_code = self.stats_per_code.to_dict()
49
+
16
50
  field_dict: dict[str, Any] = {}
17
51
  field_dict.update(self.additional_properties)
52
+ field_dict.update({})
53
+ if global_histogram is not UNSET:
54
+ field_dict["globalHistogram"] = global_histogram
55
+ if global_stats is not UNSET:
56
+ field_dict["globalStats"] = global_stats
57
+ if histogram_per_code is not UNSET:
58
+ field_dict["histogramPerCode"] = histogram_per_code
59
+ if stats_per_code is not UNSET:
60
+ field_dict["statsPerCode"] = stats_per_code
18
61
 
19
62
  return field_dict
20
63
 
21
64
  @classmethod
22
65
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
66
+ from ..models.histogram_bucket import HistogramBucket
67
+ from ..models.histogram_stats import HistogramStats
68
+
23
69
  if not src_dict:
24
70
  return None
25
71
  d = src_dict.copy()
26
- latency_metric = cls()
72
+ _global_histogram = d.pop("globalHistogram", UNSET)
73
+ global_histogram: Union[Unset, HistogramBucket]
74
+ if isinstance(_global_histogram, Unset):
75
+ global_histogram = UNSET
76
+ else:
77
+ global_histogram = HistogramBucket.from_dict(_global_histogram)
78
+
79
+ _global_stats = d.pop("globalStats", UNSET)
80
+ global_stats: Union[Unset, HistogramStats]
81
+ if isinstance(_global_stats, Unset):
82
+ global_stats = UNSET
83
+ else:
84
+ global_stats = HistogramStats.from_dict(_global_stats)
85
+
86
+ _histogram_per_code = d.pop("histogramPerCode", UNSET)
87
+ histogram_per_code: Union[Unset, HistogramBucket]
88
+ if isinstance(_histogram_per_code, Unset):
89
+ histogram_per_code = UNSET
90
+ else:
91
+ histogram_per_code = HistogramBucket.from_dict(_histogram_per_code)
92
+
93
+ _stats_per_code = d.pop("statsPerCode", UNSET)
94
+ stats_per_code: Union[Unset, HistogramStats]
95
+ if isinstance(_stats_per_code, Unset):
96
+ stats_per_code = UNSET
97
+ else:
98
+ stats_per_code = HistogramStats.from_dict(_stats_per_code)
99
+
100
+ latency_metric = cls(
101
+ global_histogram=global_histogram,
102
+ global_stats=global_stats,
103
+ histogram_per_code=histogram_per_code,
104
+ stats_per_code=stats_per_code,
105
+ )
27
106
 
28
107
  latency_metric.additional_properties = d
29
108
  return latency_metric
beamlit/models/metric.py CHANGED
@@ -13,13 +13,13 @@ class Metric:
13
13
  """Metric
14
14
 
15
15
  Attributes:
16
- rate (Union[Unset, str]): Metric value
17
- request_total (Union[Unset, str]): Metric value
16
+ rate (Union[Unset, int]): Metric value
17
+ request_total (Union[Unset, int]): Metric value
18
18
  timestamp (Union[Unset, str]): Metric timestamp
19
19
  """
20
20
 
21
- rate: Union[Unset, str] = UNSET
22
- request_total: Union[Unset, str] = UNSET
21
+ rate: Union[Unset, int] = UNSET
22
+ request_total: Union[Unset, int] = UNSET
23
23
  timestamp: Union[Unset, str] = UNSET
24
24
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
25