Closed Andrew-Crosby closed 1 year ago
Thanks @Andrew-Crosby
Yes, I see. Do you think it would be best to raise the same PyFuncModelPredictError
or would something like PyFuncModelPredictionTypeError
be better? Either way, I think that this will probably continue to raise a 500 Internal Server Error
, as the model is returning data that does not comply with the specified signature (assuming that relevant data types are correctly mapped, see #10 and #11), and there's not much that the fastapi-mlflow
code can do to repair or recover.
This try/catch block should cover the full function body. The
Response
constructor can raise aValidationError
ifresponse_data
does not have the expected response type.https://github.com/autotraderuk/fastapi-mlflow/blob/98701a0f5af535ceedda78c07759f5a3b6b62b8e/fastapi_mlflow/predictors.py#L80-L87