Class DefaultSerializer (1.18.2)

DefaultSerializer()

Default serializer for serialization and deserialization for prediction.

Inheritance

builtins.object > abc.ABC > google.cloud.aiplatform.prediction.serializer.Serializer > DefaultSerializer

Methods

deserialize

deserialize(data: Any, content_type: Optional[str])

Deserializes the request data. Invoked before predict.

Parameters
NameDescription
data Any

Required. The request data sent to the application.

content_type str

Optional. The specified content type of the request.

Exceptions
TypeDescription
HTTPExceptionIf Json deserialization failed or the specified content type is not supported.

serialize

serialize(prediction: Any, accept: Optional[str])

Serializes the prediction results. Invoked after predict.

Parameters
NameDescription
prediction Any

Required. The generated prediction to be sent back to clients.

accept str

Optional. The specified content type of the response.

Exceptions
TypeDescription
HTTPExceptionIf Json serialization failed or the specified accept is not supported.