@@ -120,7 +120,7 @@ def _select_target(bento: BentoInfo, targets: list[DeploymentTarget]) -> Deploym
120
120
return selected
121
121
122
122
123
- def _select_action (bento : BentoInfo , score : float ) -> None :
123
+ def _select_action (bento : BentoInfo , score : float , context : typing . Optional [ str ] = None ) -> None :
124
124
if score > 0 :
125
125
options : list [typing .Any ] = [
126
126
questionary .Separator ('Available actions' ),
@@ -180,17 +180,27 @@ def _select_action(bento: BentoInfo, score: float) -> None:
180
180
output (f' $ openllm serve { bento } ' , style = 'orange' )
181
181
elif action == 'deploy' :
182
182
ensure_cloud_context ()
183
- targets = get_cloud_machine_spec ()
183
+ targets = get_cloud_machine_spec (context = context )
184
184
target = _select_target (bento , targets )
185
185
try :
186
- cloud_deploy (bento , target )
186
+ cloud_deploy (bento , target , context = context )
187
187
finally :
188
188
output ('\n Use this command to run the action again:' , style = 'green' )
189
189
output (f' $ openllm deploy { bento } --instance-type { target .name } ' , style = 'orange' )
190
190
191
191
192
192
@app .command (help = 'get started interactively' )
193
- def hello (repo : typing .Optional [str ] = None ) -> None :
193
+ def hello (
194
+ repo : typing .Optional [str ] = None ,
195
+ env : typing .Optional [list [str ]] = typer .Option (
196
+ None ,
197
+ '--env' ,
198
+ help = 'Environment variables to pass to the deployment command. Format: NAME or NAME=value. Can be specified multiple times.' ,
199
+ ),
200
+ context : typing .Optional [str ] = typer .Option (
201
+ None , '--context' , help = 'BentoCloud context name to pass to the deployment command.'
202
+ ),
203
+ ) -> None :
194
204
cmd_update ()
195
205
INTERACTIVE .set (True )
196
206
@@ -211,7 +221,7 @@ def hello(repo: typing.Optional[str] = None) -> None:
211
221
212
222
bento_name , repo = _select_bento_name (models , target )
213
223
bento , score = _select_bento_version (models , target , bento_name , repo )
214
- _select_action (bento , score )
224
+ _select_action (bento , score , context = context )
215
225
216
226
217
227
@app .command (help = 'start an OpenAI API compatible chat server and chat in browser' )
@@ -278,15 +288,20 @@ def deploy(
278
288
'--env' ,
279
289
help = 'Environment variables to pass to the deployment command. Format: NAME or NAME=value. Can be specified multiple times.' ,
280
290
),
291
+ context : typing .Optional [str ] = typer .Option (
292
+ None , '--context' , help = 'BentoCloud context name to pass to the deployment command.'
293
+ ),
281
294
) -> None :
282
295
cmd_update ()
283
296
if verbose :
284
297
VERBOSE_LEVEL .set (20 )
285
298
bento = ensure_bento (model , repo_name = repo )
286
299
if instance_type is not None :
287
- return cloud_deploy (bento , DeploymentTarget (accelerators = [], name = instance_type ), cli_envs = env )
300
+ return cloud_deploy (
301
+ bento , DeploymentTarget (accelerators = [], name = instance_type ), cli_envs = env , context = context
302
+ )
288
303
targets = sorted (
289
- filter (lambda x : can_run (bento , x ) > 0 , get_cloud_machine_spec ()),
304
+ filter (lambda x : can_run (bento , x ) > 0 , get_cloud_machine_spec (context = context )),
290
305
key = lambda x : can_run (bento , x ),
291
306
reverse = True ,
292
307
)
@@ -295,7 +310,7 @@ def deploy(
295
310
raise typer .Exit (1 )
296
311
target = targets [0 ]
297
312
output (f'Recommended instance type: { target .name } ' , style = 'green' )
298
- cloud_deploy (bento , target , cli_envs = env )
313
+ cloud_deploy (bento , target , cli_envs = env , context = context )
299
314
300
315
301
316
@app .callback (invoke_without_command = True )
0 commit comments