Anyone knows how to utilize <bentoml.io> types ins...
# ask-for-help
t
Anyone knows how to utilize bentoml.io types inside a pydantic model? I'd like to do something like thi
Copy code
class AnomalyOutput(BaseModel):
    anomaly_scored: NumpyNdarray(dtype="float") # Doesnt work
    marginal_anomaly_score: np.ndarray  # Works but doesnt hint to type float/int
    ...
service = bentoml.Service(...)
@service.api(input=..., output=JSON(pydantic_model=AnomalyOutput))
Documentation doesn't show how to combine pydantic models with bento io like this.
m
@svc.api( input=JSON(pydantic_model=PayloadModel), output=JSON(pydantic_model=ResponseModel) ) I use something like this.
t
Yeah, that's also what I use - see the code sample i added. But inside my model, I'd like to type the np arrays (int, float32/64, bool, etc). Do you know how to do that? (see code example for what I have tried)