@@ -4298,25 +4298,32 @@ def generate_deployment_recommendations(
42984298 return job
42994299
43004300 @property
4301- def recommendations (self ) -> List :
4301+ def recommendations (self ):
43024302 """Recommendation rows from the most recent ``generate_deployment_recommendations`` call.
43034303
4304- Returns an empty list if no recommendation job has been run, or if
4305- the job has not produced recommendations yet (e.g., still
4306- ``InProgress``). Each row is a read-only view that pretty-prints when
4307- ``repr()``'d; field access forwards to the underlying service shape
4308- (e.g., ``rec.deployment_configuration.instance_type``). Deploy via
4309- ``self.deploy(recommendation_index=N)``.
4304+ Returns a list-like view; ``repr()`` renders a comparative table across
4305+ rows, and ``.best`` is a shortcut for the top-ranked row. Each row
4306+ forwards attribute access to the underlying service shape (e.g.,
4307+ ``rec.deployment_configuration.instance_type``).
4308+
4309+ Deploy via ``self.deploy(recommendation_index=N)`` or
4310+ ``self.deploy(recommendation_spec_name="...")``.
4311+
4312+ Empty if no recommendation job has been run, or if the job has not
4313+ produced recommendations yet.
43104314 """
43114315 from sagemaker .serve .ai_inference_recommender ._recommendation_view import (
43124316 _RecommendationView ,
4317+ _RecommendationsView ,
43134318 )
43144319
43154320 job = getattr (self , "_recommendation_job" , None )
43164321 if job is None :
4317- return []
4322+ return _RecommendationsView ()
43184323 rows = list (job .recommendations or [])
4319- return [_RecommendationView (row , index = i ) for i , row in enumerate (rows )]
4324+ return _RecommendationsView (
4325+ _RecommendationView (row , index = i ) for i , row in enumerate (rows )
4326+ )
43204327
43214328 @classmethod
43224329 def from_recommendation_job (
@@ -4331,7 +4338,7 @@ def from_recommendation_job(
43314338 process didn't run (e.g. a job kicked off in a notebook last week,
43324339 or owned by a teammate). After construction, call
43334340 :meth:`deploy` with ``recommendation_index=`` or
4334- ``inference_spec_name =`` as you would after ``generate_deployment_recommendations``.
4341+ ``recommendation_spec_name =`` as you would after ``generate_deployment_recommendations``.
43354342
43364343 Args:
43374344 recommendation_job: Either the name of an existing
@@ -4364,7 +4371,7 @@ def _deploy_recommendation(
43644371 self ,
43654372 * ,
43664373 recommendation_index : int ,
4367- inference_spec_name : Optional [str ],
4374+ recommendation_spec_name : Optional [str ],
43684375 endpoint_name : Optional [str ],
43694376 model_name : Optional [str ],
43704377 endpoint_config_name : Optional [str ],
@@ -4381,7 +4388,7 @@ def _deploy_recommendation(
43814388 We approve the package (rec jobs publish it un-approved) and create
43824389 Model + EndpointConfig + Endpoint from it.
43834390
4384- Row selection: ``inference_spec_name `` wins over
4391+ Row selection: ``recommendation_spec_name `` wins over
43854392 ``recommendation_index`` when both are given.
43864393 """
43874394 import time as _time
@@ -4412,11 +4419,11 @@ def _deploy_recommendation(
44124419 f"{ 'Job failed: ' + str (failure_reason ) if status == 'Failed' else 'Call job.wait() before deploy.' } "
44134420 )
44144421
4415- if inference_spec_name is not None :
4422+ if recommendation_spec_name is not None :
44164423 matches = [
44174424 row for row in rows
44184425 if getattr (getattr (row , "model_details" , None ), "inference_specification_name" , None )
4419- == inference_spec_name
4426+ == recommendation_spec_name
44204427 ]
44214428 if not matches :
44224429 available = sorted ({
@@ -4427,8 +4434,8 @@ def _deploy_recommendation(
44274434 if name
44284435 })
44294436 raise ValueError (
4430- f"No recommendation row matches inference_spec_name ="
4431- f"{ inference_spec_name !r} . "
4437+ f"No recommendation row matches recommendation_spec_name ="
4438+ f"{ recommendation_spec_name !r} . "
44324439 f"Available: { available or '(none reported)' } ."
44334440 )
44344441 rec = matches [0 ]
@@ -4536,7 +4543,7 @@ def deploy(
45364543 # was called previously, or when this builder was hydrated via
45374544 # ModelBuilder.from_recommendation_job(...)).
45384545 recommendation_index : int = 0 ,
4539- inference_spec_name : Optional [str ] = None ,
4546+ recommendation_spec_name : Optional [str ] = None ,
45404547 role : Optional [str ] = None ,
45414548 model_name : Optional [str ] = None ,
45424549 endpoint_config_name : Optional [str ] = None ,
@@ -4601,7 +4608,7 @@ def deploy(
46014608 if getattr (self , "_recommendation_job" , None ) is not None :
46024609 return self ._deploy_recommendation (
46034610 recommendation_index = recommendation_index ,
4604- inference_spec_name = inference_spec_name ,
4611+ recommendation_spec_name = recommendation_spec_name ,
46054612 endpoint_name = endpoint_name ,
46064613 model_name = model_name ,
46074614 endpoint_config_name = endpoint_config_name ,
0 commit comments