Hi I’m building a bento service which looks someth...
# ask-for-help
a
Hi I’m building a bento service which looks something like:
Copy code
import bentoml
from models import InputModel, OutputModel

model_name = "dummy-model"
bento_name = "dummy-bento"

reg_runner = bentoml.sklearn.get(model_name).to_runner()
svc = bentoml.Service(bento_name, runners=[reg_runner])


@svc.api(
    input=bentoml.io.JSON(pydantic_model=InputModel),
    output=bentoml.io.JSON(pydantic_model=OutputModel),
)
def classify(data: InputModel) -> OutputModel:
    """this goes into classify description field"""
    # predict...
    dummy_res = OutputModel(...)
    return dummy_res
I have few requirements for the generated openAPI doc, and I’m not sure if its possible / how im suppose to modify the
service.py
file to fulfill those requirements: 1. I need the
classify
path (endpoint) in the generated openAPI doc to have
summary
and
operationId
fields for every endpoint. how can I do that? 2. Regarding the
summary
field from bullet 1, it seem to be automatically generated to
summary: InferenceAPI(JSON → JSON)
. can I modify it? 3. I need that the
schema
for
InputModel
and
OutputModel
to have the entry
examples
in the generated openAPI doc. 4. There are
InvalidArgument
,
NotFound
and
InternalServerError
errors under the
schema
field. is it possible to modify these? I need to make sure the returned “bad” responses have 2 fields only -
statusCode
and
message
- not sure how I can control that. Thanks in advance