beamlit 0.0.46__py3-none-any.whl → 0.0.47__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 (45) hide show
  1. beamlit/api/agents/get_agent_metrics.py +12 -12
  2. beamlit/api/functions/get_function_metrics.py +12 -12
  3. beamlit/api/models/get_model_metrics.py +12 -12
  4. beamlit/functions/common.py +0 -1
  5. beamlit/functions/mcp/mcp.py +3 -2
  6. beamlit/models/__init__.py +8 -28
  7. beamlit/models/agent.py +6 -2
  8. beamlit/models/agent_spec.py +30 -6
  9. beamlit/models/core_spec.py +27 -5
  10. beamlit/models/core_spec_configurations.py +3 -1
  11. beamlit/models/environment.py +6 -2
  12. beamlit/models/environment_metadata.py +3 -1
  13. beamlit/models/function.py +6 -2
  14. beamlit/models/function_metadata.py +3 -1
  15. beamlit/models/function_spec.py +27 -5
  16. beamlit/models/integration_connection.py +6 -2
  17. beamlit/models/integration_connection_spec.py +18 -14
  18. beamlit/models/integration_connection_spec_config.py +45 -0
  19. beamlit/models/integration_connection_spec_secret.py +45 -0
  20. beamlit/models/latency_metric.py +24 -4
  21. beamlit/models/metadata.py +3 -1
  22. beamlit/models/metrics.py +13 -3
  23. beamlit/models/model.py +6 -2
  24. beamlit/models/model_spec.py +27 -5
  25. beamlit/models/pending_invitation_accept.py +3 -1
  26. beamlit/models/pending_invitation_render.py +13 -3
  27. beamlit/models/pod_template.py +45 -0
  28. beamlit/models/policy.py +6 -2
  29. beamlit/models/policy_max_tokens.py +106 -0
  30. beamlit/models/policy_spec.py +30 -0
  31. beamlit/models/request_duration_over_time_metrics.py +7 -1
  32. beamlit/models/request_total_by_origin_metric.py +14 -2
  33. beamlit/models/request_total_metric.py +10 -2
  34. beamlit/models/resource_environment_metrics.py +33 -7
  35. beamlit/models/resource_log.py +9 -0
  36. beamlit/models/runtime.py +10 -2
  37. beamlit/models/store_agent.py +3 -1
  38. beamlit/models/store_function.py +3 -1
  39. beamlit/models/token_rate_metrics.py +17 -3
  40. beamlit/models/trace_ids_response.py +3 -21
  41. beamlit/models/workspace.py +3 -1
  42. {beamlit-0.0.46.dist-info → beamlit-0.0.47.dist-info}/METADATA +1 -7
  43. {beamlit-0.0.46.dist-info → beamlit-0.0.47.dist-info}/RECORD +45 -41
  44. {beamlit-0.0.46.dist-info → beamlit-0.0.47.dist-info}/WHEEL +0 -0
  45. {beamlit-0.0.46.dist-info → beamlit-0.0.47.dist-info}/licenses/LICENSE +0 -0
@@ -51,8 +51,10 @@ class FunctionMetadata:
51
51
  display_name = self.display_name
52
52
 
53
53
  labels: Union[Unset, dict[str, Any]] = UNSET
54
- if self.labels and not isinstance(self.labels, Unset):
54
+ if self.labels and not isinstance(self.labels, Unset) and not isinstance(self.labels, dict):
55
55
  labels = self.labels.to_dict()
56
+ elif self.labels and isinstance(self.labels, dict):
57
+ labels = self.labels
56
58
 
57
59
  name = self.name
58
60
 
@@ -59,8 +59,14 @@ class FunctionSpec:
59
59
 
60
60
  def to_dict(self) -> dict[str, Any]:
61
61
  configurations: Union[Unset, dict[str, Any]] = UNSET
62
- if self.configurations and not isinstance(self.configurations, Unset):
62
+ if (
63
+ self.configurations
64
+ and not isinstance(self.configurations, Unset)
65
+ and not isinstance(self.configurations, dict)
66
+ ):
63
67
  configurations = self.configurations.to_dict()
68
+ elif self.configurations and isinstance(self.configurations, dict):
69
+ configurations = self.configurations
64
70
 
65
71
  enabled = self.enabled
66
72
 
@@ -76,26 +82,42 @@ class FunctionSpec:
76
82
  integration_connections = self.integration_connections
77
83
 
78
84
  pod_template: Union[Unset, dict[str, Any]] = UNSET
79
- if self.pod_template and not isinstance(self.pod_template, Unset):
85
+ if self.pod_template and not isinstance(self.pod_template, Unset) and not isinstance(self.pod_template, dict):
80
86
  pod_template = self.pod_template.to_dict()
87
+ elif self.pod_template and isinstance(self.pod_template, dict):
88
+ pod_template = self.pod_template
81
89
 
82
90
  policies: Union[Unset, list[str]] = UNSET
83
91
  if not isinstance(self.policies, Unset):
84
92
  policies = self.policies
85
93
 
86
94
  private_clusters: Union[Unset, dict[str, Any]] = UNSET
87
- if self.private_clusters and not isinstance(self.private_clusters, Unset):
95
+ if (
96
+ self.private_clusters
97
+ and not isinstance(self.private_clusters, Unset)
98
+ and not isinstance(self.private_clusters, dict)
99
+ ):
88
100
  private_clusters = self.private_clusters.to_dict()
101
+ elif self.private_clusters and isinstance(self.private_clusters, dict):
102
+ private_clusters = self.private_clusters
89
103
 
90
104
  runtime: Union[Unset, dict[str, Any]] = UNSET
91
- if self.runtime and not isinstance(self.runtime, Unset):
105
+ if self.runtime and not isinstance(self.runtime, Unset) and not isinstance(self.runtime, dict):
92
106
  runtime = self.runtime.to_dict()
107
+ elif self.runtime and isinstance(self.runtime, dict):
108
+ runtime = self.runtime
93
109
 
94
110
  sandbox = self.sandbox
95
111
 
96
112
  serverless_config: Union[Unset, dict[str, Any]] = UNSET
97
- if self.serverless_config and not isinstance(self.serverless_config, Unset):
113
+ if (
114
+ self.serverless_config
115
+ and not isinstance(self.serverless_config, Unset)
116
+ and not isinstance(self.serverless_config, dict)
117
+ ):
98
118
  serverless_config = self.serverless_config.to_dict()
119
+ elif self.serverless_config and isinstance(self.serverless_config, dict):
120
+ serverless_config = self.serverless_config
99
121
 
100
122
  description = self.description
101
123
 
@@ -28,12 +28,16 @@ class IntegrationConnection:
28
28
 
29
29
  def to_dict(self) -> dict[str, Any]:
30
30
  metadata: Union[Unset, dict[str, Any]] = UNSET
31
- if self.metadata and not isinstance(self.metadata, Unset):
31
+ if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
32
32
  metadata = self.metadata.to_dict()
33
+ elif self.metadata and isinstance(self.metadata, dict):
34
+ metadata = self.metadata
33
35
 
34
36
  spec: Union[Unset, dict[str, Any]] = UNSET
35
- if self.spec and not isinstance(self.spec, Unset):
37
+ if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
36
38
  spec = self.spec.to_dict()
39
+ elif self.spec and isinstance(self.spec, dict):
40
+ spec = self.spec
37
41
 
38
42
  field_dict: dict[str, Any] = {}
39
43
  field_dict.update(self.additional_properties)
@@ -6,8 +6,8 @@ from attrs import field as _attrs_field
6
6
  from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
- from ..models.integration_connection_config import IntegrationConnectionConfig
10
- from ..models.integration_connection_secret import IntegrationConnectionSecret
9
+ from ..models.integration_connection_spec_config import IntegrationConnectionSpecConfig
10
+ from ..models.integration_connection_spec_secret import IntegrationConnectionSpecSecret
11
11
 
12
12
 
13
13
  T = TypeVar("T", bound="IntegrationConnectionSpec")
@@ -18,30 +18,34 @@ class IntegrationConnectionSpec:
18
18
  """Integration connection specification
19
19
 
20
20
  Attributes:
21
- config (Union[Unset, IntegrationConnectionConfig]): Integration config
21
+ config (Union[Unset, IntegrationConnectionSpecConfig]): Additional configuration for the integration
22
22
  integration (Union[Unset, str]): Integration type
23
23
  sandbox (Union[Unset, bool]): Sandbox mode
24
- secret (Union[Unset, IntegrationConnectionSecret]): Integration secret
24
+ secret (Union[Unset, IntegrationConnectionSpecSecret]): Integration secret
25
25
  """
26
26
 
27
- config: Union[Unset, "IntegrationConnectionConfig"] = UNSET
27
+ config: Union[Unset, "IntegrationConnectionSpecConfig"] = UNSET
28
28
  integration: Union[Unset, str] = UNSET
29
29
  sandbox: Union[Unset, bool] = UNSET
30
- secret: Union[Unset, "IntegrationConnectionSecret"] = UNSET
30
+ secret: Union[Unset, "IntegrationConnectionSpecSecret"] = UNSET
31
31
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
32
32
 
33
33
  def to_dict(self) -> dict[str, Any]:
34
34
  config: Union[Unset, dict[str, Any]] = UNSET
35
- if self.config and not isinstance(self.config, Unset):
35
+ if self.config and not isinstance(self.config, Unset) and not isinstance(self.config, dict):
36
36
  config = self.config.to_dict()
37
+ elif self.config and isinstance(self.config, dict):
38
+ config = self.config
37
39
 
38
40
  integration = self.integration
39
41
 
40
42
  sandbox = self.sandbox
41
43
 
42
44
  secret: Union[Unset, dict[str, Any]] = UNSET
43
- if self.secret and not isinstance(self.secret, Unset):
45
+ if self.secret and not isinstance(self.secret, Unset) and not isinstance(self.secret, dict):
44
46
  secret = self.secret.to_dict()
47
+ elif self.secret and isinstance(self.secret, dict):
48
+ secret = self.secret
45
49
 
46
50
  field_dict: dict[str, Any] = {}
47
51
  field_dict.update(self.additional_properties)
@@ -59,29 +63,29 @@ class IntegrationConnectionSpec:
59
63
 
60
64
  @classmethod
61
65
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
62
- from ..models.integration_connection_config import IntegrationConnectionConfig
63
- from ..models.integration_connection_secret import IntegrationConnectionSecret
66
+ from ..models.integration_connection_spec_config import IntegrationConnectionSpecConfig
67
+ from ..models.integration_connection_spec_secret import IntegrationConnectionSpecSecret
64
68
 
65
69
  if not src_dict:
66
70
  return None
67
71
  d = src_dict.copy()
68
72
  _config = d.pop("config", UNSET)
69
- config: Union[Unset, IntegrationConnectionConfig]
73
+ config: Union[Unset, IntegrationConnectionSpecConfig]
70
74
  if isinstance(_config, Unset):
71
75
  config = UNSET
72
76
  else:
73
- config = IntegrationConnectionConfig.from_dict(_config)
77
+ config = IntegrationConnectionSpecConfig.from_dict(_config)
74
78
 
75
79
  integration = d.pop("integration", UNSET)
76
80
 
77
81
  sandbox = d.pop("sandbox", UNSET)
78
82
 
79
83
  _secret = d.pop("secret", UNSET)
80
- secret: Union[Unset, IntegrationConnectionSecret]
84
+ secret: Union[Unset, IntegrationConnectionSpecSecret]
81
85
  if isinstance(_secret, Unset):
82
86
  secret = UNSET
83
87
  else:
84
- secret = IntegrationConnectionSecret.from_dict(_secret)
88
+ secret = IntegrationConnectionSpecSecret.from_dict(_secret)
85
89
 
86
90
  integration_connection_spec = cls(
87
91
  config=config,
@@ -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="IntegrationConnectionSpecConfig")
7
+
8
+
9
+ @_attrs_define
10
+ class IntegrationConnectionSpecConfig:
11
+ """Additional configuration for the integration"""
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
+ integration_connection_spec_config = cls()
27
+
28
+ integration_connection_spec_config.additional_properties = d
29
+ return integration_connection_spec_config
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="IntegrationConnectionSpecSecret")
7
+
8
+
9
+ @_attrs_define
10
+ class IntegrationConnectionSpecSecret:
11
+ """Integration secret"""
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
+ integration_connection_spec_secret = cls()
27
+
28
+ integration_connection_spec_secret.additional_properties = d
29
+ return integration_connection_spec_secret
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
@@ -32,20 +32,40 @@ class LatencyMetric:
32
32
 
33
33
  def to_dict(self) -> dict[str, Any]:
34
34
  global_histogram: Union[Unset, dict[str, Any]] = UNSET
35
- if self.global_histogram and not isinstance(self.global_histogram, Unset):
35
+ if (
36
+ self.global_histogram
37
+ and not isinstance(self.global_histogram, Unset)
38
+ and not isinstance(self.global_histogram, dict)
39
+ ):
36
40
  global_histogram = self.global_histogram.to_dict()
41
+ elif self.global_histogram and isinstance(self.global_histogram, dict):
42
+ global_histogram = self.global_histogram
37
43
 
38
44
  global_stats: Union[Unset, dict[str, Any]] = UNSET
39
- if self.global_stats and not isinstance(self.global_stats, Unset):
45
+ if self.global_stats and not isinstance(self.global_stats, Unset) and not isinstance(self.global_stats, dict):
40
46
  global_stats = self.global_stats.to_dict()
47
+ elif self.global_stats and isinstance(self.global_stats, dict):
48
+ global_stats = self.global_stats
41
49
 
42
50
  histogram_per_code: Union[Unset, dict[str, Any]] = UNSET
43
- if self.histogram_per_code and not isinstance(self.histogram_per_code, Unset):
51
+ if (
52
+ self.histogram_per_code
53
+ and not isinstance(self.histogram_per_code, Unset)
54
+ and not isinstance(self.histogram_per_code, dict)
55
+ ):
44
56
  histogram_per_code = self.histogram_per_code.to_dict()
57
+ elif self.histogram_per_code and isinstance(self.histogram_per_code, dict):
58
+ histogram_per_code = self.histogram_per_code
45
59
 
46
60
  stats_per_code: Union[Unset, dict[str, Any]] = UNSET
47
- if self.stats_per_code and not isinstance(self.stats_per_code, Unset):
61
+ if (
62
+ self.stats_per_code
63
+ and not isinstance(self.stats_per_code, Unset)
64
+ and not isinstance(self.stats_per_code, dict)
65
+ ):
48
66
  stats_per_code = self.stats_per_code.to_dict()
67
+ elif self.stats_per_code and isinstance(self.stats_per_code, dict):
68
+ stats_per_code = self.stats_per_code
49
69
 
50
70
  field_dict: dict[str, Any] = {}
51
71
  field_dict.update(self.additional_properties)
@@ -49,8 +49,10 @@ class Metadata:
49
49
  display_name = self.display_name
50
50
 
51
51
  labels: Union[Unset, dict[str, Any]] = UNSET
52
- if self.labels and not isinstance(self.labels, Unset):
52
+ if self.labels and not isinstance(self.labels, Unset) and not isinstance(self.labels, dict):
53
53
  labels = self.labels.to_dict()
54
+ elif self.labels and isinstance(self.labels, dict):
55
+ labels = self.labels
54
56
 
55
57
  name = self.name
56
58
 
beamlit/models/metrics.py CHANGED
@@ -51,20 +51,30 @@ class Metrics:
51
51
  inference_global = self.inference_global
52
52
 
53
53
  models: Union[Unset, dict[str, Any]] = UNSET
54
- if self.models and not isinstance(self.models, Unset):
54
+ if self.models and not isinstance(self.models, Unset) and not isinstance(self.models, dict):
55
55
  models = self.models.to_dict()
56
+ elif self.models and isinstance(self.models, dict):
57
+ models = self.models
56
58
 
57
59
  request_total = self.request_total
58
60
 
59
61
  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):
62
+ if (
63
+ self.request_total_per_code
64
+ and not isinstance(self.request_total_per_code, Unset)
65
+ and not isinstance(self.request_total_per_code, dict)
66
+ ):
61
67
  request_total_per_code = self.request_total_per_code.to_dict()
68
+ elif self.request_total_per_code and isinstance(self.request_total_per_code, dict):
69
+ request_total_per_code = self.request_total_per_code
62
70
 
63
71
  rps = self.rps
64
72
 
65
73
  rps_per_code: Union[Unset, dict[str, Any]] = UNSET
66
- if self.rps_per_code and not isinstance(self.rps_per_code, Unset):
74
+ if self.rps_per_code and not isinstance(self.rps_per_code, Unset) and not isinstance(self.rps_per_code, dict):
67
75
  rps_per_code = self.rps_per_code.to_dict()
76
+ elif self.rps_per_code and isinstance(self.rps_per_code, dict):
77
+ rps_per_code = self.rps_per_code
68
78
 
69
79
  field_dict: dict[str, Any] = {}
70
80
  field_dict.update(self.additional_properties)
beamlit/models/model.py CHANGED
@@ -40,12 +40,16 @@ class Model:
40
40
  events.append(componentsschemas_core_events_item)
41
41
 
42
42
  metadata: Union[Unset, dict[str, Any]] = UNSET
43
- if self.metadata and not isinstance(self.metadata, Unset):
43
+ if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
44
44
  metadata = self.metadata.to_dict()
45
+ elif self.metadata and isinstance(self.metadata, dict):
46
+ metadata = self.metadata
45
47
 
46
48
  spec: Union[Unset, dict[str, Any]] = UNSET
47
- if self.spec and not isinstance(self.spec, Unset):
49
+ if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
48
50
  spec = self.spec.to_dict()
51
+ elif self.spec and isinstance(self.spec, dict):
52
+ spec = self.spec
49
53
 
50
54
  status = self.status
51
55
 
@@ -48,8 +48,14 @@ class ModelSpec:
48
48
 
49
49
  def to_dict(self) -> dict[str, Any]:
50
50
  configurations: Union[Unset, dict[str, Any]] = UNSET
51
- if self.configurations and not isinstance(self.configurations, Unset):
51
+ if (
52
+ self.configurations
53
+ and not isinstance(self.configurations, Unset)
54
+ and not isinstance(self.configurations, dict)
55
+ ):
52
56
  configurations = self.configurations.to_dict()
57
+ elif self.configurations and isinstance(self.configurations, dict):
58
+ configurations = self.configurations
53
59
 
54
60
  enabled = self.enabled
55
61
 
@@ -65,26 +71,42 @@ class ModelSpec:
65
71
  integration_connections = self.integration_connections
66
72
 
67
73
  pod_template: Union[Unset, dict[str, Any]] = UNSET
68
- if self.pod_template and not isinstance(self.pod_template, Unset):
74
+ if self.pod_template and not isinstance(self.pod_template, Unset) and not isinstance(self.pod_template, dict):
69
75
  pod_template = self.pod_template.to_dict()
76
+ elif self.pod_template and isinstance(self.pod_template, dict):
77
+ pod_template = self.pod_template
70
78
 
71
79
  policies: Union[Unset, list[str]] = UNSET
72
80
  if not isinstance(self.policies, Unset):
73
81
  policies = self.policies
74
82
 
75
83
  private_clusters: Union[Unset, dict[str, Any]] = UNSET
76
- if self.private_clusters and not isinstance(self.private_clusters, Unset):
84
+ if (
85
+ self.private_clusters
86
+ and not isinstance(self.private_clusters, Unset)
87
+ and not isinstance(self.private_clusters, dict)
88
+ ):
77
89
  private_clusters = self.private_clusters.to_dict()
90
+ elif self.private_clusters and isinstance(self.private_clusters, dict):
91
+ private_clusters = self.private_clusters
78
92
 
79
93
  runtime: Union[Unset, dict[str, Any]] = UNSET
80
- if self.runtime and not isinstance(self.runtime, Unset):
94
+ if self.runtime and not isinstance(self.runtime, Unset) and not isinstance(self.runtime, dict):
81
95
  runtime = self.runtime.to_dict()
96
+ elif self.runtime and isinstance(self.runtime, dict):
97
+ runtime = self.runtime
82
98
 
83
99
  sandbox = self.sandbox
84
100
 
85
101
  serverless_config: Union[Unset, dict[str, Any]] = UNSET
86
- if self.serverless_config and not isinstance(self.serverless_config, Unset):
102
+ if (
103
+ self.serverless_config
104
+ and not isinstance(self.serverless_config, Unset)
105
+ and not isinstance(self.serverless_config, dict)
106
+ ):
87
107
  serverless_config = self.serverless_config.to_dict()
108
+ elif self.serverless_config and isinstance(self.serverless_config, dict):
109
+ serverless_config = self.serverless_config
88
110
 
89
111
  field_dict: dict[str, Any] = {}
90
112
  field_dict.update(self.additional_properties)
@@ -29,8 +29,10 @@ class PendingInvitationAccept:
29
29
  email = self.email
30
30
 
31
31
  workspace: Union[Unset, dict[str, Any]] = UNSET
32
- if self.workspace and not isinstance(self.workspace, Unset):
32
+ if self.workspace and not isinstance(self.workspace, Unset) and not isinstance(self.workspace, dict):
33
33
  workspace = self.workspace.to_dict()
34
+ elif self.workspace and isinstance(self.workspace, dict):
35
+ workspace = self.workspace
34
36
 
35
37
  field_dict: dict[str, Any] = {}
36
38
  field_dict.update(self.additional_properties)
@@ -41,18 +41,28 @@ class PendingInvitationRender:
41
41
  invited_at = self.invited_at
42
42
 
43
43
  invited_by: Union[Unset, dict[str, Any]] = UNSET
44
- if self.invited_by and not isinstance(self.invited_by, Unset):
44
+ if self.invited_by and not isinstance(self.invited_by, Unset) and not isinstance(self.invited_by, dict):
45
45
  invited_by = self.invited_by.to_dict()
46
+ elif self.invited_by and isinstance(self.invited_by, dict):
47
+ invited_by = self.invited_by
46
48
 
47
49
  role = self.role
48
50
 
49
51
  workspace: Union[Unset, dict[str, Any]] = UNSET
50
- if self.workspace and not isinstance(self.workspace, Unset):
52
+ if self.workspace and not isinstance(self.workspace, Unset) and not isinstance(self.workspace, dict):
51
53
  workspace = self.workspace.to_dict()
54
+ elif self.workspace and isinstance(self.workspace, dict):
55
+ workspace = self.workspace
52
56
 
53
57
  workspace_details: Union[Unset, dict[str, Any]] = UNSET
54
- if self.workspace_details and not isinstance(self.workspace_details, Unset):
58
+ if (
59
+ self.workspace_details
60
+ and not isinstance(self.workspace_details, Unset)
61
+ and not isinstance(self.workspace_details, dict)
62
+ ):
55
63
  workspace_details = self.workspace_details.to_dict()
64
+ elif self.workspace_details and isinstance(self.workspace_details, dict):
65
+ workspace_details = self.workspace_details
56
66
 
57
67
  field_dict: dict[str, Any] = {}
58
68
  field_dict.update(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="PodTemplate")
7
+
8
+
9
+ @_attrs_define
10
+ class PodTemplate:
11
+ """Pod template specification"""
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
+ pod_template = cls()
27
+
28
+ pod_template.additional_properties = d
29
+ return pod_template
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
beamlit/models/policy.py CHANGED
@@ -28,12 +28,16 @@ class Policy:
28
28
 
29
29
  def to_dict(self) -> dict[str, Any]:
30
30
  metadata: Union[Unset, dict[str, Any]] = UNSET
31
- if self.metadata and not isinstance(self.metadata, Unset):
31
+ if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
32
32
  metadata = self.metadata.to_dict()
33
+ elif self.metadata and isinstance(self.metadata, dict):
34
+ metadata = self.metadata
33
35
 
34
36
  spec: Union[Unset, dict[str, Any]] = UNSET
35
- if self.spec and not isinstance(self.spec, Unset):
37
+ if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
36
38
  spec = self.spec.to_dict()
39
+ elif self.spec and isinstance(self.spec, dict):
40
+ spec = self.spec
37
41
 
38
42
  field_dict: dict[str, Any] = {}
39
43
  field_dict.update(self.additional_properties)
@@ -0,0 +1,106 @@
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="PolicyMaxTokens")
9
+
10
+
11
+ @_attrs_define
12
+ class PolicyMaxTokens:
13
+ """PolicyMaxTokens is a local type that wraps a slice of PolicyMaxTokens
14
+
15
+ Attributes:
16
+ granularity (Union[Unset, str]): Granularity
17
+ input_ (Union[Unset, int]): Input
18
+ output (Union[Unset, int]): Output
19
+ ratio_input_over_output (Union[Unset, int]): RatioInputOverOutput
20
+ step (Union[Unset, int]): Step
21
+ total (Union[Unset, int]): Total
22
+ """
23
+
24
+ granularity: Union[Unset, str] = UNSET
25
+ input_: Union[Unset, int] = UNSET
26
+ output: Union[Unset, int] = UNSET
27
+ ratio_input_over_output: Union[Unset, int] = UNSET
28
+ step: Union[Unset, int] = UNSET
29
+ total: Union[Unset, int] = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ granularity = self.granularity
34
+
35
+ input_ = self.input_
36
+
37
+ output = self.output
38
+
39
+ ratio_input_over_output = self.ratio_input_over_output
40
+
41
+ step = self.step
42
+
43
+ total = self.total
44
+
45
+ field_dict: dict[str, Any] = {}
46
+ field_dict.update(self.additional_properties)
47
+ field_dict.update({})
48
+ if granularity is not UNSET:
49
+ field_dict["granularity"] = granularity
50
+ if input_ is not UNSET:
51
+ field_dict["input"] = input_
52
+ if output is not UNSET:
53
+ field_dict["output"] = output
54
+ if ratio_input_over_output is not UNSET:
55
+ field_dict["ratioInputOverOutput"] = ratio_input_over_output
56
+ if step is not UNSET:
57
+ field_dict["step"] = step
58
+ if total is not UNSET:
59
+ field_dict["total"] = total
60
+
61
+ return field_dict
62
+
63
+ @classmethod
64
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
65
+ if not src_dict:
66
+ return None
67
+ d = src_dict.copy()
68
+ granularity = d.pop("granularity", UNSET)
69
+
70
+ input_ = d.pop("input", UNSET)
71
+
72
+ output = d.pop("output", UNSET)
73
+
74
+ ratio_input_over_output = d.pop("ratioInputOverOutput", UNSET)
75
+
76
+ step = d.pop("step", UNSET)
77
+
78
+ total = d.pop("total", UNSET)
79
+
80
+ policy_max_tokens = cls(
81
+ granularity=granularity,
82
+ input_=input_,
83
+ output=output,
84
+ ratio_input_over_output=ratio_input_over_output,
85
+ step=step,
86
+ total=total,
87
+ )
88
+
89
+ policy_max_tokens.additional_properties = d
90
+ return policy_max_tokens
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