Erik Hyrkas
01/23/2025, 3:30 PM["ABC", "DEF"]
Rather than an object:
{
"item_arr": [
"ABC",
"DEF"
]
}
I'm upgrading from BentoML 1.2.x where the old syntax supported a list of inputs by specifying a JSON() input in the decorator:
@svc.api(input=JSON(), output=JSON(pydantic_model=ResponseV1), route="/predict")
However, as I try to use the new syntax with a class, I'm unsure of what the input_spec should be.
@bentoml.api(route="/2.0/predict", input_spec=???)
def predict(self, input_arr: List[str]):
The only examples I see of lists as inputs are using a numpy ndarray, which I don't need here.
I needed to upgrade versions partially because I needed to enforce the process count -- which didn't seem to be something I could do with the older version of bentoml:
@bentoml.service(
resources={"cpu": "1"}
)
Maybe I overlooked the mechanism?Jian Shen Yap
02/03/2025, 3:14 PMErik Hyrkas
02/03/2025, 3:29 PM["ABC", "DEF"]
Those examples would only work for:
{
"item_arr": [
"ABC",
"DEF"
]
}
For the moment, I've worked around the issue, but it appears to be a limitation that I'll need to work with in the future if we are going to upgrade.Jian Shen Yap
02/03/2025, 3:49 PMFrost Ming
02/04/2025, 2:31 AMErik Hyrkas
02/04/2025, 2:40 PMJSON() and not specifying whether it is an array, object, or whatever.)Erik Hyrkas
02/04/2025, 2:41 PMErik Hyrkas
02/04/2025, 2:41 PMFrost Ming
02/05/2025, 12:33 AMErik Hyrkas
02/05/2025, 3:09 PM