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.
Files changed (81) hide show
  1. beamlit/agents/__init__.py +2 -1
  2. beamlit/agents/chat.py +16 -4
  3. beamlit/agents/decorator.py +68 -155
  4. beamlit/agents/thread.py +14 -0
  5. beamlit/api/workspaces/workspace_quotas_request.py +97 -0
  6. beamlit/authentication/clientcredentials.py +5 -3
  7. beamlit/authentication/device_mode.py +4 -4
  8. beamlit/common/__init__.py +1 -2
  9. beamlit/common/instrumentation.py +202 -34
  10. beamlit/common/settings.py +7 -64
  11. beamlit/deploy/deploy.py +64 -60
  12. beamlit/deploy/format.py +10 -0
  13. beamlit/functions/__init__.py +2 -2
  14. beamlit/functions/decorator.py +149 -1
  15. beamlit/functions/github/github.py +0 -1
  16. beamlit/models/__init__.py +51 -11
  17. beamlit/models/agent.py +27 -15
  18. beamlit/models/agent_metadata.py +1 -1
  19. beamlit/models/agent_render.py +45 -0
  20. beamlit/models/agent_spec.py +32 -5
  21. beamlit/models/core_event.py +88 -0
  22. beamlit/models/core_spec.py +14 -5
  23. beamlit/models/core_spec_configurations.py +1 -1
  24. beamlit/models/core_status.py +3 -20
  25. beamlit/models/environment.py +2 -2
  26. beamlit/models/environment_metadata.py +1 -1
  27. beamlit/models/function.py +27 -15
  28. beamlit/models/function_metadata.py +1 -1
  29. beamlit/models/function_render.py +45 -0
  30. beamlit/models/function_spec.py +14 -5
  31. beamlit/models/histogram_bucket.py +79 -0
  32. beamlit/models/histogram_stats.py +88 -0
  33. beamlit/models/increase_and_rate_metric.py +0 -9
  34. beamlit/models/integration_connection.py +2 -2
  35. beamlit/models/integration_connection_spec.py +11 -2
  36. beamlit/models/integration_repository.py +88 -0
  37. beamlit/models/last_n_requests_metric.py +88 -0
  38. beamlit/models/latency_metric.py +124 -0
  39. beamlit/models/metadata.py +1 -1
  40. beamlit/models/metric.py +18 -9
  41. beamlit/models/metrics.py +81 -46
  42. beamlit/models/metrics_models.py +45 -0
  43. beamlit/models/metrics_request_total_per_code.py +45 -0
  44. beamlit/models/metrics_rps_per_code.py +45 -0
  45. beamlit/models/model.py +27 -15
  46. beamlit/models/model_metadata.py +1 -1
  47. beamlit/models/model_provider.py +2 -2
  48. beamlit/models/model_render.py +45 -0
  49. beamlit/models/model_spec.py +14 -14
  50. beamlit/models/pending_invitation_accept.py +1 -1
  51. beamlit/models/pending_invitation_render.py +3 -3
  52. beamlit/models/policy.py +2 -2
  53. beamlit/models/provider_config.py +1 -1
  54. beamlit/models/repository.py +70 -0
  55. beamlit/models/repository_type_0.py +70 -0
  56. beamlit/models/request_duration_over_time_metric.py +97 -0
  57. beamlit/models/request_duration_over_time_metrics.py +74 -0
  58. beamlit/models/request_total_by_origin_metric.py +103 -0
  59. beamlit/models/request_total_by_origin_metric_request_total_by_origin.py +45 -0
  60. beamlit/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +45 -0
  61. beamlit/models/request_total_metric.py +115 -0
  62. beamlit/models/request_total_metric_request_total_per_code.py +45 -0
  63. beamlit/models/request_total_metric_rps_per_code.py +45 -0
  64. beamlit/models/resource_deployment_metrics.py +6 -4
  65. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +1 -1
  66. beamlit/models/resource_environment_metrics.py +155 -75
  67. beamlit/models/resource_environment_metrics_request_total_per_code.py +45 -0
  68. beamlit/models/resource_environment_metrics_rps_per_code.py +45 -0
  69. beamlit/models/resource_metrics.py +1 -1
  70. beamlit/models/runtime.py +2 -2
  71. beamlit/models/store_agent.py +1 -1
  72. beamlit/models/store_function.py +1 -1
  73. beamlit/models/token_rate_metric.py +88 -0
  74. beamlit/models/token_rate_metrics.py +106 -0
  75. beamlit/models/token_total_metric.py +106 -0
  76. beamlit/models/workspace.py +17 -8
  77. beamlit/serve/app.py +9 -13
  78. {beamlit-0.0.33rc49.dist-info → beamlit-0.0.34.dist-info}/METADATA +21 -3
  79. {beamlit-0.0.33rc49.dist-info → beamlit-0.0.34.dist-info}/RECORD +80 -52
  80. beamlit/common/generate.py +0 -196
  81. {beamlit-0.0.33rc49.dist-info → beamlit-0.0.34.dist-info}/WHEEL +0 -0
@@ -28,11 +28,11 @@ class IntegrationConnection:
28
28
 
29
29
  def to_dict(self) -> dict[str, Any]:
30
30
  metadata: Union[Unset, dict[str, Any]] = UNSET
31
- if not isinstance(self.metadata, Unset):
31
+ if self.metadata and not isinstance(self.metadata, Unset):
32
32
  metadata = self.metadata.to_dict()
33
33
 
34
34
  spec: Union[Unset, dict[str, Any]] = UNSET
35
- if not isinstance(self.spec, Unset):
35
+ if self.spec and not isinstance(self.spec, Unset):
36
36
  spec = self.spec.to_dict()
37
37
 
38
38
  field_dict: dict[str, Any] = {}
@@ -20,23 +20,27 @@ class IntegrationConnectionSpec:
20
20
  Attributes:
21
21
  config (Union[Unset, IntegrationConnectionConfig]): Integration config
22
22
  integration (Union[Unset, str]): Integration type
23
+ sandbox (Union[Unset, bool]): Sandbox mode
23
24
  secret (Union[Unset, IntegrationConnectionSecret]): Integration secret
24
25
  """
25
26
 
26
27
  config: Union[Unset, "IntegrationConnectionConfig"] = UNSET
27
28
  integration: Union[Unset, str] = UNSET
29
+ sandbox: Union[Unset, bool] = UNSET
28
30
  secret: Union[Unset, "IntegrationConnectionSecret"] = UNSET
29
31
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
32
 
31
33
  def to_dict(self) -> dict[str, Any]:
32
34
  config: Union[Unset, dict[str, Any]] = UNSET
33
- if not isinstance(self.config, Unset):
35
+ if self.config and not isinstance(self.config, Unset):
34
36
  config = self.config.to_dict()
35
37
 
36
38
  integration = self.integration
37
39
 
40
+ sandbox = self.sandbox
41
+
38
42
  secret: Union[Unset, dict[str, Any]] = UNSET
39
- if not isinstance(self.secret, Unset):
43
+ if self.secret and not isinstance(self.secret, Unset):
40
44
  secret = self.secret.to_dict()
41
45
 
42
46
  field_dict: dict[str, Any] = {}
@@ -46,6 +50,8 @@ class IntegrationConnectionSpec:
46
50
  field_dict["config"] = config
47
51
  if integration is not UNSET:
48
52
  field_dict["integration"] = integration
53
+ if sandbox is not UNSET:
54
+ field_dict["sandbox"] = sandbox
49
55
  if secret is not UNSET:
50
56
  field_dict["secret"] = secret
51
57
 
@@ -68,6 +74,8 @@ class IntegrationConnectionSpec:
68
74
 
69
75
  integration = d.pop("integration", UNSET)
70
76
 
77
+ sandbox = d.pop("sandbox", UNSET)
78
+
71
79
  _secret = d.pop("secret", UNSET)
72
80
  secret: Union[Unset, IntegrationConnectionSecret]
73
81
  if isinstance(_secret, Unset):
@@ -78,6 +86,7 @@ class IntegrationConnectionSpec:
78
86
  integration_connection_spec = cls(
79
87
  config=config,
80
88
  integration=integration,
89
+ sandbox=sandbox,
81
90
  secret=secret,
82
91
  )
83
92
 
@@ -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="IntegrationRepository")
9
+
10
+
11
+ @_attrs_define
12
+ class IntegrationRepository:
13
+ """Integration repository
14
+
15
+ Attributes:
16
+ id (Union[Unset, str]): Repository ID
17
+ name (Union[Unset, str]): Repository name
18
+ organization (Union[Unset, str]): Repository owner
19
+ url (Union[Unset, str]): Repository URL
20
+ """
21
+
22
+ id: Union[Unset, str] = UNSET
23
+ name: Union[Unset, str] = UNSET
24
+ organization: Union[Unset, str] = UNSET
25
+ url: 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
+ id = self.id
30
+
31
+ name = self.name
32
+
33
+ organization = self.organization
34
+
35
+ url = self.url
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update({})
40
+ if id is not UNSET:
41
+ field_dict["id"] = id
42
+ if name is not UNSET:
43
+ field_dict["name"] = name
44
+ if organization is not UNSET:
45
+ field_dict["organization"] = organization
46
+ if url is not UNSET:
47
+ field_dict["url"] = url
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
+ id = d.pop("id", UNSET)
57
+
58
+ name = d.pop("name", UNSET)
59
+
60
+ organization = d.pop("organization", UNSET)
61
+
62
+ url = d.pop("url", UNSET)
63
+
64
+ integration_repository = cls(
65
+ id=id,
66
+ name=name,
67
+ organization=organization,
68
+ url=url,
69
+ )
70
+
71
+ integration_repository.additional_properties = d
72
+ return integration_repository
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,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="LastNRequestsMetric")
9
+
10
+
11
+ @_attrs_define
12
+ class LastNRequestsMetric:
13
+ """Last N requests
14
+
15
+ Attributes:
16
+ date (Union[Unset, str]): Timestamp
17
+ environment (Union[Unset, str]): Environment
18
+ workload_type (Union[Unset, str]): Workload type
19
+ workspace (Union[Unset, str]): Workspace
20
+ """
21
+
22
+ date: Union[Unset, str] = UNSET
23
+ environment: Union[Unset, str] = UNSET
24
+ workload_type: 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
+ date = self.date
30
+
31
+ environment = self.environment
32
+
33
+ workload_type = self.workload_type
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 date is not UNSET:
41
+ field_dict["date"] = date
42
+ if environment is not UNSET:
43
+ field_dict["environment"] = environment
44
+ if workload_type is not UNSET:
45
+ field_dict["workloadType"] = workload_type
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
+ if not src_dict:
54
+ return None
55
+ d = src_dict.copy()
56
+ date = d.pop("date", UNSET)
57
+
58
+ environment = d.pop("environment", UNSET)
59
+
60
+ workload_type = d.pop("workloadType", UNSET)
61
+
62
+ workspace = d.pop("workspace", UNSET)
63
+
64
+ last_n_requests_metric = cls(
65
+ date=date,
66
+ environment=environment,
67
+ workload_type=workload_type,
68
+ workspace=workspace,
69
+ )
70
+
71
+ last_n_requests_metric.additional_properties = d
72
+ return last_n_requests_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,124 @@
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.histogram_bucket import HistogramBucket
10
+ from ..models.histogram_stats import HistogramStats
11
+
12
+
13
+ T = TypeVar("T", bound="LatencyMetric")
14
+
15
+
16
+ @_attrs_define
17
+ class LatencyMetric:
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
+ """
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
31
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
32
+
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
+
50
+ field_dict: dict[str, Any] = {}
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
61
+
62
+ return field_dict
63
+
64
+ @classmethod
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
+
69
+ if not src_dict:
70
+ return None
71
+ d = src_dict.copy()
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
+ )
106
+
107
+ latency_metric.additional_properties = d
108
+ return latency_metric
109
+
110
+ @property
111
+ def additional_keys(self) -> list[str]:
112
+ return list(self.additional_properties.keys())
113
+
114
+ def __getitem__(self, key: str) -> Any:
115
+ return self.additional_properties[key]
116
+
117
+ def __setitem__(self, key: str, value: Any) -> None:
118
+ self.additional_properties[key] = value
119
+
120
+ def __delitem__(self, key: str) -> None:
121
+ del self.additional_properties[key]
122
+
123
+ def __contains__(self, key: str) -> bool:
124
+ return key in self.additional_properties
@@ -49,7 +49,7 @@ class Metadata:
49
49
  display_name = self.display_name
50
50
 
51
51
  labels: Union[Unset, dict[str, Any]] = UNSET
52
- if not isinstance(self.labels, Unset):
52
+ if self.labels and not isinstance(self.labels, Unset):
53
53
  labels = self.labels.to_dict()
54
54
 
55
55
  name = self.name
beamlit/models/metric.py CHANGED
@@ -13,26 +13,32 @@ class Metric:
13
13
  """Metric
14
14
 
15
15
  Attributes:
16
+ rate (Union[Unset, int]): Metric value
17
+ request_total (Union[Unset, int]): Metric value
16
18
  timestamp (Union[Unset, str]): Metric timestamp
17
- value (Union[Unset, str]): Metric value
18
19
  """
19
20
 
21
+ rate: Union[Unset, int] = UNSET
22
+ request_total: Union[Unset, int] = UNSET
20
23
  timestamp: Union[Unset, str] = UNSET
21
- value: Union[Unset, str] = UNSET
22
24
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
25
 
24
26
  def to_dict(self) -> dict[str, Any]:
25
- timestamp = self.timestamp
27
+ rate = self.rate
28
+
29
+ request_total = self.request_total
26
30
 
27
- value = self.value
31
+ timestamp = self.timestamp
28
32
 
29
33
  field_dict: dict[str, Any] = {}
30
34
  field_dict.update(self.additional_properties)
31
35
  field_dict.update({})
36
+ if rate is not UNSET:
37
+ field_dict["rate"] = rate
38
+ if request_total is not UNSET:
39
+ field_dict["requestTotal"] = request_total
32
40
  if timestamp is not UNSET:
33
41
  field_dict["timestamp"] = timestamp
34
- if value is not UNSET:
35
- field_dict["value"] = value
36
42
 
37
43
  return field_dict
38
44
 
@@ -41,13 +47,16 @@ class Metric:
41
47
  if not src_dict:
42
48
  return None
43
49
  d = src_dict.copy()
44
- timestamp = d.pop("timestamp", UNSET)
50
+ rate = d.pop("rate", UNSET)
51
+
52
+ request_total = d.pop("requestTotal", UNSET)
45
53
 
46
- value = d.pop("value", UNSET)
54
+ timestamp = d.pop("timestamp", UNSET)
47
55
 
48
56
  metric = cls(
57
+ rate=rate,
58
+ request_total=request_total,
49
59
  timestamp=timestamp,
50
- value=value,
51
60
  )
52
61
 
53
62
  metric.additional_properties = d
beamlit/models/metrics.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, TypeVar, Union
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -6,7 +6,9 @@ from attrs import field as _attrs_field
6
6
  from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
- from ..models.increase_and_rate_metric import IncreaseAndRateMetric
9
+ from ..models.metrics_models import MetricsModels
10
+ from ..models.metrics_request_total_per_code import MetricsRequestTotalPerCode
11
+ from ..models.metrics_rps_per_code import MetricsRpsPerCode
10
12
 
11
13
 
12
14
  T = TypeVar("T", bound="Metrics")
@@ -17,91 +19,124 @@ class Metrics:
17
19
  """Metrics for resources
18
20
 
19
21
  Attributes:
20
- inference_global (Union[Unset, Any]): Historical requests for all resources globally
21
- query (Union[Unset, Any]): Number of requests for all resources globally
22
- agents (Union[Unset, IncreaseAndRateMetric]): Metrics for resources
23
- functions (Union[Unset, IncreaseAndRateMetric]): Metrics for resources
24
- models (Union[Unset, IncreaseAndRateMetric]): Metrics for resources
22
+ agents (Union[Unset, Any]): Metrics for agents
23
+ functions (Union[Unset, Any]): Metrics for functions
24
+ inference_global (Union[Unset, list[Any]]): Historical requests for all resources globally
25
+ models (Union[Unset, MetricsModels]): Metrics for models
26
+ request_total (Union[Unset, float]): Number of requests for all resources globally
27
+ request_total_per_code (Union[Unset, MetricsRequestTotalPerCode]): Number of requests for all resources globally
28
+ per code
29
+ rps (Union[Unset, float]): Number of requests per second for all resources globally
30
+ rps_per_code (Union[Unset, MetricsRpsPerCode]): Number of requests per second for all resources globally per
31
+ code
25
32
  """
26
33
 
27
- inference_global: Union[Unset, Any] = UNSET
28
- query: Union[Unset, Any] = UNSET
29
- agents: Union[Unset, "IncreaseAndRateMetric"] = UNSET
30
- functions: Union[Unset, "IncreaseAndRateMetric"] = UNSET
31
- models: Union[Unset, "IncreaseAndRateMetric"] = UNSET
34
+ agents: Union[Unset, Any] = UNSET
35
+ functions: Union[Unset, Any] = UNSET
36
+ inference_global: Union[Unset, list[Any]] = UNSET
37
+ models: Union[Unset, "MetricsModels"] = UNSET
38
+ request_total: Union[Unset, float] = UNSET
39
+ request_total_per_code: Union[Unset, "MetricsRequestTotalPerCode"] = UNSET
40
+ rps: Union[Unset, float] = UNSET
41
+ rps_per_code: Union[Unset, "MetricsRpsPerCode"] = UNSET
32
42
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
43
 
34
44
  def to_dict(self) -> dict[str, Any]:
35
- inference_global = self.inference_global
45
+ agents = self.agents
36
46
 
37
- query = self.query
47
+ functions = self.functions
38
48
 
39
- agents: Union[Unset, dict[str, Any]] = UNSET
40
- if not isinstance(self.agents, Unset):
41
- agents = self.agents.to_dict()
42
-
43
- functions: Union[Unset, dict[str, Any]] = UNSET
44
- if not isinstance(self.functions, Unset):
45
- functions = self.functions.to_dict()
49
+ inference_global: Union[Unset, list[Any]] = UNSET
50
+ if not isinstance(self.inference_global, Unset):
51
+ inference_global = self.inference_global
46
52
 
47
53
  models: Union[Unset, dict[str, Any]] = UNSET
48
- if not isinstance(self.models, Unset):
54
+ if self.models and not isinstance(self.models, Unset):
49
55
  models = self.models.to_dict()
50
56
 
57
+ request_total = self.request_total
58
+
59
+ request_total_per_code: Union[Unset, dict[str, Any]] = UNSET
60
+ if self.request_total_per_code and not isinstance(self.request_total_per_code, Unset):
61
+ request_total_per_code = self.request_total_per_code.to_dict()
62
+
63
+ rps = self.rps
64
+
65
+ rps_per_code: Union[Unset, dict[str, Any]] = UNSET
66
+ if self.rps_per_code and not isinstance(self.rps_per_code, Unset):
67
+ rps_per_code = self.rps_per_code.to_dict()
68
+
51
69
  field_dict: dict[str, Any] = {}
52
70
  field_dict.update(self.additional_properties)
53
71
  field_dict.update({})
54
- if inference_global is not UNSET:
55
- field_dict["inferenceGlobal"] = inference_global
56
- if query is not UNSET:
57
- field_dict["query"] = query
58
72
  if agents is not UNSET:
59
73
  field_dict["agents"] = agents
60
74
  if functions is not UNSET:
61
75
  field_dict["functions"] = functions
76
+ if inference_global is not UNSET:
77
+ field_dict["inferenceGlobal"] = inference_global
62
78
  if models is not UNSET:
63
79
  field_dict["models"] = models
80
+ if request_total is not UNSET:
81
+ field_dict["requestTotal"] = request_total
82
+ if request_total_per_code is not UNSET:
83
+ field_dict["requestTotalPerCode"] = request_total_per_code
84
+ if rps is not UNSET:
85
+ field_dict["rps"] = rps
86
+ if rps_per_code is not UNSET:
87
+ field_dict["rpsPerCode"] = rps_per_code
64
88
 
65
89
  return field_dict
66
90
 
67
91
  @classmethod
68
92
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
69
- from ..models.increase_and_rate_metric import IncreaseAndRateMetric
93
+ from ..models.metrics_models import MetricsModels
94
+ from ..models.metrics_request_total_per_code import MetricsRequestTotalPerCode
95
+ from ..models.metrics_rps_per_code import MetricsRpsPerCode
70
96
 
71
97
  if not src_dict:
72
98
  return None
73
99
  d = src_dict.copy()
74
- inference_global = d.pop("inferenceGlobal", UNSET)
75
-
76
- query = d.pop("query", UNSET)
100
+ agents = d.pop("agents", UNSET)
77
101
 
78
- _agents = d.pop("agents", UNSET)
79
- agents: Union[Unset, IncreaseAndRateMetric]
80
- if isinstance(_agents, Unset):
81
- agents = UNSET
82
- else:
83
- agents = IncreaseAndRateMetric.from_dict(_agents)
102
+ functions = d.pop("functions", UNSET)
84
103
 
85
- _functions = d.pop("functions", UNSET)
86
- functions: Union[Unset, IncreaseAndRateMetric]
87
- if isinstance(_functions, Unset):
88
- functions = UNSET
89
- else:
90
- functions = IncreaseAndRateMetric.from_dict(_functions)
104
+ inference_global = cast(list[Any], d.pop("inferenceGlobal", UNSET))
91
105
 
92
106
  _models = d.pop("models", UNSET)
93
- models: Union[Unset, IncreaseAndRateMetric]
107
+ models: Union[Unset, MetricsModels]
94
108
  if isinstance(_models, Unset):
95
109
  models = UNSET
96
110
  else:
97
- models = IncreaseAndRateMetric.from_dict(_models)
111
+ models = MetricsModels.from_dict(_models)
112
+
113
+ request_total = d.pop("requestTotal", UNSET)
114
+
115
+ _request_total_per_code = d.pop("requestTotalPerCode", UNSET)
116
+ request_total_per_code: Union[Unset, MetricsRequestTotalPerCode]
117
+ if isinstance(_request_total_per_code, Unset):
118
+ request_total_per_code = UNSET
119
+ else:
120
+ request_total_per_code = MetricsRequestTotalPerCode.from_dict(_request_total_per_code)
121
+
122
+ rps = d.pop("rps", UNSET)
123
+
124
+ _rps_per_code = d.pop("rpsPerCode", UNSET)
125
+ rps_per_code: Union[Unset, MetricsRpsPerCode]
126
+ if isinstance(_rps_per_code, Unset):
127
+ rps_per_code = UNSET
128
+ else:
129
+ rps_per_code = MetricsRpsPerCode.from_dict(_rps_per_code)
98
130
 
99
131
  metrics = cls(
100
- inference_global=inference_global,
101
- query=query,
102
132
  agents=agents,
103
133
  functions=functions,
134
+ inference_global=inference_global,
104
135
  models=models,
136
+ request_total=request_total,
137
+ request_total_per_code=request_total_per_code,
138
+ rps=rps,
139
+ rps_per_code=rps_per_code,
105
140
  )
106
141
 
107
142
  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="MetricsModels")
7
+
8
+
9
+ @_attrs_define
10
+ class MetricsModels:
11
+ """Metrics for models"""
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
+ metrics_models = cls()
27
+
28
+ metrics_models.additional_properties = d
29
+ return metrics_models
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