Class PredictionHandler (1.18.3)

PredictionHandler(
    artifacts_uri: str,
    predictor: Optional[
        Type[google.cloud.aiplatform.prediction.predictor.Predictor]
    ] = None,
)

Default prediction handler for the prediction requests sent to the application.

Inheritance

builtins.object > abc.ABC > google.cloud.aiplatform.prediction.handler.Handler > PredictionHandler

Methods

PredictionHandler

PredictionHandler(
    artifacts_uri: str,
    predictor: Optional[
        Type[google.cloud.aiplatform.prediction.predictor.Predictor]
    ] = None,
)

Initializes a Handler instance.

Parameters
NameDescription
artifacts_uri str

Required. The value of the environment variable AIP_STORAGE_URI.

predictor Type[Predictor]

Optional. The Predictor class this handler uses to initiate predictor instance if given.

Exceptions
TypeDescription
ValueErrorIf predictor is None.

handle

handle(request: starlette.requests.Request)

Handles a prediction request.

Parameter
NameDescription
request Request

Required. The prediction request sent to the application.

Exceptions
TypeDescription
HTTPExceptionIf any exception is thrown from predictor object.