In Azure Machine Learning Service, when we deploy a Model as an AKS Webservice Endpoint, how can we raise exceptions to let the end-user get proper feedback if their API call is unsuccessful? Azure mentions using azureml.exceptions.WebserviceException
in their documentation. However, how do we use this class to raise exceptions in case the API call cannot be processed properly and the end-user is responsible for it?
To raise exceptions to let the end-user get proper feedback if their API call is unsuccessful, we use the azureml.contrib.services.aml_response.AMLResponse
Class.
Example of use in score.py
:
if [some-condition]:
return AMLResponse("bad request", 500)
Documentation Link can be found here.