@@ -373,6 +373,38 @@ def post(self, *args, **kwargs): # noqa: ARG002
373373 )
374374
375375
376+ class AquaModelListHandler (AquaAPIhandler ):
377+ """Handler for Aqua model list params REST APIs.
378+
379+ Methods
380+ -------
381+ get(self, *args, **kwargs)
382+ Validates parameters for the given model id.
383+ """
384+
385+ @handle_exceptions
386+ def get (self , model_deployment_id ):
387+ """
388+ Handles streaming inference request for the Active Model Deployments
389+ Raises
390+ ------
391+ HTTPError
392+ Raises HTTPError if inputs are missing or are invalid
393+ """
394+
395+ self .set_header ("Content-Type" , "application/json" )
396+
397+ model_deployment = AquaDeploymentApp ().get (model_deployment_id )
398+ endpoint = model_deployment .endpoint + "/predict/v1/models"
399+
400+ aqua_client = Client (endpoint = endpoint )
401+ try :
402+ list_model_result = aqua_client .list_models ()
403+ return self .finish (list_model_result )
404+ except Exception as ex :
405+ raise HTTPError (500 , str (ex ))
406+
407+
376408__handlers__ = [
377409 ("deployments/?([^/]*)/params" , AquaDeploymentParamsHandler ),
378410 ("deployments/config/?([^/]*)" , AquaDeploymentHandler ),
@@ -381,4 +413,5 @@ def post(self, *args, **kwargs): # noqa: ARG002
381413 ("deployments/?([^/]*)/activate" , AquaDeploymentHandler ),
382414 ("deployments/?([^/]*)/deactivate" , AquaDeploymentHandler ),
383415 ("inference/stream/?([^/]*)" , AquaDeploymentStreamingInferenceHandler ),
416+ ("deployments/models/list/?([^/]*)" , AquaModelListHandler ),
384417]
0 commit comments