bentoml / BentoML

The easiest way to serve AI/ML models in production - Build Model Inference Service, LLM APIs, Multi-model Inference Graph/Pipelines, LLM/RAG apps, and more!

Home Page:https://bentoml.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

minor bug: Swagger docs.json not correctly specified for list[PydanticModel] Output

SvenLorenzTransfermedia opened this issue · comments

Describe the bug

I was running batchable services and ran into the issue of having several (incompatible for numpy arrays) model outputs, so I wrapped them in a pydantic model and that in a list, this works, but the swagger documentation gives me an error:

Errors

 
Resolver error at paths./test.post.responses.200.content.application/json.schema.items.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/Output does not exist in document

To reproduce

Code to reproduce docs:
test.py

import bentoml
from PIL.Image import Image
from pydantic import BaseModel


class Output(BaseModel):
    test1: int
    test2: int


@bentoml.service()
class Model:

    def __init__(self) -> None:
        pass

    @bentoml.api(
        batchable=True,
        batch_dim=(0, 0),
        route="/test",
    )
    async def __call__(self, images: list[Image]) -> list[Output]:
        return [Output(test1=out[0], test2=out[1]) for out in [[1, 2]] * len(images)]
bentoml serve test:Model --port 3015

Expected behavior

No response

Environment

Environment variable

BENTOML_DEBUG=''
BENTOML_QUIET=''
BENTOML_BUNDLE_LOCAL_BUILD=''
BENTOML_DO_NOT_TRACK=''
BENTOML_CONFIG=''
BENTOML_CONFIG_OPTIONS=''
BENTOML_PORT=''
BENTOML_HOST=''
BENTOML_API_WORKERS=''

System information

bentoml: 1.2.14
python: 3.10.12
platform: Linux-6.5.0-25-generic-x86_64-with-glibc2.35
uid_gid: 1000:1000

pip_packages
aiohttp==3.9.5
aiosignal==1.3.1
annotated-types==0.6.0
anyio==4.3.0
appdirs==1.4.4
asgiref==3.8.1
async-timeout==4.0.3
attrs==23.2.0
bentoml==1.2.14
build==1.2.1
cattrs==23.1.2
certifi==2024.2.2
circus==0.18.0
click==8.1.7
click-option-group==0.5.6
cloudpickle==3.0.0
deepmerge==1.1.1
Deprecated==1.2.14
exceptiongroup==1.2.1
frozenlist==1.4.1
fs==2.4.16
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
idna==3.7
importlib-metadata==6.11.0
inflection==0.5.1
Jinja2==3.1.4
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
multidict==6.0.5
numpy==1.26.4
nvidia-ml-py==11.525.150
opentelemetry-api==1.20.0
opentelemetry-instrumentation==0.41b0
opentelemetry-instrumentation-aiohttp-client==0.41b0
opentelemetry-instrumentation-asgi==0.41b0
opentelemetry-sdk==1.20.0
opentelemetry-semantic-conventions==0.41b0
opentelemetry-util-http==0.41b0
packaging==24.0
pathspec==0.12.1
pillow==10.3.0
pip-requirements-parser==32.0.1
pip-tools==7.4.1
prometheus_client==0.20.0
psutil==5.9.8
pydantic==2.7.1
pydantic_core==2.18.2
Pygments==2.18.0
pyparsing==3.1.2
pyproject_hooks==1.1.0
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
python-multipart==0.0.9
PyYAML==6.0.1
pyzmq==26.0.3
rich==13.7.1
schema==0.7.7
simple-di==0.1.5
six==1.16.0
sniffio==1.3.1
starlette==0.37.2
tomli==2.0.1
tomli_w==1.0.0
tornado==6.4
typing_extensions==4.11.0
uvicorn==0.29.0
watchfiles==0.21.0
wrapt==1.16.0
yarl==1.9.4
zipp==3.18.1