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!
https://bentoml.com
Apache License 2.0
6.8k stars 765 forks source link

feature: make it easier to override / set fields in the openapi docs #2975

Open creativedutchmen opened 1 year ago

creativedutchmen commented 1 year ago

Feature request

I would like if I could set details that are relevant to our organisation in the openapi docs for my models (contact information, summary, git link) without having to wrap the bento in another API.

Motivation

When consumers of my API visit the docs for my deployed models, they don't care that I used BentoML to deploy the model - they want to know what the model does, how to use it and who to contact if they run into issues.

Some of the fields in the docs can be overwritten, but the GitHub link on the top right, the summary (A ML Service created with BentoML) and contact Contact(name="BentoML Team", email="contact@bentoml.ai") are hardcoded without an easy way to set them myself.

The only way to change this behaviour now is to override the openapi_spec property and set those fields manually - which is fragile and cumbersome. It would be great if we could take these values from the bentofile instead.

Other

No response

aarnphm commented 1 year ago

I think it is a great idea for user to override these fields. However, I'm a bit more hesistant for putting this into bentofile.yaml

FastAPI does allow user to extend OpenAPI, but I think if we want to design this feature we would probably will provide a Python API for this. What do you think?

creativedutchmen commented 1 year ago

We already allow some of it to be overwritten in the bentofile though, by setting description for instance, so having it in one place makes sense to me.

But yeah, if the goal is to allow much more customisation, then python is the way to go. (I would love to be able to replace the BentoML docs with a version that doesn't include google tag manager, for instance)

aarnphm commented 1 year ago

I believe this would be also a great features for community contribution. I would love to help you with desigining this if you are interested in contributing. We also have #2900 that also touches a bit of OpenAPI.

Would love to chat more on slack. But also feel free to discuss here as well 😃