@@ -120,7 +120,7 @@ def _select_target(bento: BentoInfo, targets: list[DeploymentTarget]) -> Deploym
120120 return selected
121121
122122
123- def _select_action (bento : BentoInfo , score : float ) -> None :
123+ def _select_action (bento : BentoInfo , score : float , context : typing . Optional [ str ] = None ) -> None :
124124 if score > 0 :
125125 options : list [typing .Any ] = [
126126 questionary .Separator ('Available actions' ),
@@ -180,17 +180,27 @@ def _select_action(bento: BentoInfo, score: float) -> None:
180180 output (f' $ openllm serve { bento } ' , style = 'orange' )
181181 elif action == 'deploy' :
182182 ensure_cloud_context ()
183- targets = get_cloud_machine_spec ()
183+ targets = get_cloud_machine_spec (context = context )
184184 target = _select_target (bento , targets )
185185 try :
186- cloud_deploy (bento , target )
186+ cloud_deploy (bento , target , context = context )
187187 finally :
188188 output ('\n Use this command to run the action again:' , style = 'green' )
189189 output (f' $ openllm deploy { bento } --instance-type { target .name } ' , style = 'orange' )
190190
191191
192192@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 :
194204 cmd_update ()
195205 INTERACTIVE .set (True )
196206
@@ -211,7 +221,7 @@ def hello(repo: typing.Optional[str] = None) -> None:
211221
212222 bento_name , repo = _select_bento_name (models , target )
213223 bento , score = _select_bento_version (models , target , bento_name , repo )
214- _select_action (bento , score )
224+ _select_action (bento , score , context = context )
215225
216226
217227@app .command (help = 'start an OpenAI API compatible chat server and chat in browser' )
@@ -278,15 +288,20 @@ def deploy(
278288 '--env' ,
279289 help = 'Environment variables to pass to the deployment command. Format: NAME or NAME=value. Can be specified multiple times.' ,
280290 ),
291+ context : typing .Optional [str ] = typer .Option (
292+ None , '--context' , help = 'BentoCloud context name to pass to the deployment command.'
293+ ),
281294) -> None :
282295 cmd_update ()
283296 if verbose :
284297 VERBOSE_LEVEL .set (20 )
285298 bento = ensure_bento (model , repo_name = repo )
286299 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+ )
288303 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 )),
290305 key = lambda x : can_run (bento , x ),
291306 reverse = True ,
292307 )
@@ -295,7 +310,7 @@ def deploy(
295310 raise typer .Exit (1 )
296311 target = targets [0 ]
297312 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 )
299314
300315
301316@app .callback (invoke_without_command = True )
0 commit comments