BentoML SDK#
Service decorator#
Service API#
- bentoml.api(func: t.Callable[t.Concatenate[t.Any, P], R]) APIMethod[P, R] [source]#
- bentoml.api(*, route: str | None = None, name: str | None = None, input_spec: type[_bentoml_sdk.io_models.IODescriptor] | None = None, output_spec: type[_bentoml_sdk.io_models.IODescriptor] | None = None, batchable: bool = False, batch_dim: int | tuple[int, int] = 0, max_batch_size: int = 100, max_latency_ms: int = 60000) t.Callable[[t.Callable[t.Concatenate[t.Any, P], R]], APIMethod[P, R]]
Make a BentoML API method. This decorator can be used either with or without arguments.
- Parameters:
func β The function to be wrapped.
route β The route of the API. e.g. β/predictβ
name β The name of the API.
input_spec β The input spec of the API, should be a subclass of
pydantic.BaseModel
.output_spec β The output spec of the API, should be a subclass of
pydantic.BaseModel
.batchable β Whether the API is batchable.
batch_dim β The batch dimension of the API.
max_batch_size β The maximum batch size of the API.
max_latency_ms β The maximum latency of the API.
bentoml.depends#
bentoml.validators#
- class bentoml.validators.FileSchema(format: str = 'binary', content_type: str | None = None)[source]#
Bases:
object
- class bentoml.validators.TensorSchema(format: TensorFormat, dtype: t.Optional[str] = None, shape: t.Optional[t.Tuple[int, ...]] = None)[source]#
Bases:
object
- format: TensorFormat#
- class bentoml.validators.DataframeSchema(orient: str = 'records', columns: list[str] | None = None)[source]#
Bases:
object