
                  
          d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddl
mZ d	Zd
ZdZdZdZdZdZde e de e de e d
Zde e dZde e dZde e de e de e d
Z e	j0                  e	j2                  j4                  e	j2                  j6                  e	j2                  j8                        e	j:                   G d de	j<                                      Zy)zQThe command lists the models in Model Garden and their supported functionalities.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_utilzformat("{0:s}@{1:s}/{2:s}", name, versionId, name.regex("publishers/hf-.*", "@hf", "@mg")).sub("publishers/hf-", "").sub("publishers/", "").sub("models/", "").sub("@001/@hf", ""). sub("/@mg", ""):sort=1z-format("{0:s}@{1:s}", name, versionId):sort=1z:label=MODEL_IDz1supportedActions.multiDeployVertex.yesno(yes=Yes)z:label=CAN_DEPLOYz%publisherModelTemplate.yesno(yes=Yes)z:label=CAN_PREDICTztable(z, )c                   &    e Zd ZdZed        Zd Zy)Lista  List the publisher models in Model Garden.

  This command lists either all models in Model Garden or all Hugging
  Face models supported by Model Garden.

  Note: Since the number of Hugging Face models is large, the default limit is
  set to 500 with a page size of 100 when listing supported Hugging Face models.
  To override the limit or page size, specify the --limit or --page-size flags,
  respectively. To list all models in Model Garden, use `--limit=unlimited`.
  c                 D   | j                   j                  t               | j                  ddddd       | j                  ddd dd       | j                  d	dddd
       t        j
                  j                  |        t        j                  j                  | d       y )Nz --can-deploy-hugging-face-models
store_trueFz>Whether to only list Hugging Face models that can be deployed.)actiondefaultrequiredhelpz--model-filterstorezNFilter to apply to the model names or the display names of the list of models.z--full-resource-namez6Whether to return the full resource name of the model.i  )	display_info	AddFormat_DEFAULT_TABLE_FORMATadd_argumentr   URI_FLAGRemoveFromParser
LIMIT_FLAG
SetDefault)parsers    *lib/surface/ai/model_garden/models/list.pyArgsz	List.ArgsL   s    
!!"78
*M     	 E   	MM""6*OOvt,    c                 &   t         j                  }|j                  r#|j                         j	                  t
               |j                  rH|j                         j	                  |j                  rt        nt               |j                  d|_	        t        j                  |d      5  t        j                  |      }|j                  |j                  |j                  |j                  |j                         cd d d        S # 1 sw Y   y xY w)Nd   zus-central1)region)limit
batch_sizelist_hf_modelsmodel_filter)r   BETA_VERSIONfull_resource_nameGetDisplayInfor    _FULL_RESOURCE_NAME_TABLE_FORMATcan_deploy_hugging_face_models%_FULL_RESOURCE_NAME_ONLY_TABLE_FORMAT#_SHORT_MODEL_NAME_ONLY_TABLE_FORMAT	page_sizer	   AiplatformEndpointOverrides	client_mgModelGardenClientListPublisherModelsr#   r&   )selfargsversion	mg_clients       r   RunzList.Runj   s    $$G
%%&FG
 **
%%$$ 02
 
			2	2
 --g6i**

^^<<((	 + 	
 
 
s   +ADDN)__name__
__module____qualname____doc__staticmethodr   r7    r   r   r   r   <   s     
	 - -:r   r   N) r;   
__future__r   r   r   &googlecloudsdk.api_lib.ai.model_gardenr   r0   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   _SHORT_NAME_FORMAT_FULL_RESOURCE_NAME_FORMAT_MODEL_ID_LABEL_CAN_DEPLOY_FILTER_CAN_DEPLOY_LABEL_CAN_PREDICT_FILTER_CAN_PREDICT_LABELr   r-   r,   r*   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyListCommandr   r=   r   r   <module>rP      sn   X '  ' F ( 3 7  M #H ' = )    1 2-. //03    13 $ '((9; & '((9 :-. //03 ! T..33T5F5F5I5I E4 E Er   