1010from simple_di import Provide
1111from simple_di import inject
1212
13+ from ._internal .bento import Bento
1314from ._internal .cloud .deployment import Deployment
1415from ._internal .cloud .deployment import DeploymentConfigParameters
1516from ._internal .cloud .schemas .modelschemas import EnvItemSchema
2122if t .TYPE_CHECKING :
2223 from ._internal .cloud import BentoCloudClient
2324
25+ BentoType = t .Union [str , Tag , Bento ]
26+
2427
2528@t .overload
2629def create (
2730 name : str | None = ...,
2831 path_context : str | None = ...,
2932 * ,
30- bento : Tag | str | None = ...,
33+ bento : BentoType | None = ...,
3134 cluster : str | None = ...,
3235 access_authorization : bool | None = ...,
3336 scaling_min : int | None = ...,
@@ -44,7 +47,7 @@ def create(
4447 name : str | None = ...,
4548 path_context : str | None = ...,
4649 * ,
47- bento : Tag | str | None = ...,
50+ bento : BentoType | None = ...,
4851 config_file : str | None = ...,
4952) -> Deployment : ...
5053
@@ -54,7 +57,7 @@ def create(
5457 name : str | None = ...,
5558 path_context : str | None = ...,
5659 * ,
57- bento : Tag | str | None = ...,
60+ bento : BentoType | None = ...,
5861 config_dict : dict [str , t .Any ] | None = ...,
5962) -> Deployment : ...
6063
@@ -64,7 +67,7 @@ def create(
6467 name : str | None = None ,
6568 path_context : str | None = None ,
6669 * ,
67- bento : Tag | str | None = None ,
70+ bento : BentoType | None = None ,
6871 cluster : str | None = None ,
6972 access_authorization : bool | None = None ,
7073 scaling_min : int | None = None ,
@@ -85,7 +88,7 @@ def create(
8588 config_params = DeploymentConfigParameters (
8689 name = name ,
8790 path_context = path_context ,
88- bento = bento ,
91+ bento = bento . tag if isinstance ( bento , Bento ) else bento ,
8992 cluster = cluster ,
9093 access_authorization = access_authorization ,
9194 scaling_max = scaling_max ,
@@ -120,7 +123,7 @@ def update(
120123 context : str | None = ...,
121124 cluster : str | None = ...,
122125 * ,
123- bento : Tag | str | None = ...,
126+ bento : BentoType | None = ...,
124127 access_authorization : bool | None = ...,
125128 scaling_min : int | None = ...,
126129 scaling_max : int | None = ...,
@@ -139,7 +142,7 @@ def update(
139142 context : str | None = ...,
140143 cluster : str | None = None ,
141144 * ,
142- bento : Tag | str | None = ...,
145+ bento : BentoType | None = ...,
143146 config_file : str | None = ...,
144147) -> Deployment : ...
145148
@@ -151,7 +154,7 @@ def update(
151154 context : str | None = ...,
152155 cluster : str | None = None ,
153156 * ,
154- bento : Tag | str | None = ...,
157+ bento : BentoType | None = ...,
155158 config_dict : dict [str , t .Any ] | None = ...,
156159) -> Deployment : ...
157160
@@ -162,7 +165,7 @@ def update(
162165 path_context : str | None = None ,
163166 cluster : str | None = None ,
164167 * ,
165- bento : Tag | str | None = None ,
168+ bento : BentoType | None = None ,
166169 access_authorization : bool | None = None ,
167170 scaling_min : int | None = None ,
168171 scaling_max : int | None = None ,
@@ -183,7 +186,7 @@ def update(
183186 config_params = DeploymentConfigParameters (
184187 name = name ,
185188 path_context = path_context ,
186- bento = bento ,
189+ bento = bento . tag if isinstance ( bento , Bento ) else bento ,
187190 cluster = cluster ,
188191 access_authorization = access_authorization ,
189192 scaling_max = scaling_max ,
@@ -241,15 +244,15 @@ def apply(
241244 cluster : str | None = None ,
242245 path_context : str | None = None ,
243246 * ,
244- bento : Tag | str | None = None ,
247+ bento : BentoType | None = None ,
245248 config_dict : dict [str , t .Any ] | None = None ,
246249 config_file : str | None = None ,
247250 _cloud_client : BentoCloudClient = Provide [BentoMLContainer .bentocloud_client ],
248251) -> Deployment :
249252 config_params = DeploymentConfigParameters (
250253 name = name ,
251254 path_context = path_context ,
252- bento = bento ,
255+ bento = bento . tag if isinstance ( bento , Bento ) else bento ,
253256 cluster = cluster ,
254257 config_dict = config_dict ,
255258 config_file = config_file ,
0 commit comments