From 0abae7899bac748d295e8c86db6f47a4a026643a Mon Sep 17 00:00:00 2001 From: Rakavitha Kodhandapani Date: Tue, 16 Sep 2025 12:35:14 +0530 Subject: [PATCH 1/2] added the scripts and the complete output --- docs-gb/api/SUMMARY.md | 97 + docs-gb/api/index.md | 2 + docs-gb/api/mlserver.md | 2 + docs-gb/api/mlserver/batching.md | 2 + docs-gb/api/mlserver/batching/adaptive.md | 17 + docs-gb/api/mlserver/batching/hooks.md | 37 + docs-gb/api/mlserver/batching/requests.md | 17 + docs-gb/api/mlserver/batching/shape.md | 26 + docs-gb/api/mlserver/cache.md | 2 + docs-gb/api/mlserver/cache/cache.md | 38 + docs-gb/api/mlserver/cache/local.md | 2 + docs-gb/api/mlserver/cache/local/local.md | 38 + docs-gb/api/mlserver/cloudevents.md | 75 + docs-gb/api/mlserver/codecs.md | 2 + docs-gb/api/mlserver/codecs/base.md | 53 + docs-gb/api/mlserver/codecs/base64.md | 8 + docs-gb/api/mlserver/codecs/datetime.md | 8 + docs-gb/api/mlserver/codecs/decorator.md | 35 + docs-gb/api/mlserver/codecs/errors.md | 26 + docs-gb/api/mlserver/codecs/json.md | 119 + docs-gb/api/mlserver/codecs/lists.md | 22 + docs-gb/api/mlserver/codecs/numpy.md | 43 + docs-gb/api/mlserver/codecs/pandas.md | 9 + docs-gb/api/mlserver/codecs/string.md | 35 + docs-gb/api/mlserver/codecs/utils.md | 83 + docs-gb/api/mlserver/context.md | 11 + docs-gb/api/mlserver/env.md | 28 + docs-gb/api/mlserver/errors.md | 38 + docs-gb/api/mlserver/grpc.md | 2 + docs-gb/api/mlserver/grpc/converters.md | 80 + docs-gb/api/mlserver/grpc/dataplane_pb2.md | 2 + .../api/mlserver/grpc/dataplane_pb2_grpc.md | 209 ++ docs-gb/api/mlserver/grpc/interceptors.md | 79 + docs-gb/api/mlserver/grpc/logging.md | 2 + docs-gb/api/mlserver/grpc/model_repository.md | 35 + .../api/mlserver/grpc/model_repository_pb2.md | 2 + .../grpc/model_repository_pb2_grpc.md | 83 + docs-gb/api/mlserver/grpc/server.md | 26 + docs-gb/api/mlserver/grpc/servicers.md | 98 + docs-gb/api/mlserver/grpc/utils.md | 38 + docs-gb/api/mlserver/handlers.md | 2 + docs-gb/api/mlserver/handlers/custom.md | 206 ++ docs-gb/api/mlserver/handlers/dataplane.md | 72 + .../api/mlserver/handlers/model_repository.md | 35 + docs-gb/api/mlserver/kafka.md | 2 + docs-gb/api/mlserver/kafka/errors.md | 8 + docs-gb/api/mlserver/kafka/handlers.md | 17 + docs-gb/api/mlserver/kafka/logging.md | 2 + docs-gb/api/mlserver/kafka/message.md | 179 ++ docs-gb/api/mlserver/kafka/server.md | 84 + docs-gb/api/mlserver/logging.md | 115 + docs-gb/api/mlserver/metrics.md | 2 + docs-gb/api/mlserver/metrics/context.md | 25 + docs-gb/api/mlserver/metrics/errors.md | 14 + docs-gb/api/mlserver/metrics/logging.md | 2 + docs-gb/api/mlserver/metrics/prometheus.md | 35 + docs-gb/api/mlserver/metrics/registry.md | 97 + docs-gb/api/mlserver/metrics/server.md | 35 + docs-gb/api/mlserver/middleware.md | 50 + docs-gb/api/mlserver/model.md | 123 + docs-gb/api/mlserver/parallel.md | 2 + docs-gb/api/mlserver/parallel/dispatcher.md | 118 + docs-gb/api/mlserver/parallel/errors.md | 24 + docs-gb/api/mlserver/parallel/logging.md | 2 + docs-gb/api/mlserver/parallel/messages.md | 716 ++++++ docs-gb/api/mlserver/parallel/model.md | 163 ++ docs-gb/api/mlserver/parallel/pool.md | 93 + docs-gb/api/mlserver/parallel/registry.md | 54 + docs-gb/api/mlserver/parallel/utils.md | 29 + docs-gb/api/mlserver/parallel/worker.md | 113 + docs-gb/api/mlserver/raw.md | 38 + docs-gb/api/mlserver/registry.md | 122 + docs-gb/api/mlserver/repository.md | 2 + docs-gb/api/mlserver/repository/factory.md | 17 + docs-gb/api/mlserver/repository/load.md | 11 + docs-gb/api/mlserver/repository/repository.md | 51 + docs-gb/api/mlserver/rest.md | 2 + docs-gb/api/mlserver/rest/app.md | 53 + docs-gb/api/mlserver/rest/endpoints.md | 142 ++ docs-gb/api/mlserver/rest/errors.md | 188 ++ docs-gb/api/mlserver/rest/logging.md | 30 + docs-gb/api/mlserver/rest/openapi.md | 2 + docs-gb/api/mlserver/rest/openapi/schema.md | 11 + docs-gb/api/mlserver/rest/requests.md | 117 + docs-gb/api/mlserver/rest/responses.md | 61 + docs-gb/api/mlserver/rest/server.md | 44 + docs-gb/api/mlserver/rest/utils.md | 29 + docs-gb/api/mlserver/server.md | 53 + docs-gb/api/mlserver/settings.md | 954 ++++++++ docs-gb/api/mlserver/tracing.md | 11 + docs-gb/api/mlserver/types.md | 2 + docs-gb/api/mlserver/types/base.md | 157 ++ docs-gb/api/mlserver/types/dataplane.md | 2062 +++++++++++++++++ .../api/mlserver/types/model_repository.md | 822 +++++++ docs-gb/api/mlserver/utils.md | 74 + docs-gb/api/mlserver/version.md | 2 + generate_api_docs.py | 104 + 97 files changed, 9111 insertions(+) create mode 100644 docs-gb/api/SUMMARY.md create mode 100644 docs-gb/api/index.md create mode 100644 docs-gb/api/mlserver.md create mode 100644 docs-gb/api/mlserver/batching.md create mode 100644 docs-gb/api/mlserver/batching/adaptive.md create mode 100644 docs-gb/api/mlserver/batching/hooks.md create mode 100644 docs-gb/api/mlserver/batching/requests.md create mode 100644 docs-gb/api/mlserver/batching/shape.md create mode 100644 docs-gb/api/mlserver/cache.md create mode 100644 docs-gb/api/mlserver/cache/cache.md create mode 100644 docs-gb/api/mlserver/cache/local.md create mode 100644 docs-gb/api/mlserver/cache/local/local.md create mode 100644 docs-gb/api/mlserver/cloudevents.md create mode 100644 docs-gb/api/mlserver/codecs.md create mode 100644 docs-gb/api/mlserver/codecs/base.md create mode 100644 docs-gb/api/mlserver/codecs/base64.md create mode 100644 docs-gb/api/mlserver/codecs/datetime.md create mode 100644 docs-gb/api/mlserver/codecs/decorator.md create mode 100644 docs-gb/api/mlserver/codecs/errors.md create mode 100644 docs-gb/api/mlserver/codecs/json.md create mode 100644 docs-gb/api/mlserver/codecs/lists.md create mode 100644 docs-gb/api/mlserver/codecs/numpy.md create mode 100644 docs-gb/api/mlserver/codecs/pandas.md create mode 100644 docs-gb/api/mlserver/codecs/string.md create mode 100644 docs-gb/api/mlserver/codecs/utils.md create mode 100644 docs-gb/api/mlserver/context.md create mode 100644 docs-gb/api/mlserver/env.md create mode 100644 docs-gb/api/mlserver/errors.md create mode 100644 docs-gb/api/mlserver/grpc.md create mode 100644 docs-gb/api/mlserver/grpc/converters.md create mode 100644 docs-gb/api/mlserver/grpc/dataplane_pb2.md create mode 100644 docs-gb/api/mlserver/grpc/dataplane_pb2_grpc.md create mode 100644 docs-gb/api/mlserver/grpc/interceptors.md create mode 100644 docs-gb/api/mlserver/grpc/logging.md create mode 100644 docs-gb/api/mlserver/grpc/model_repository.md create mode 100644 docs-gb/api/mlserver/grpc/model_repository_pb2.md create mode 100644 docs-gb/api/mlserver/grpc/model_repository_pb2_grpc.md create mode 100644 docs-gb/api/mlserver/grpc/server.md create mode 100644 docs-gb/api/mlserver/grpc/servicers.md create mode 100644 docs-gb/api/mlserver/grpc/utils.md create mode 100644 docs-gb/api/mlserver/handlers.md create mode 100644 docs-gb/api/mlserver/handlers/custom.md create mode 100644 docs-gb/api/mlserver/handlers/dataplane.md create mode 100644 docs-gb/api/mlserver/handlers/model_repository.md create mode 100644 docs-gb/api/mlserver/kafka.md create mode 100644 docs-gb/api/mlserver/kafka/errors.md create mode 100644 docs-gb/api/mlserver/kafka/handlers.md create mode 100644 docs-gb/api/mlserver/kafka/logging.md create mode 100644 docs-gb/api/mlserver/kafka/message.md create mode 100644 docs-gb/api/mlserver/kafka/server.md create mode 100644 docs-gb/api/mlserver/logging.md create mode 100644 docs-gb/api/mlserver/metrics.md create mode 100644 docs-gb/api/mlserver/metrics/context.md create mode 100644 docs-gb/api/mlserver/metrics/errors.md create mode 100644 docs-gb/api/mlserver/metrics/logging.md create mode 100644 docs-gb/api/mlserver/metrics/prometheus.md create mode 100644 docs-gb/api/mlserver/metrics/registry.md create mode 100644 docs-gb/api/mlserver/metrics/server.md create mode 100644 docs-gb/api/mlserver/middleware.md create mode 100644 docs-gb/api/mlserver/model.md create mode 100644 docs-gb/api/mlserver/parallel.md create mode 100644 docs-gb/api/mlserver/parallel/dispatcher.md create mode 100644 docs-gb/api/mlserver/parallel/errors.md create mode 100644 docs-gb/api/mlserver/parallel/logging.md create mode 100644 docs-gb/api/mlserver/parallel/messages.md create mode 100644 docs-gb/api/mlserver/parallel/model.md create mode 100644 docs-gb/api/mlserver/parallel/pool.md create mode 100644 docs-gb/api/mlserver/parallel/registry.md create mode 100644 docs-gb/api/mlserver/parallel/utils.md create mode 100644 docs-gb/api/mlserver/parallel/worker.md create mode 100644 docs-gb/api/mlserver/raw.md create mode 100644 docs-gb/api/mlserver/registry.md create mode 100644 docs-gb/api/mlserver/repository.md create mode 100644 docs-gb/api/mlserver/repository/factory.md create mode 100644 docs-gb/api/mlserver/repository/load.md create mode 100644 docs-gb/api/mlserver/repository/repository.md create mode 100644 docs-gb/api/mlserver/rest.md create mode 100644 docs-gb/api/mlserver/rest/app.md create mode 100644 docs-gb/api/mlserver/rest/endpoints.md create mode 100644 docs-gb/api/mlserver/rest/errors.md create mode 100644 docs-gb/api/mlserver/rest/logging.md create mode 100644 docs-gb/api/mlserver/rest/openapi.md create mode 100644 docs-gb/api/mlserver/rest/openapi/schema.md create mode 100644 docs-gb/api/mlserver/rest/requests.md create mode 100644 docs-gb/api/mlserver/rest/responses.md create mode 100644 docs-gb/api/mlserver/rest/server.md create mode 100644 docs-gb/api/mlserver/rest/utils.md create mode 100644 docs-gb/api/mlserver/server.md create mode 100644 docs-gb/api/mlserver/settings.md create mode 100644 docs-gb/api/mlserver/tracing.md create mode 100644 docs-gb/api/mlserver/types.md create mode 100644 docs-gb/api/mlserver/types/base.md create mode 100644 docs-gb/api/mlserver/types/dataplane.md create mode 100644 docs-gb/api/mlserver/types/model_repository.md create mode 100644 docs-gb/api/mlserver/utils.md create mode 100644 docs-gb/api/mlserver/version.md create mode 100644 generate_api_docs.py diff --git a/docs-gb/api/SUMMARY.md b/docs-gb/api/SUMMARY.md new file mode 100644 index 000000000..a70076bab --- /dev/null +++ b/docs-gb/api/SUMMARY.md @@ -0,0 +1,97 @@ +# Summary +* [Home](README.md) +* [API Reference](api/index.md) + * [mlserver](api/mlserver.md) + * [mlserver.batching](api/mlserver/batching.md) + * [mlserver.batching.adaptive](api/mlserver/batching/adaptive.md) + * [mlserver.batching.hooks](api/mlserver/batching/hooks.md) + * [mlserver.batching.requests](api/mlserver/batching/requests.md) + * [mlserver.batching.shape](api/mlserver/batching/shape.md) + * [mlserver.cache](api/mlserver/cache.md) + * [mlserver.cache.cache](api/mlserver/cache/cache.md) + * [mlserver.cache.local](api/mlserver/cache/local.md) + * [mlserver.cache.local.local](api/mlserver/cache/local/local.md) + * [mlserver.cloudevents](api/mlserver/cloudevents.md) + * [mlserver.codecs](api/mlserver/codecs.md) + * [mlserver.codecs.base](api/mlserver/codecs/base.md) + * [mlserver.codecs.base64](api/mlserver/codecs/base64.md) + * [mlserver.codecs.datetime](api/mlserver/codecs/datetime.md) + * [mlserver.codecs.decorator](api/mlserver/codecs/decorator.md) + * [mlserver.codecs.errors](api/mlserver/codecs/errors.md) + * [mlserver.codecs.json](api/mlserver/codecs/json.md) + * [mlserver.codecs.lists](api/mlserver/codecs/lists.md) + * [mlserver.codecs.numpy](api/mlserver/codecs/numpy.md) + * [mlserver.codecs.pandas](api/mlserver/codecs/pandas.md) + * [mlserver.codecs.string](api/mlserver/codecs/string.md) + * [mlserver.codecs.utils](api/mlserver/codecs/utils.md) + * [mlserver.context](api/mlserver/context.md) + * [mlserver.env](api/mlserver/env.md) + * [mlserver.errors](api/mlserver/errors.md) + * [mlserver.grpc](api/mlserver/grpc.md) + * [mlserver.grpc.converters](api/mlserver/grpc/converters.md) + * [mlserver.grpc.dataplane_pb2](api/mlserver/grpc/dataplane_pb2.md) + * [mlserver.grpc.dataplane_pb2_grpc](api/mlserver/grpc/dataplane_pb2_grpc.md) + * [mlserver.grpc.interceptors](api/mlserver/grpc/interceptors.md) + * [mlserver.grpc.logging](api/mlserver/grpc/logging.md) + * [mlserver.grpc.model_repository](api/mlserver/grpc/model_repository.md) + * [mlserver.grpc.model_repository_pb2](api/mlserver/grpc/model_repository_pb2.md) + * [mlserver.grpc.model_repository_pb2_grpc](api/mlserver/grpc/model_repository_pb2_grpc.md) + * [mlserver.grpc.server](api/mlserver/grpc/server.md) + * [mlserver.grpc.servicers](api/mlserver/grpc/servicers.md) + * [mlserver.grpc.utils](api/mlserver/grpc/utils.md) + * [mlserver.handlers](api/mlserver/handlers.md) + * [mlserver.handlers.custom](api/mlserver/handlers/custom.md) + * [mlserver.handlers.dataplane](api/mlserver/handlers/dataplane.md) + * [mlserver.handlers.model_repository](api/mlserver/handlers/model_repository.md) + * [mlserver.kafka](api/mlserver/kafka.md) + * [mlserver.kafka.errors](api/mlserver/kafka/errors.md) + * [mlserver.kafka.handlers](api/mlserver/kafka/handlers.md) + * [mlserver.kafka.logging](api/mlserver/kafka/logging.md) + * [mlserver.kafka.message](api/mlserver/kafka/message.md) + * [mlserver.kafka.server](api/mlserver/kafka/server.md) + * [mlserver.logging](api/mlserver/logging.md) + * [mlserver.metrics](api/mlserver/metrics.md) + * [mlserver.metrics.context](api/mlserver/metrics/context.md) + * [mlserver.metrics.errors](api/mlserver/metrics/errors.md) + * [mlserver.metrics.logging](api/mlserver/metrics/logging.md) + * [mlserver.metrics.prometheus](api/mlserver/metrics/prometheus.md) + * [mlserver.metrics.registry](api/mlserver/metrics/registry.md) + * [mlserver.metrics.server](api/mlserver/metrics/server.md) + * [mlserver.middleware](api/mlserver/middleware.md) + * [mlserver.model](api/mlserver/model.md) + * [mlserver.parallel](api/mlserver/parallel.md) + * [mlserver.parallel.dispatcher](api/mlserver/parallel/dispatcher.md) + * [mlserver.parallel.errors](api/mlserver/parallel/errors.md) + * [mlserver.parallel.logging](api/mlserver/parallel/logging.md) + * [mlserver.parallel.messages](api/mlserver/parallel/messages.md) + * [mlserver.parallel.model](api/mlserver/parallel/model.md) + * [mlserver.parallel.pool](api/mlserver/parallel/pool.md) + * [mlserver.parallel.registry](api/mlserver/parallel/registry.md) + * [mlserver.parallel.utils](api/mlserver/parallel/utils.md) + * [mlserver.parallel.worker](api/mlserver/parallel/worker.md) + * [mlserver.raw](api/mlserver/raw.md) + * [mlserver.registry](api/mlserver/registry.md) + * [mlserver.repository](api/mlserver/repository.md) + * [mlserver.repository.factory](api/mlserver/repository/factory.md) + * [mlserver.repository.load](api/mlserver/repository/load.md) + * [mlserver.repository.repository](api/mlserver/repository/repository.md) + * [mlserver.rest](api/mlserver/rest.md) + * [mlserver.rest.app](api/mlserver/rest/app.md) + * [mlserver.rest.endpoints](api/mlserver/rest/endpoints.md) + * [mlserver.rest.errors](api/mlserver/rest/errors.md) + * [mlserver.rest.logging](api/mlserver/rest/logging.md) + * [mlserver.rest.openapi](api/mlserver/rest/openapi.md) + * [mlserver.rest.openapi.schema](api/mlserver/rest/openapi/schema.md) + * [mlserver.rest.requests](api/mlserver/rest/requests.md) + * [mlserver.rest.responses](api/mlserver/rest/responses.md) + * [mlserver.rest.server](api/mlserver/rest/server.md) + * [mlserver.rest.utils](api/mlserver/rest/utils.md) + * [mlserver.server](api/mlserver/server.md) + * [mlserver.settings](api/mlserver/settings.md) + * [mlserver.tracing](api/mlserver/tracing.md) + * [mlserver.types](api/mlserver/types.md) + * [mlserver.types.base](api/mlserver/types/base.md) + * [mlserver.types.dataplane](api/mlserver/types/dataplane.md) + * [mlserver.types.model_repository](api/mlserver/types/model_repository.md) + * [mlserver.utils](api/mlserver/utils.md) + * [mlserver.version](api/mlserver/version.md) diff --git a/docs-gb/api/index.md b/docs-gb/api/index.md new file mode 100644 index 000000000..ecbc0fb79 --- /dev/null +++ b/docs-gb/api/index.md @@ -0,0 +1,2 @@ +# API Reference + diff --git a/docs-gb/api/mlserver.md b/docs-gb/api/mlserver.md new file mode 100644 index 000000000..1e42c9e60 --- /dev/null +++ b/docs-gb/api/mlserver.md @@ -0,0 +1,2 @@ +# Module `mlserver` + diff --git a/docs-gb/api/mlserver/batching.md b/docs-gb/api/mlserver/batching.md new file mode 100644 index 000000000..c92c1e266 --- /dev/null +++ b/docs-gb/api/mlserver/batching.md @@ -0,0 +1,2 @@ +# Module `mlserver.batching` + diff --git a/docs-gb/api/mlserver/batching/adaptive.md b/docs-gb/api/mlserver/batching/adaptive.md new file mode 100644 index 000000000..b2df5bd6b --- /dev/null +++ b/docs-gb/api/mlserver/batching/adaptive.md @@ -0,0 +1,17 @@ +# Module `mlserver.batching.adaptive` + + +## Class `AdaptiveBatcher` + + +**Description:** +*No docstring available.* + +### Method `predict` + + +**Signature:** `predict(self, req: 'InferenceRequest') -> 'InferenceResponse'` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/batching/hooks.md b/docs-gb/api/mlserver/batching/hooks.md new file mode 100644 index 000000000..c46bc80e7 --- /dev/null +++ b/docs-gb/api/mlserver/batching/hooks.md @@ -0,0 +1,37 @@ +# Module `mlserver.batching.hooks` + + +## Class `InvalidBatchingMethod` + + +**Description:** +Common base class for all non-exit exceptions. + +## Function `adaptive_batching` + + +**Signature:** `adaptive_batching(f: Callable[[mlserver.types.dataplane.InferenceRequest], Awaitable[mlserver.types.dataplane.InferenceResponse]])` + + +**Description:** +Decorator for the `predict()` method which will ensure it uses the +underlying adaptive batcher instance. + +## Function `load_batching` + + +**Signature:** `load_batching(model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +## Function `not_implemented_warning` + + +**Signature:** `not_implemented_warning(f: Callable[[AsyncIterator[mlserver.types.dataplane.InferenceRequest]], AsyncIterator[mlserver.types.dataplane.InferenceResponse]])` + + +**Description:** +Decorator to lets users know that adaptive batching is not required on +method `f`. diff --git a/docs-gb/api/mlserver/batching/requests.md b/docs-gb/api/mlserver/batching/requests.md new file mode 100644 index 000000000..cf5825145 --- /dev/null +++ b/docs-gb/api/mlserver/batching/requests.md @@ -0,0 +1,17 @@ +# Module `mlserver.batching.requests` + + +## Class `BatchedRequests` + + +**Description:** +*No docstring available.* + +### Method `split_response` + + +**Signature:** `split_response(self, batched_response: mlserver.types.dataplane.InferenceResponse) -> Dict[str, mlserver.types.dataplane.InferenceResponse]` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/batching/shape.md b/docs-gb/api/mlserver/batching/shape.md new file mode 100644 index 000000000..9ca04b137 --- /dev/null +++ b/docs-gb/api/mlserver/batching/shape.md @@ -0,0 +1,26 @@ +# Module `mlserver.batching.shape` + + +## Class `Shape` + + +**Description:** +Helper class to manipulate shapes. + +### Method `copy` + + +**Signature:** `copy(self) -> 'Shape'` + + +**Description:** +*No docstring available.* + +### Method `to_list` + + +**Signature:** `to_list(self) -> List[int]` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/cache.md b/docs-gb/api/mlserver/cache.md new file mode 100644 index 000000000..e61210735 --- /dev/null +++ b/docs-gb/api/mlserver/cache.md @@ -0,0 +1,2 @@ +# Module `mlserver.cache` + diff --git a/docs-gb/api/mlserver/cache/cache.md b/docs-gb/api/mlserver/cache/cache.md new file mode 100644 index 000000000..aa7bccd35 --- /dev/null +++ b/docs-gb/api/mlserver/cache/cache.md @@ -0,0 +1,38 @@ +# Module `mlserver.cache.cache` + + +## Class `ResponseCache` + + +**Description:** +*No docstring available.* + +### Method `insert` + + +**Signature:** `insert(self, key: str, value: str)` + + +**Description:** +Method responsible for inserting value to cache. +**This method should be overriden to implement your custom cache logic.** + +### Method `lookup` + + +**Signature:** `lookup(self, key: str) -> str` + + +**Description:** +Method responsible for returning key value in the cache. +**This method should be overriden to implement your custom cache logic.** + +### Method `size` + + +**Signature:** `size(self) -> int` + + +**Description:** +Method responsible for returning the size of the cache. +**This method should be overriden to implement your custom cache logic.** diff --git a/docs-gb/api/mlserver/cache/local.md b/docs-gb/api/mlserver/cache/local.md new file mode 100644 index 000000000..adc398694 --- /dev/null +++ b/docs-gb/api/mlserver/cache/local.md @@ -0,0 +1,2 @@ +# Module `mlserver.cache.local` + diff --git a/docs-gb/api/mlserver/cache/local/local.md b/docs-gb/api/mlserver/cache/local/local.md new file mode 100644 index 000000000..e52826eb2 --- /dev/null +++ b/docs-gb/api/mlserver/cache/local/local.md @@ -0,0 +1,38 @@ +# Module `mlserver.cache.local.local` + + +## Class `LocalCache` + + +**Description:** +*No docstring available.* + +### Method `insert` + + +**Signature:** `insert(self, key: str, value: str)` + + +**Description:** +Method responsible for inserting value to cache. +**This method should be overriden to implement your custom cache logic.** + +### Method `lookup` + + +**Signature:** `lookup(self, key: str) -> str` + + +**Description:** +Method responsible for returning key value in the cache. +**This method should be overriden to implement your custom cache logic.** + +### Method `size` + + +**Signature:** `size(self) -> int` + + +**Description:** +Method responsible for returning the size of the cache. +**This method should be overriden to implement your custom cache logic.** diff --git a/docs-gb/api/mlserver/cloudevents.md b/docs-gb/api/mlserver/cloudevents.md new file mode 100644 index 000000000..728942464 --- /dev/null +++ b/docs-gb/api/mlserver/cloudevents.md @@ -0,0 +1,75 @@ +# Module `mlserver.cloudevents` + + +## Class `CloudEventsMiddleware` + + +**Description:** +Base class to implement middlewares. + +### Method `request_middleware` + + +**Signature:** `request_middleware(self, request: mlserver.types.dataplane.InferenceRequest, model_settings: mlserver.settings.ModelSettings) -> mlserver.types.dataplane.InferenceRequest` + + +**Description:** +*No docstring available.* + +### Method `response_middleware` + + +**Signature:** `response_middleware(self, response: mlserver.types.dataplane.InferenceResponse, model_settings: mlserver.settings.ModelSettings) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +*No docstring available.* + +## Class `CloudEventsTypes` + + +**Description:** +Create a collection of name/value pairs. +Example enumeration: + +>>> class Color(Enum): +... RED = 1 +... BLUE = 2 +... GREEN = 3 + +Access them by: + +- attribute access: + + >>> Color.RED + + +- value lookup: + + >>> Color(1) + + +- name lookup: + + >>> Color['RED'] + + +Enumerations can be iterated over, and know how many members they have: + +>>> len(Color) +3 + +>>> list(Color) +[, , ] + +Methods can be added to enumerations, and members can have their own +attributes -- see the documentation for details. + +## Function `get_namespace` + + +**Signature:** `get_namespace() -> Optional[str]` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/codecs.md b/docs-gb/api/mlserver/codecs.md new file mode 100644 index 000000000..f3c7da086 --- /dev/null +++ b/docs-gb/api/mlserver/codecs.md @@ -0,0 +1,2 @@ +# Module `mlserver.codecs` + diff --git a/docs-gb/api/mlserver/codecs/base.md b/docs-gb/api/mlserver/codecs/base.md new file mode 100644 index 000000000..cf5e4457d --- /dev/null +++ b/docs-gb/api/mlserver/codecs/base.md @@ -0,0 +1,53 @@ +# Module `mlserver.codecs.base` + + +## Class `InputCodec` + + +**Description:** +The InputCodec interface lets you define type conversions of your raw input +data to / from the Open Inference Protocol. +Note that this codec applies at the individual input (output) level. + +For request-wide transformations (e.g. dataframes), use the +``RequestCodec`` interface instead. + +## Class `RequestCodec` + + +**Description:** +The ``RequestCodec`` interface lets you define request-level conversions +between high-level Python types and the Open Inference Protocol. +This can be useful where the encoding of your payload encompases multiple +input heads (e.g. dataframes, where each column can be thought as a +separate input head). + +For individual input-level encoding / decoding, use the ``InputCodec`` +interface instead. + +## Function `deprecated` + + +**Signature:** `deprecated(reason: str)` + + +**Description:** +*No docstring available.* + +## Function `register_input_codec` + + +**Signature:** `register_input_codec(CodecKlass: Union[Type[ForwardRef('InputCodec')], ForwardRef('InputCodec')])` + + +**Description:** +*No docstring available.* + +## Function `register_request_codec` + + +**Signature:** `register_request_codec(CodecKlass: Union[Type[ForwardRef('RequestCodec')], ForwardRef('RequestCodec')])` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/codecs/base64.md b/docs-gb/api/mlserver/codecs/base64.md new file mode 100644 index 000000000..62e26592e --- /dev/null +++ b/docs-gb/api/mlserver/codecs/base64.md @@ -0,0 +1,8 @@ +# Module `mlserver.codecs.base64` + + +## Class `Base64Codec` + + +**Description:** +Codec that convers to / from a base64 input. diff --git a/docs-gb/api/mlserver/codecs/datetime.md b/docs-gb/api/mlserver/codecs/datetime.md new file mode 100644 index 000000000..0e2a56637 --- /dev/null +++ b/docs-gb/api/mlserver/codecs/datetime.md @@ -0,0 +1,8 @@ +# Module `mlserver.codecs.datetime` + + +## Class `DatetimeCodec` + + +**Description:** +Codec that convers to / from a datetime input. diff --git a/docs-gb/api/mlserver/codecs/decorator.md b/docs-gb/api/mlserver/codecs/decorator.md new file mode 100644 index 000000000..4712d1345 --- /dev/null +++ b/docs-gb/api/mlserver/codecs/decorator.md @@ -0,0 +1,35 @@ +# Module `mlserver.codecs.decorator` + + +## Class `SignatureCodec` + + +**Description:** +Internal codec that knows how to map type hints to codecs. + +### Method `decode_request` + + +**Signature:** `decode_request(self, request: mlserver.types.dataplane.InferenceRequest) -> Dict[str, Any]` + + +**Description:** +Decode an inference request into a high-level Python object. + +### Method `encode_response` + + +**Signature:** `encode_response(self, model_name: str, payload: Any, model_version: Optional[str] = None) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +Encode the given payload into an inference response. + +## Function `decode_args` + + +**Signature:** `decode_args(predict: Callable) -> Callable[[ForwardRef('MLModel'), mlserver.types.dataplane.InferenceRequest], Coroutine[Any, Any, mlserver.types.dataplane.InferenceResponse]]` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/codecs/errors.md b/docs-gb/api/mlserver/codecs/errors.md new file mode 100644 index 000000000..3a30260cb --- /dev/null +++ b/docs-gb/api/mlserver/codecs/errors.md @@ -0,0 +1,26 @@ +# Module `mlserver.codecs.errors` + + +## Class `CodecError` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `CodecNotFound` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `InputsNotFound` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `OutputNotFound` + + +**Description:** +Common base class for all non-exit exceptions. diff --git a/docs-gb/api/mlserver/codecs/json.md b/docs-gb/api/mlserver/codecs/json.md new file mode 100644 index 000000000..2e75712cc --- /dev/null +++ b/docs-gb/api/mlserver/codecs/json.md @@ -0,0 +1,119 @@ +# Module `mlserver.codecs.json` + + +## Class `JSONEncoderWithArray` + + +**Description:** +Extensible JSON encoder for Python data structures. +Supports the following objects and types by default: + ++-------------------+---------------+ +| Python | JSON | ++===================+===============+ +| dict | object | ++-------------------+---------------+ +| list, tuple | array | ++-------------------+---------------+ +| str | string | ++-------------------+---------------+ +| int, float | number | ++-------------------+---------------+ +| True | true | ++-------------------+---------------+ +| False | false | ++-------------------+---------------+ +| None | null | ++-------------------+---------------+ + +To extend this to recognize other objects, subclass and implement a +``.default()`` method with another method that returns a serializable +object for ``o`` if possible, otherwise it should call the superclass +implementation (to raise ``TypeError``). + +### Method `default` + + +**Signature:** `default(self, obj)` + + +**Description:** +Implement this method in a subclass such that it returns +a serializable object for ``o``, or calls the base implementation +(to raise a ``TypeError``). + +For example, to support arbitrary iterators, you could +implement default like this:: + + def default(self, o): + try: + iterable = iter(o) + except TypeError: + pass + else: + return list(iterable) + # Let the base class default method raise the TypeError + return super().default(o) + +### Method `encode` + + +**Signature:** `encode(self, o)` + + +**Description:** +Return a JSON string representation of a Python data structure. +>>> from json.encoder import JSONEncoder +>>> JSONEncoder().encode({"foo": ["bar", "baz"]}) +'{"foo": ["bar", "baz"]}' + +### Method `iterencode` + + +**Signature:** `iterencode(self, o, _one_shot=False)` + + +**Description:** +Encode the given object and yield each string +representation as available. + +For example:: + + for chunk in JSONEncoder().iterencode(bigobject): + mysocket.write(chunk) + +## Function `decode_from_bytelike_json_to_dict` + + +**Signature:** `decode_from_bytelike_json_to_dict(v: Union[bytes, str]) -> dict` + + +**Description:** +*No docstring available.* + +## Function `decode_json_input_or_output` + + +**Signature:** `decode_json_input_or_output(input_or_output: Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]) -> List[Any]` + + +**Description:** +*No docstring available.* + +## Function `encode_to_json` + + +**Signature:** `encode_to_json(v: Any, use_bytes: bool = True) -> Union[str, bytes]` + + +**Description:** +*No docstring available.* + +## Function `encode_to_json_bytes` + + +**Signature:** `encode_to_json_bytes(v: Any) -> bytes` + + +**Description:** +encodes a dict into json bytes, can deal with byte like values gracefully diff --git a/docs-gb/api/mlserver/codecs/lists.md b/docs-gb/api/mlserver/codecs/lists.md new file mode 100644 index 000000000..c3120e9ef --- /dev/null +++ b/docs-gb/api/mlserver/codecs/lists.md @@ -0,0 +1,22 @@ +# Module `mlserver.codecs.lists` + + +## Function `as_list` + + +**Signature:** `as_list(payload: Union[bytes, str, List[Union[bytes, str]]]) -> Iterator[Union[bytes, str]]` + + +**Description:** +Return a payload as an iterator. Single elements will be +treated as a list of 1 item. All elements are assumed to be +string-like. + +## Function `is_list_of` + + +**Signature:** `is_list_of(payload: Any, instance_type: Type)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/codecs/numpy.md b/docs-gb/api/mlserver/codecs/numpy.md new file mode 100644 index 000000000..158ecfe8e --- /dev/null +++ b/docs-gb/api/mlserver/codecs/numpy.md @@ -0,0 +1,43 @@ +# Module `mlserver.codecs.numpy` + + +## Class `NumpyCodec` + + +**Description:** +Decodes an request input (response output) as a NumPy array. + +## Class `NumpyRequestCodec` + + +**Description:** +Decodes the first input (output) of request (response) as a NumPy array. +This codec can be useful for cases where the whole payload is a single +NumPy tensor. + +## Function `convert_nan` + + +**Signature:** `convert_nan(val)` + + +**Description:** +*No docstring available.* + +## Function `to_datatype` + + +**Signature:** `to_datatype(dtype: numpy.dtype) -> mlserver.types.dataplane.Datatype` + + +**Description:** +*No docstring available.* + +## Function `to_dtype` + + +**Signature:** `to_dtype(input_or_output: Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]) -> 'np.dtype'` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/codecs/pandas.md b/docs-gb/api/mlserver/codecs/pandas.md new file mode 100644 index 000000000..789ba6572 --- /dev/null +++ b/docs-gb/api/mlserver/codecs/pandas.md @@ -0,0 +1,9 @@ +# Module `mlserver.codecs.pandas` + + +## Class `PandasCodec` + + +**Description:** +Decodes a request (response) into a Pandas DataFrame, assuming each input +(output) head corresponds to a column of the DataFrame. diff --git a/docs-gb/api/mlserver/codecs/string.md b/docs-gb/api/mlserver/codecs/string.md new file mode 100644 index 000000000..ff7fde1ca --- /dev/null +++ b/docs-gb/api/mlserver/codecs/string.md @@ -0,0 +1,35 @@ +# Module `mlserver.codecs.string` + + +## Class `StringCodec` + + +**Description:** +Encodes a list of Python strings as a BYTES input (output). + +## Class `StringRequestCodec` + + +**Description:** +Decodes the first input (output) of request (response) as a list of +strings. +This codec can be useful for cases where the whole payload is a single +list of strings. + +## Function `decode_str` + + +**Signature:** `decode_str(encoded: Union[bytes, str], str_codec='utf-8') -> str` + + +**Description:** +*No docstring available.* + +## Function `encode_str` + + +**Signature:** `encode_str(elem: str) -> bytes` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/codecs/utils.md b/docs-gb/api/mlserver/codecs/utils.md new file mode 100644 index 000000000..d03a7bfcc --- /dev/null +++ b/docs-gb/api/mlserver/codecs/utils.md @@ -0,0 +1,83 @@ +# Module `mlserver.codecs.utils` + + +## Class `SingleInputRequestCodec` + + +**Description:** +The SingleInputRequestCodec can be used as a "meta-implementation" for other +codecs. Its goal to decode the whole request simply as the first decoded +element. + +## Function `decode_inference_request` + + +**Signature:** `decode_inference_request(inference_request: mlserver.types.dataplane.InferenceRequest, model_settings: Optional[mlserver.settings.ModelSettings] = None, metadata_inputs: Dict[str, mlserver.types.dataplane.MetadataTensor] = {}) -> Optional[Any]` + + +**Description:** +*No docstring available.* + +## Function `decode_request_input` + + +**Signature:** `decode_request_input(request_input: mlserver.types.dataplane.RequestInput, metadata_inputs: Dict[str, mlserver.types.dataplane.MetadataTensor] = {}) -> Optional[Any]` + + +**Description:** +*No docstring available.* + +## Function `encode_inference_response` + + +**Signature:** `encode_inference_response(payload: Any, model_settings: mlserver.settings.ModelSettings) -> Optional[mlserver.types.dataplane.InferenceResponse]` + + +**Description:** +*No docstring available.* + +## Function `encode_response_output` + + +**Signature:** `encode_response_output(payload: Any, request_output: mlserver.types.dataplane.RequestOutput, metadata_outputs: Dict[str, mlserver.types.dataplane.MetadataTensor] = {}) -> Optional[mlserver.types.dataplane.ResponseOutput]` + + +**Description:** +*No docstring available.* + +## Function `get_decoded` + + +**Signature:** `get_decoded(parametrised_obj: Union[mlserver.types.dataplane.InferenceRequest, mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.RequestOutput, mlserver.types.dataplane.ResponseOutput, mlserver.types.dataplane.InferenceResponse]) -> Any` + + +**Description:** +*No docstring available.* + +## Function `get_decoded_or_raw` + + +**Signature:** `get_decoded_or_raw(parametrised_obj: Union[mlserver.types.dataplane.InferenceRequest, mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.RequestOutput, mlserver.types.dataplane.ResponseOutput, mlserver.types.dataplane.InferenceResponse]) -> Any` + + +**Description:** +*No docstring available.* + +## Function `has_decoded` + + +**Signature:** `has_decoded(parametrised_obj: Union[mlserver.types.dataplane.InferenceRequest, mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.RequestOutput, mlserver.types.dataplane.ResponseOutput, mlserver.types.dataplane.InferenceResponse]) -> bool` + + +**Description:** +*No docstring available.* + +## Function `inject_batch_dimension` + + +**Signature:** `inject_batch_dimension(shape: List[int]) -> List[int]` + + +**Description:** +Utility method to ensure that 1-dimensional shapes +assume that `[N] == [N, D]`. diff --git a/docs-gb/api/mlserver/context.md b/docs-gb/api/mlserver/context.md new file mode 100644 index 000000000..646c5873e --- /dev/null +++ b/docs-gb/api/mlserver/context.md @@ -0,0 +1,11 @@ +# Module `mlserver.context` + + +## Function `model_context` + + +**Signature:** `model_context(model_settings: mlserver.settings.ModelSettings)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/env.md b/docs-gb/api/mlserver/env.md new file mode 100644 index 000000000..758a8607d --- /dev/null +++ b/docs-gb/api/mlserver/env.md @@ -0,0 +1,28 @@ +# Module `mlserver.env` + + +## Class `Environment` + + +**Description:** +Custom Python environment. +The class can be used as a context manager to enable / disable the custom +environment. + +## Function `compute_hash_of_file` + + +**Signature:** `compute_hash_of_file(tarball_path: str) -> str` + + +**Description:** +*No docstring available.* + +## Function `compute_hash_of_string` + + +**Signature:** `compute_hash_of_string(string: str) -> str` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/errors.md b/docs-gb/api/mlserver/errors.md new file mode 100644 index 000000000..9fa74e3ad --- /dev/null +++ b/docs-gb/api/mlserver/errors.md @@ -0,0 +1,38 @@ +# Module `mlserver.errors` + + +## Class `InferenceError` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `InvalidModelURI` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `MLServerError` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `ModelNotFound` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `ModelNotReady` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `ModelParametersMissing` + + +**Description:** +Common base class for all non-exit exceptions. diff --git a/docs-gb/api/mlserver/grpc.md b/docs-gb/api/mlserver/grpc.md new file mode 100644 index 000000000..da64930d3 --- /dev/null +++ b/docs-gb/api/mlserver/grpc.md @@ -0,0 +1,2 @@ +# Module `mlserver.grpc` + diff --git a/docs-gb/api/mlserver/grpc/converters.md b/docs-gb/api/mlserver/grpc/converters.md new file mode 100644 index 000000000..155ec5c4f --- /dev/null +++ b/docs-gb/api/mlserver/grpc/converters.md @@ -0,0 +1,80 @@ +# Module `mlserver.grpc.converters` + + +## Class `InferInputTensorConverter` + + +**Description:** +*No docstring available.* + +## Class `InferOutputTensorConverter` + + +**Description:** +*No docstring available.* + +## Class `InferRequestedOutputTensorConverter` + + +**Description:** +*No docstring available.* + +## Class `InferTensorContentsConverter` + + +**Description:** +*No docstring available.* + +## Class `ModelInferRequestConverter` + + +**Description:** +*No docstring available.* + +## Class `ModelInferResponseConverter` + + +**Description:** +*No docstring available.* + +## Class `ModelMetadataResponseConverter` + + +**Description:** +*No docstring available.* + +## Class `ParametersConverter` + + +**Description:** +*No docstring available.* + +## Class `RepositoryIndexRequestConverter` + + +**Description:** +*No docstring available.* + +## Class `RepositoryIndexResponseConverter` + + +**Description:** +*No docstring available.* + +## Class `RepositoryIndexResponseItemConverter` + + +**Description:** +*No docstring available.* + +## Class `ServerMetadataResponseConverter` + + +**Description:** +*No docstring available.* + +## Class `TensorMetadataConverter` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/grpc/dataplane_pb2.md b/docs-gb/api/mlserver/grpc/dataplane_pb2.md new file mode 100644 index 000000000..dfa1cc403 --- /dev/null +++ b/docs-gb/api/mlserver/grpc/dataplane_pb2.md @@ -0,0 +1,2 @@ +# Module `mlserver.grpc.dataplane_pb2` + diff --git a/docs-gb/api/mlserver/grpc/dataplane_pb2_grpc.md b/docs-gb/api/mlserver/grpc/dataplane_pb2_grpc.md new file mode 100644 index 000000000..6b9194c74 --- /dev/null +++ b/docs-gb/api/mlserver/grpc/dataplane_pb2_grpc.md @@ -0,0 +1,209 @@ +# Module `mlserver.grpc.dataplane_pb2_grpc` + + +## Class `GRPCInferenceService` + + +**Description:** +Inference Server GRPC endpoints. + +### Method `ModelInfer` + + +**Signature:** `ModelInfer(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `ModelMetadata` + + +**Signature:** `ModelMetadata(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `ModelReady` + + +**Signature:** `ModelReady(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `ModelStreamInfer` + + +**Signature:** `ModelStreamInfer(request_iterator, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryIndex` + + +**Signature:** `RepositoryIndex(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelLoad` + + +**Signature:** `RepositoryModelLoad(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelUnload` + + +**Signature:** `RepositoryModelUnload(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `ServerLive` + + +**Signature:** `ServerLive(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `ServerMetadata` + + +**Signature:** `ServerMetadata(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `ServerReady` + + +**Signature:** `ServerReady(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +## Class `GRPCInferenceServiceServicer` + + +**Description:** +Inference Server GRPC endpoints. + +### Method `ModelInfer` + + +**Signature:** `ModelInfer(self, request, context)` + + +**Description:** +Perform inference using a specific model. + +### Method `ModelMetadata` + + +**Signature:** `ModelMetadata(self, request, context)` + + +**Description:** +Get model metadata. + +### Method `ModelReady` + + +**Signature:** `ModelReady(self, request, context)` + + +**Description:** +Check readiness of a model in the inference server. + +### Method `ModelStreamInfer` + + +**Signature:** `ModelStreamInfer(self, request_iterator, context)` + + +**Description:** +Perform stream inference using a specific model. + +### Method `RepositoryIndex` + + +**Signature:** `RepositoryIndex(self, request, context)` + + +**Description:** +Get the index of model repository contents. + +### Method `RepositoryModelLoad` + + +**Signature:** `RepositoryModelLoad(self, request, context)` + + +**Description:** +Load or reload a model from a repository. + +### Method `RepositoryModelUnload` + + +**Signature:** `RepositoryModelUnload(self, request, context)` + + +**Description:** +Unload a model. + +### Method `ServerLive` + + +**Signature:** `ServerLive(self, request, context)` + + +**Description:** +Check liveness of the inference server. + +### Method `ServerMetadata` + + +**Signature:** `ServerMetadata(self, request, context)` + + +**Description:** +Get server metadata. + +### Method `ServerReady` + + +**Signature:** `ServerReady(self, request, context)` + + +**Description:** +Check readiness of the inference server. + +## Class `GRPCInferenceServiceStub` + + +**Description:** +Inference Server GRPC endpoints. + +## Function `add_GRPCInferenceServiceServicer_to_server` + + +**Signature:** `add_GRPCInferenceServiceServicer_to_server(servicer, server)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/grpc/interceptors.md b/docs-gb/api/mlserver/grpc/interceptors.md new file mode 100644 index 000000000..11bd2082e --- /dev/null +++ b/docs-gb/api/mlserver/grpc/interceptors.md @@ -0,0 +1,79 @@ +# Module `mlserver.grpc.interceptors` + + +## Class `LoggingInterceptor` + + +**Description:** +Affords intercepting incoming RPCs on the service-side. +This is an EXPERIMENTAL API. + +### Method `intercept_service` + + +**Signature:** `intercept_service(self, continuation: Callable[[grpc.HandlerCallDetails], Awaitable[grpc.RpcMethodHandler]], handler_call_details: grpc.HandlerCallDetails) -> grpc.RpcMethodHandler` + + +**Description:** +Intercepts incoming RPCs before handing them over to a handler. +State can be passed from an interceptor to downstream interceptors +via contextvars. The first interceptor is called from an empty +contextvars.Context, and the same Context is used for downstream +interceptors and for the final handler call. Note that there are no +guarantees that interceptors and handlers will be called from the +same thread. + +**Parameters:** +- `continuation` (unknown): A function that takes a HandlerCallDetails and +proceeds to invoke the next interceptor in the chain, if any, +or the RPC handler lookup logic, with the call details passed +as an argument, and returns an RpcMethodHandler instance if +the RPC is considered serviced, or None otherwise. +- `handler_call_details` (unknown): A HandlerCallDetails describing the RPC. + +**Returns:** +- (unknown): An RpcMethodHandler with which the RPC may be serviced if the +interceptor chooses to service this RPC, or None otherwise. + +## Class `PromServerInterceptor` + + +**Description:** +Simple wrapper around `py_grpc_prometheus` to support `grpc.aio`. +TODO: Open PR to add support upstream for AsyncIO. + +### Method `intercept_service` + + +**Signature:** `intercept_service(self, continuation: Callable[[grpc.HandlerCallDetails], Awaitable[grpc.RpcMethodHandler]], handler_call_details: grpc.HandlerCallDetails) -> grpc.RpcMethodHandler` + + +**Description:** +Intercepts incoming RPCs before handing them over to a handler. +State can be passed from an interceptor to downstream interceptors +via contextvars. The first interceptor is called from an empty +contextvars.Context, and the same Context is used for downstream +interceptors and for the final handler call. Note that there are no +guarantees that interceptors and handlers will be called from the +same thread. + +**Parameters:** +- `continuation` (unknown): A function that takes a HandlerCallDetails and +proceeds to invoke the next interceptor in the chain, if any, +or the RPC handler lookup logic, with the call details passed +as an argument, and returns an RpcMethodHandler instance if +the RPC is considered serviced, or None otherwise. +- `handler_call_details` (unknown): A HandlerCallDetails describing the RPC. + +**Returns:** +- (unknown): An RpcMethodHandler with which the RPC may be serviced if the +interceptor chooses to service this RPC, or None otherwise. + +## Function `wrap_async_iterator_inc_counter` + + +**Signature:** `wrap_async_iterator_inc_counter(iterator: AsyncIterator[dataplane_pb2.ModelInferRequest], counter: prometheus_client.metrics.Counter, grpc_type: str, grpc_service_name: str, grpc_method_name: str) -> AsyncIterator[dataplane_pb2.ModelInferRequest]` + + +**Description:** +Wraps an async iterator and collect metrics. diff --git a/docs-gb/api/mlserver/grpc/logging.md b/docs-gb/api/mlserver/grpc/logging.md new file mode 100644 index 000000000..cf9f18d66 --- /dev/null +++ b/docs-gb/api/mlserver/grpc/logging.md @@ -0,0 +1,2 @@ +# Module `mlserver.grpc.logging` + diff --git a/docs-gb/api/mlserver/grpc/model_repository.md b/docs-gb/api/mlserver/grpc/model_repository.md new file mode 100644 index 000000000..2bdc609b7 --- /dev/null +++ b/docs-gb/api/mlserver/grpc/model_repository.md @@ -0,0 +1,35 @@ +# Module `mlserver.grpc.model_repository` + + +## Class `ModelRepositoryServicer` + + +**Description:** +Missing associated documentation comment in .proto file. + +### Method `RepositoryIndex` + + +**Signature:** `RepositoryIndex(self, request, context)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelLoad` + + +**Signature:** `RepositoryModelLoad(self, request, context)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelUnload` + + +**Signature:** `RepositoryModelUnload(self, request, context)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/grpc/model_repository_pb2.md b/docs-gb/api/mlserver/grpc/model_repository_pb2.md new file mode 100644 index 000000000..090690a6e --- /dev/null +++ b/docs-gb/api/mlserver/grpc/model_repository_pb2.md @@ -0,0 +1,2 @@ +# Module `mlserver.grpc.model_repository_pb2` + diff --git a/docs-gb/api/mlserver/grpc/model_repository_pb2_grpc.md b/docs-gb/api/mlserver/grpc/model_repository_pb2_grpc.md new file mode 100644 index 000000000..806ac8564 --- /dev/null +++ b/docs-gb/api/mlserver/grpc/model_repository_pb2_grpc.md @@ -0,0 +1,83 @@ +# Module `mlserver.grpc.model_repository_pb2_grpc` + + +## Class `ModelRepositoryService` + + +**Description:** +Missing associated documentation comment in .proto file. + +### Method `RepositoryIndex` + + +**Signature:** `RepositoryIndex(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelLoad` + + +**Signature:** `RepositoryModelLoad(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelUnload` + + +**Signature:** `RepositoryModelUnload(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)` + + +**Description:** +*No docstring available.* + +## Class `ModelRepositoryServiceServicer` + + +**Description:** +Missing associated documentation comment in .proto file. + +### Method `RepositoryIndex` + + +**Signature:** `RepositoryIndex(self, request, context)` + + +**Description:** +Get the index of model repository contents. + +### Method `RepositoryModelLoad` + + +**Signature:** `RepositoryModelLoad(self, request, context)` + + +**Description:** +Load or reload a model from a repository. + +### Method `RepositoryModelUnload` + + +**Signature:** `RepositoryModelUnload(self, request, context)` + + +**Description:** +Unload a model. + +## Class `ModelRepositoryServiceStub` + + +**Description:** +Missing associated documentation comment in .proto file. + +## Function `add_ModelRepositoryServiceServicer_to_server` + + +**Signature:** `add_ModelRepositoryServiceServicer_to_server(servicer, server)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/grpc/server.md b/docs-gb/api/mlserver/grpc/server.md new file mode 100644 index 000000000..18e360f3b --- /dev/null +++ b/docs-gb/api/mlserver/grpc/server.md @@ -0,0 +1,26 @@ +# Module `mlserver.grpc.server` + + +## Class `GRPCServer` + + +**Description:** +*No docstring available.* + +### Method `start` + + +**Signature:** `start(self)` + + +**Description:** +*No docstring available.* + +### Method `stop` + + +**Signature:** `stop(self, sig: Optional[int] = None)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/grpc/servicers.md b/docs-gb/api/mlserver/grpc/servicers.md new file mode 100644 index 000000000..13537153f --- /dev/null +++ b/docs-gb/api/mlserver/grpc/servicers.md @@ -0,0 +1,98 @@ +# Module `mlserver.grpc.servicers` + + +## Class `InferenceServicer` + + +**Description:** +Inference Server GRPC endpoints. + +### Method `ModelInfer` + + +**Signature:** `ModelInfer(self, request, context)` + + +**Description:** +*No docstring available.* + +### Method `ModelMetadata` + + +**Signature:** `ModelMetadata(self, request, context)` + + +**Description:** +*No docstring available.* + +### Method `ModelReady` + + +**Signature:** `ModelReady(self, request: dataplane_pb2.ModelReadyRequest, context) -> dataplane_pb2.ModelReadyResponse` + + +**Description:** +Check readiness of a model in the inference server. + +### Method `ModelStreamInfer` + + +**Signature:** `ModelStreamInfer(self, request_stream, context)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryIndex` + + +**Signature:** `RepositoryIndex(self, request: dataplane_pb2.RepositoryIndexRequest, context) -> dataplane_pb2.RepositoryIndexResponse` + + +**Description:** +Get the index of model repository contents. + +### Method `RepositoryModelLoad` + + +**Signature:** `RepositoryModelLoad(self, request, context)` + + +**Description:** +*No docstring available.* + +### Method `RepositoryModelUnload` + + +**Signature:** `RepositoryModelUnload(self, request, context)` + + +**Description:** +*No docstring available.* + +### Method `ServerLive` + + +**Signature:** `ServerLive(self, request: dataplane_pb2.ServerLiveRequest, context) -> dataplane_pb2.ServerLiveResponse` + + +**Description:** +Check liveness of the inference server. + +### Method `ServerMetadata` + + +**Signature:** `ServerMetadata(self, request: dataplane_pb2.ServerMetadataRequest, context) -> dataplane_pb2.ServerMetadataResponse` + + +**Description:** +Get server metadata. + +### Method `ServerReady` + + +**Signature:** `ServerReady(self, request: dataplane_pb2.ServerReadyRequest, context) -> dataplane_pb2.ServerReadyResponse` + + +**Description:** +Check readiness of the inference server. diff --git a/docs-gb/api/mlserver/grpc/utils.md b/docs-gb/api/mlserver/grpc/utils.md new file mode 100644 index 000000000..11f4a5eb6 --- /dev/null +++ b/docs-gb/api/mlserver/grpc/utils.md @@ -0,0 +1,38 @@ +# Module `mlserver.grpc.utils` + + +## Function `handle_mlserver_error` + + +**Signature:** `handle_mlserver_error(f: Callable)` + + +**Description:** +*No docstring available.* + +## Function `handle_mlserver_stream_error` + + +**Signature:** `handle_mlserver_stream_error(f: Callable)` + + +**Description:** +*No docstring available.* + +## Function `to_headers` + + +**Signature:** `to_headers(context: grpc.ServicerContext) -> Dict[str, str]` + + +**Description:** +*No docstring available.* + +## Function `to_metadata` + + +**Signature:** `to_metadata(headers: Dict[str, str]) -> Tuple[Tuple[str, str], ...]` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/handlers.md b/docs-gb/api/mlserver/handlers.md new file mode 100644 index 000000000..5a02331ad --- /dev/null +++ b/docs-gb/api/mlserver/handlers.md @@ -0,0 +1,2 @@ +# Module `mlserver.handlers` + diff --git a/docs-gb/api/mlserver/handlers/custom.md b/docs-gb/api/mlserver/handlers/custom.md new file mode 100644 index 000000000..c2022975a --- /dev/null +++ b/docs-gb/api/mlserver/handlers/custom.md @@ -0,0 +1,206 @@ +# Module `mlserver.handlers.custom` + + +## Class `CustomHandler` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Function `custom_handler` + + +**Signature:** `custom_handler(rest_path: str, rest_method: str = 'POST')` + + +**Description:** +*No docstring available.* + +## Function `get_custom_handlers` + + +**Signature:** `get_custom_handlers(model: mlserver.model.MLModel) -> List[Tuple[mlserver.handlers.custom.CustomHandler, Callable[..., Any]]]` + + +**Description:** +*No docstring available.* + +## Function `register_custom_handler` + + +**Signature:** `register_custom_handler(handler: mlserver.handlers.custom.CustomHandler, method: Callable[..., Any])` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/handlers/dataplane.md b/docs-gb/api/mlserver/handlers/dataplane.md new file mode 100644 index 000000000..6b0a1f1f1 --- /dev/null +++ b/docs-gb/api/mlserver/handlers/dataplane.md @@ -0,0 +1,72 @@ +# Module `mlserver.handlers.dataplane` + + +## Class `DataPlane` + + +**Description:** +Internal implementation of handlers, used by both the gRPC and REST +servers. + +### Method `infer` + + +**Signature:** `infer(self, payload: mlserver.types.dataplane.InferenceRequest, name: str, version: Optional[str] = None) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +*No docstring available.* + +### Method `infer_stream` + + +**Signature:** `infer_stream(self, payloads: AsyncIterator[mlserver.types.dataplane.InferenceRequest], name: str, version: Optional[str] = None) -> AsyncIterator[mlserver.types.dataplane.InferenceResponse]` + + +**Description:** +*No docstring available.* + +### Method `live` + + +**Signature:** `live(self) -> bool` + + +**Description:** +*No docstring available.* + +### Method `metadata` + + +**Signature:** `metadata(self) -> mlserver.types.dataplane.MetadataServerResponse` + + +**Description:** +*No docstring available.* + +### Method `model_metadata` + + +**Signature:** `model_metadata(self, name: str, version: Optional[str] = None) -> mlserver.types.dataplane.MetadataModelResponse` + + +**Description:** +*No docstring available.* + +### Method `model_ready` + + +**Signature:** `model_ready(self, name: str, version: Optional[str] = None) -> bool` + + +**Description:** +*No docstring available.* + +### Method `ready` + + +**Signature:** `ready(self) -> bool` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/handlers/model_repository.md b/docs-gb/api/mlserver/handlers/model_repository.md new file mode 100644 index 000000000..a448c33f6 --- /dev/null +++ b/docs-gb/api/mlserver/handlers/model_repository.md @@ -0,0 +1,35 @@ +# Module `mlserver.handlers.model_repository` + + +## Class `ModelRepositoryHandlers` + + +**Description:** +*No docstring available.* + +### Method `index` + + +**Signature:** `index(self, payload: mlserver.types.model_repository.RepositoryIndexRequest) -> mlserver.types.model_repository.RepositoryIndexResponse` + + +**Description:** +*No docstring available.* + +### Method `load` + + +**Signature:** `load(self, name: str) -> bool` + + +**Description:** +*No docstring available.* + +### Method `unload` + + +**Signature:** `unload(self, name: str) -> bool` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/kafka.md b/docs-gb/api/mlserver/kafka.md new file mode 100644 index 000000000..8611d4042 --- /dev/null +++ b/docs-gb/api/mlserver/kafka.md @@ -0,0 +1,2 @@ +# Module `mlserver.kafka` + diff --git a/docs-gb/api/mlserver/kafka/errors.md b/docs-gb/api/mlserver/kafka/errors.md new file mode 100644 index 000000000..8d8440c5b --- /dev/null +++ b/docs-gb/api/mlserver/kafka/errors.md @@ -0,0 +1,8 @@ +# Module `mlserver.kafka.errors` + + +## Class `InvalidMessageHeaders` + + +**Description:** +Common base class for all non-exit exceptions. diff --git a/docs-gb/api/mlserver/kafka/handlers.md b/docs-gb/api/mlserver/kafka/handlers.md new file mode 100644 index 000000000..41ed3a78b --- /dev/null +++ b/docs-gb/api/mlserver/kafka/handlers.md @@ -0,0 +1,17 @@ +# Module `mlserver.kafka.handlers` + + +## Class `KafkaHandlers` + + +**Description:** +*No docstring available.* + +### Method `infer` + + +**Signature:** `infer(self, request: mlserver.kafka.message.KafkaMessage) -> mlserver.kafka.message.KafkaMessage` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/kafka/logging.md b/docs-gb/api/mlserver/kafka/logging.md new file mode 100644 index 000000000..3fa88bba0 --- /dev/null +++ b/docs-gb/api/mlserver/kafka/logging.md @@ -0,0 +1,2 @@ +# Module `mlserver.kafka.logging` + diff --git a/docs-gb/api/mlserver/kafka/message.md b/docs-gb/api/mlserver/kafka/message.md new file mode 100644 index 000000000..b75cc6aa2 --- /dev/null +++ b/docs-gb/api/mlserver/kafka/message.md @@ -0,0 +1,179 @@ +# Module `mlserver.kafka.message` + + +## Class `KafkaMessage` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. diff --git a/docs-gb/api/mlserver/kafka/server.md b/docs-gb/api/mlserver/kafka/server.md new file mode 100644 index 000000000..5fb313ea9 --- /dev/null +++ b/docs-gb/api/mlserver/kafka/server.md @@ -0,0 +1,84 @@ +# Module `mlserver.kafka.server` + + +## Class `KafkaMethodTypes` + + +**Description:** +Create a collection of name/value pairs. +Example enumeration: + +>>> class Color(Enum): +... RED = 1 +... BLUE = 2 +... GREEN = 3 + +Access them by: + +- attribute access: + + >>> Color.RED + + +- value lookup: + + >>> Color(1) + + +- name lookup: + + >>> Color['RED'] + + +Enumerations can be iterated over, and know how many members they have: + +>>> len(Color) +3 + +>>> list(Color) +[, , ] + +Methods can be added to enumerations, and members can have their own +attributes -- see the documentation for details. + +## Class `KafkaServer` + + +**Description:** +*No docstring available.* + +### Method `add_custom_handlers` + + +**Signature:** `add_custom_handlers(self, model: mlserver.model.MLModel)` + + +**Description:** +*No docstring available.* + +### Method `delete_custom_handlers` + + +**Signature:** `delete_custom_handlers(self, model: mlserver.model.MLModel)` + + +**Description:** +*No docstring available.* + +### Method `start` + + +**Signature:** `start(self)` + + +**Description:** +*No docstring available.* + +### Method `stop` + + +**Signature:** `stop(self, sig: Optional[int] = None)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/logging.md b/docs-gb/api/mlserver/logging.md new file mode 100644 index 000000000..295eeba83 --- /dev/null +++ b/docs-gb/api/mlserver/logging.md @@ -0,0 +1,115 @@ +# Module `mlserver.logging` + + +## Class `ModelLoggerFormatter` + + +**Description:** +Log formatter incorporating model details, e.g. name and version. + +### Method `format` + + +**Signature:** `format(self, record: logging.LogRecord) -> str` + + +**Description:** +Format the specified record as text. +The record's attribute dictionary is used as the operand to a +string formatting operation which yields the returned string. +Before formatting the dictionary, a couple of preparatory steps +are carried out. The message attribute of the record is computed +using LogRecord.getMessage(). If the formatting string uses the +time (as determined by a call to usesTime(), formatTime() is +called to format the event time. If there is exception information, +it is formatted using formatException() and appended to the message. + +### Method `formatException` + + +**Signature:** `formatException(self, ei)` + + +**Description:** +Format and return the specified exception information as a string. +This default implementation just uses +traceback.print_exception() + +### Method `formatMessage` + + +**Signature:** `formatMessage(self, record)` + + +**Description:** +*No docstring available.* + +### Method `formatStack` + + +**Signature:** `formatStack(self, stack_info)` + + +**Description:** +This method is provided as an extension point for specialized +formatting of stack information. + +The input data is a string as returned from a call to + +### Method `formatTime` + + +**Signature:** `formatTime(self, record, datefmt=None)` + + +**Description:** +Return the creation time of the specified LogRecord as formatted text. +This method should be called from format() by a formatter which +wants to make use of a formatted time. This method can be overridden +in formatters to provide for any specific requirement, but the +basic behaviour is as follows: if datefmt (a string) is specified, +it is used with time.strftime() to format the creation time of the +record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used. +The resulting string is returned. This function uses a user-configurable +function to convert the creation time to a tuple. By default, +time.localtime() is used; to change this for a particular formatter +instance, set the 'converter' attribute to a function with the same +signature as time.localtime() or time.gmtime(). To change it for all +formatters, for example if you want all logging times to be shown in GMT, +set the 'converter' attribute in the Formatter class. + +### Method `usesTime` + + +**Signature:** `usesTime(self)` + + +**Description:** +Check if the format uses the creation time of the record. + +## Function `apply_logging_file` + + +**Signature:** `apply_logging_file(logging_settings: Union[str, Dict])` + + +**Description:** +*No docstring available.* + +## Function `configure_logger` + + +**Signature:** `configure_logger(settings: Optional[mlserver.settings.Settings] = None)` + + +**Description:** +*No docstring available.* + +## Function `get_logger` + + +**Signature:** `get_logger()` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/metrics.md b/docs-gb/api/mlserver/metrics.md new file mode 100644 index 000000000..4847a5607 --- /dev/null +++ b/docs-gb/api/mlserver/metrics.md @@ -0,0 +1,2 @@ +# Module `mlserver.metrics` + diff --git a/docs-gb/api/mlserver/metrics/context.md b/docs-gb/api/mlserver/metrics/context.md new file mode 100644 index 000000000..23307b27c --- /dev/null +++ b/docs-gb/api/mlserver/metrics/context.md @@ -0,0 +1,25 @@ +# Module `mlserver.metrics.context` + + +## Function `log` + + +**Signature:** `log(**metrics)` + + +**Description:** +Logs a new set of metric values. +Each kwarg of this method will be treated as a separate metric / value +pair. +If any of the metrics does not exist, a new one will be created with a +default description. + +## Function `register` + + +**Signature:** `register(name: str, description: str) -> prometheus_client.metrics.Histogram` + + +**Description:** +Registers a new metric with its description. +If the metric already exists, it will just return the existing one. diff --git a/docs-gb/api/mlserver/metrics/errors.md b/docs-gb/api/mlserver/metrics/errors.md new file mode 100644 index 000000000..4fdcc0548 --- /dev/null +++ b/docs-gb/api/mlserver/metrics/errors.md @@ -0,0 +1,14 @@ +# Module `mlserver.metrics.errors` + + +## Class `InvalidModelContext` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `MetricNotFound` + + +**Description:** +Common base class for all non-exit exceptions. diff --git a/docs-gb/api/mlserver/metrics/logging.md b/docs-gb/api/mlserver/metrics/logging.md new file mode 100644 index 000000000..cfdd14ab9 --- /dev/null +++ b/docs-gb/api/mlserver/metrics/logging.md @@ -0,0 +1,2 @@ +# Module `mlserver.metrics.logging` + diff --git a/docs-gb/api/mlserver/metrics/prometheus.md b/docs-gb/api/mlserver/metrics/prometheus.md new file mode 100644 index 000000000..ae498258a --- /dev/null +++ b/docs-gb/api/mlserver/metrics/prometheus.md @@ -0,0 +1,35 @@ +# Module `mlserver.metrics.prometheus` + + +## Class `PrometheusEndpoint` + + +**Description:** +*No docstring available.* + +### Method `handle_metrics` + + +**Signature:** `handle_metrics(self, req: starlette.requests.Request) -> starlette.responses.Response` + + +**Description:** +*No docstring available.* + +## Function `configure_metrics` + + +**Signature:** `configure_metrics(settings: mlserver.settings.Settings)` + + +**Description:** +*No docstring available.* + +## Function `stop_metrics` + + +**Signature:** `stop_metrics(settings: mlserver.settings.Settings, pid: int)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/metrics/registry.md b/docs-gb/api/mlserver/metrics/registry.md new file mode 100644 index 000000000..312930876 --- /dev/null +++ b/docs-gb/api/mlserver/metrics/registry.md @@ -0,0 +1,97 @@ +# Module `mlserver.metrics.registry` + + +## Class `MetricsRegistry` + + +**Description:** +Keep track of registered metrics to allow reusing them. + +### Method `collect` + + +**Signature:** `collect(self) -> Iterable[prometheus_client.metrics_core.Metric]` + + +**Description:** +Yields metrics from the collectors in the registry. + +### Method `exists` + + +**Signature:** `exists(self, metric_name: str) -> bool` + + +**Description:** +*No docstring available.* + +### Method `get` + + +**Signature:** `get(self, metric_name: str) -> prometheus_client.metrics.MetricWrapperBase` + + +**Description:** +*No docstring available.* + +### Method `get_sample_value` + + +**Signature:** `get_sample_value(self, name: str, labels: Optional[Dict[str, str]] = None) -> Optional[float]` + + +**Description:** +Returns the sample value, or None if not found. +This is inefficient, and intended only for use in unittests. + +### Method `get_target_info` + + +**Signature:** `get_target_info(self) -> Optional[Dict[str, str]]` + + +**Description:** +*No docstring available.* + +### Method `register` + + +**Signature:** `register(self, collector: prometheus_client.registry.Collector) -> None` + + +**Description:** +Add a collector to the registry. + +### Method `restricted_registry` + + +**Signature:** `restricted_registry(self, names: Iterable[str]) -> 'RestrictedRegistry'` + + +**Description:** +Returns object that only collects some metrics. +Returns an object which upon collect() will return +only samples with the given names. + +Intended usage is: + generate_latest(REGISTRY.restricted_registry(['a_timeseries'])) + +Experimental. + +### Method `set_target_info` + + +**Signature:** `set_target_info(self, labels: Optional[Dict[str, str]]) -> None` + + +**Description:** +*No docstring available.* + +### Method `unregister` + + +**Signature:** `unregister(self, collector: prometheus_client.registry.Collector) -> None` + + +**Description:** +Remove a collector from the registry. diff --git a/docs-gb/api/mlserver/metrics/server.md b/docs-gb/api/mlserver/metrics/server.md new file mode 100644 index 000000000..2ffcd3861 --- /dev/null +++ b/docs-gb/api/mlserver/metrics/server.md @@ -0,0 +1,35 @@ +# Module `mlserver.metrics.server` + + +## Class `MetricsServer` + + +**Description:** +*No docstring available.* + +### Method `on_worker_stop` + + +**Signature:** `on_worker_stop(self, worker: 'Worker') -> None` + + +**Description:** +*No docstring available.* + +### Method `start` + + +**Signature:** `start(self)` + + +**Description:** +*No docstring available.* + +### Method `stop` + + +**Signature:** `stop(self, sig: Optional[int] = None)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/middleware.md b/docs-gb/api/mlserver/middleware.md new file mode 100644 index 000000000..33c4aa157 --- /dev/null +++ b/docs-gb/api/mlserver/middleware.md @@ -0,0 +1,50 @@ +# Module `mlserver.middleware` + + +## Class `InferenceMiddleware` + + +**Description:** +Base class to implement middlewares. + +### Method `request_middleware` + + +**Signature:** `request_middleware(self, request: mlserver.types.dataplane.InferenceRequest, model_settings: mlserver.settings.ModelSettings) -> mlserver.types.dataplane.InferenceRequest` + + +**Description:** +*No docstring available.* + +### Method `response_middleware` + + +**Signature:** `response_middleware(self, response: mlserver.types.dataplane.InferenceResponse, model_settings: mlserver.settings.ModelSettings) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +*No docstring available.* + +## Class `InferenceMiddlewares` + + +**Description:** +Meta-middleware which applies a list of middlewares. + +### Method `request_middleware` + + +**Signature:** `request_middleware(self, request: mlserver.types.dataplane.InferenceRequest, model_settings: mlserver.settings.ModelSettings) -> mlserver.types.dataplane.InferenceRequest` + + +**Description:** +*No docstring available.* + +### Method `response_middleware` + + +**Signature:** `response_middleware(self, response: mlserver.types.dataplane.InferenceResponse, model_settings: mlserver.settings.ModelSettings) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/model.md b/docs-gb/api/mlserver/model.md new file mode 100644 index 000000000..7aa2e3fe0 --- /dev/null +++ b/docs-gb/api/mlserver/model.md @@ -0,0 +1,123 @@ +# Module `mlserver.model` + + +## Class `MLModel` + + +**Description:** +Abstract inference runtime which exposes the main interface to interact +with ML models. + +### Method `decode` + + +**Signature:** `decode(self, request_input: mlserver.types.dataplane.RequestInput, default_codec: Union[Type[ForwardRef('InputCodec')], ForwardRef('InputCodec'), NoneType] = None) -> Any` + + +**Description:** +Helper to decode a **request input** into its corresponding high-level +Python object. +This method will find the most appropiate :doc:`input codec +` based on the model's metadata and the +input's content type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `decode_request` + + +**Signature:** `decode_request(self, inference_request: mlserver.types.dataplane.InferenceRequest, default_codec: Union[Type[ForwardRef('RequestCodec')], ForwardRef('RequestCodec'), NoneType] = None) -> Any` + + +**Description:** +Helper to decode an **inference request** into its corresponding +high-level Python object. +This method will find the most appropiate :doc:`request codec +` based on the model's metadata and the +requests's content type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `encode` + + +**Signature:** `encode(self, payload: Any, request_output: mlserver.types.dataplane.RequestOutput, default_codec: Union[Type[ForwardRef('InputCodec')], ForwardRef('InputCodec'), NoneType] = None) -> mlserver.types.dataplane.ResponseOutput` + + +**Description:** +Helper to encode a high-level Python object into its corresponding +**response output**. +This method will find the most appropiate :doc:`input codec +` based on the model's metadata, request +output's content type or payload's type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `encode_response` + + +**Signature:** `encode_response(self, payload: Any, default_codec: Union[Type[ForwardRef('RequestCodec')], ForwardRef('RequestCodec'), NoneType] = None) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +Helper to encode a high-level Python object into its corresponding +**inference response**. +This method will find the most appropiate :doc:`request codec +` based on the payload's type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `load` + + +**Signature:** `load(self) -> bool` + + +**Description:** +Method responsible for loading the model from a model artefact. +This method will be called on each of the parallel workers (when + +### Method `metadata` + + +**Signature:** `metadata(self) -> mlserver.types.dataplane.MetadataModelResponse` + + +**Description:** +*No docstring available.* + +### Method `predict` + + +**Signature:** `predict(self, payload: mlserver.types.dataplane.InferenceRequest) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +Method responsible for running inference on the model. +**This method can be overriden to implement your custom inference +logic.** + +### Method `predict_stream` + + +**Signature:** `predict_stream(self, payloads: AsyncIterator[mlserver.types.dataplane.InferenceRequest]) -> AsyncIterator[mlserver.types.dataplane.InferenceResponse]` + + +**Description:** +Method responsible for running generation on the model, streaming a set +of responses back to the client. + + +**This method can be overriden to implement your custom inference +logic.** + +### Method `unload` + + +**Signature:** `unload(self) -> bool` + + +**Description:** +Method responsible for unloading the model, freeing any resources (e.g. +CPU memory, GPU memory, etc.). +This method will be called on each of the parallel workers (when diff --git a/docs-gb/api/mlserver/parallel.md b/docs-gb/api/mlserver/parallel.md new file mode 100644 index 000000000..0ae7c51c3 --- /dev/null +++ b/docs-gb/api/mlserver/parallel.md @@ -0,0 +1,2 @@ +# Module `mlserver.parallel` + diff --git a/docs-gb/api/mlserver/parallel/dispatcher.md b/docs-gb/api/mlserver/parallel/dispatcher.md new file mode 100644 index 000000000..6f9ac6c7f --- /dev/null +++ b/docs-gb/api/mlserver/parallel/dispatcher.md @@ -0,0 +1,118 @@ +# Module `mlserver.parallel.dispatcher` + + +## Class `AsyncResponses` + + +**Description:** +*No docstring available.* + +### Method `cancel` + + +**Signature:** `cancel(self, worker: mlserver.parallel.worker.Worker, exit_code: int)` + + +**Description:** +Cancel in-flight requests for worker (e.g. because it died +unexpectedly). + +### Method `resolve` + + +**Signature:** `resolve(self, response: mlserver.parallel.messages.ModelResponseMessage)` + + +**Description:** +Resolve a previously scheduled response future. + +### Method `schedule_and_wait` + + +**Signature:** `schedule_and_wait(self, message: mlserver.parallel.messages.Message, worker: mlserver.parallel.worker.Worker) -> mlserver.parallel.messages.ModelResponseMessage` + + +**Description:** +Schedule a response and wait until it gets resolved. + +## Class `Dispatcher` + + +**Description:** +*No docstring available.* + +### Method `dispatch_request` + + +**Signature:** `dispatch_request(self, request_message: mlserver.parallel.messages.ModelRequestMessage) -> mlserver.parallel.messages.ModelResponseMessage` + + +**Description:** +*No docstring available.* + +### Method `dispatch_update` + + +**Signature:** `dispatch_update(self, model_update: mlserver.parallel.messages.ModelUpdateMessage) -> List[mlserver.parallel.messages.ModelResponseMessage]` + + +**Description:** +*No docstring available.* + +### Method `dispatch_update_to_worker` + + +**Signature:** `dispatch_update_to_worker(self, worker: mlserver.parallel.worker.Worker, model_update: mlserver.parallel.messages.ModelUpdateMessage) -> mlserver.parallel.messages.ModelResponseMessage` + + +**Description:** +*No docstring available.* + +### Method `on_worker_ready` + + +**Signature:** `on_worker_ready(self, worker: mlserver.parallel.worker.Worker)` + + +**Description:** +Handler for workers who are now ready to receive traffic. + +### Method `on_worker_start` + + +**Signature:** `on_worker_start(self, worker: mlserver.parallel.worker.Worker)` + + +**Description:** +Handler for workers who have just started but are still not ready to +receive traffic. +This is used for workers that got restarted and need to reload all +models. + +### Method `on_worker_stop` + + +**Signature:** `on_worker_stop(self, worker: mlserver.parallel.worker.Worker, exit_code: int)` + + +**Description:** +Handler used for workers who stopped unexpectedly and there need to be +removed from the round robin rotation. + +### Method `start` + + +**Signature:** `start(self)` + + +**Description:** +*No docstring available.* + +### Method `stop` + + +**Signature:** `stop(self)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/parallel/errors.md b/docs-gb/api/mlserver/parallel/errors.md new file mode 100644 index 000000000..64bbe2b73 --- /dev/null +++ b/docs-gb/api/mlserver/parallel/errors.md @@ -0,0 +1,24 @@ +# Module `mlserver.parallel.errors` + + +## Class `EnvironmentNotFound` + + +**Description:** +Common base class for all non-exit exceptions. + +## Class `WorkerError` + + +**Description:** +Class used to wrap exceptions raised from the workers. +All stacktrace details will be hidden, and the original class won't be +returned. This is to avoid issues with custom exceptions, like: + + https://github.com/SeldonIO/MLServer/issues/881 + +## Class `WorkerStop` + + +**Description:** +Common base class for all non-exit exceptions. diff --git a/docs-gb/api/mlserver/parallel/logging.md b/docs-gb/api/mlserver/parallel/logging.md new file mode 100644 index 000000000..977a777be --- /dev/null +++ b/docs-gb/api/mlserver/parallel/logging.md @@ -0,0 +1,2 @@ +# Module `mlserver.parallel.logging` + diff --git a/docs-gb/api/mlserver/parallel/messages.md b/docs-gb/api/mlserver/parallel/messages.md new file mode 100644 index 000000000..d4a2e78b8 --- /dev/null +++ b/docs-gb/api/mlserver/parallel/messages.md @@ -0,0 +1,716 @@ +# Module `mlserver.parallel.messages` + + +## Class `Message` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `ModelRequestMessage` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `ModelResponseMessage` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `ModelUpdateMessage` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `ModelUpdateType` + + +**Description:** +Enum where members are also (and must be) ints diff --git a/docs-gb/api/mlserver/parallel/model.md b/docs-gb/api/mlserver/parallel/model.md new file mode 100644 index 000000000..06b81f0d9 --- /dev/null +++ b/docs-gb/api/mlserver/parallel/model.md @@ -0,0 +1,163 @@ +# Module `mlserver.parallel.model` + + +## Class `ModelMethods` + + +**Description:** +Create a collection of name/value pairs. +Example enumeration: + +>>> class Color(Enum): +... RED = 1 +... BLUE = 2 +... GREEN = 3 + +Access them by: + +- attribute access: + + >>> Color.RED + + +- value lookup: + + >>> Color(1) + + +- name lookup: + + >>> Color['RED'] + + +Enumerations can be iterated over, and know how many members they have: + +>>> len(Color) +3 + +>>> list(Color) +[, , ] + +Methods can be added to enumerations, and members can have their own +attributes -- see the documentation for details. + +## Class `ParallelModel` + + +**Description:** +Abstract inference runtime which exposes the main interface to interact +with ML models. + +### Method `decode` + + +**Signature:** `decode(self, request_input: mlserver.types.dataplane.RequestInput, default_codec: Union[Type[ForwardRef('InputCodec')], ForwardRef('InputCodec'), NoneType] = None) -> Any` + + +**Description:** +Helper to decode a **request input** into its corresponding high-level +Python object. +This method will find the most appropiate :doc:`input codec +` based on the model's metadata and the +input's content type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `decode_request` + + +**Signature:** `decode_request(self, inference_request: mlserver.types.dataplane.InferenceRequest, default_codec: Union[Type[ForwardRef('RequestCodec')], ForwardRef('RequestCodec'), NoneType] = None) -> Any` + + +**Description:** +Helper to decode an **inference request** into its corresponding +high-level Python object. +This method will find the most appropiate :doc:`request codec +` based on the model's metadata and the +requests's content type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `encode` + + +**Signature:** `encode(self, payload: Any, request_output: mlserver.types.dataplane.RequestOutput, default_codec: Union[Type[ForwardRef('InputCodec')], ForwardRef('InputCodec'), NoneType] = None) -> mlserver.types.dataplane.ResponseOutput` + + +**Description:** +Helper to encode a high-level Python object into its corresponding +**response output**. +This method will find the most appropiate :doc:`input codec +` based on the model's metadata, request +output's content type or payload's type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `encode_response` + + +**Signature:** `encode_response(self, payload: Any, default_codec: Union[Type[ForwardRef('RequestCodec')], ForwardRef('RequestCodec'), NoneType] = None) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +Helper to encode a high-level Python object into its corresponding +**inference response**. +This method will find the most appropiate :doc:`request codec +` based on the payload's type. +Otherwise, it will fall back to the codec specified in the +``default_codec`` kwarg. + +### Method `load` + + +**Signature:** `load(self) -> bool` + + +**Description:** +Method responsible for loading the model from a model artefact. +This method will be called on each of the parallel workers (when + +### Method `metadata` + + +**Signature:** `metadata(self) -> mlserver.types.dataplane.MetadataModelResponse` + + +**Description:** +*No docstring available.* + +### Method `predict` + + +**Signature:** `predict(self, payload: mlserver.types.dataplane.InferenceRequest) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +Method responsible for running inference on the model. +**This method can be overriden to implement your custom inference +logic.** + +### Method `predict_stream` + + +**Signature:** `predict_stream(self, payloads: AsyncIterator[mlserver.types.dataplane.InferenceRequest]) -> AsyncIterator[mlserver.types.dataplane.InferenceResponse]` + + +**Description:** +Method responsible for running generation on the model, streaming a set +of responses back to the client. + + +**This method can be overriden to implement your custom inference +logic.** + +### Method `unload` + + +**Signature:** `unload(self) -> bool` + + +**Description:** +Method responsible for unloading the model, freeing any resources (e.g. +CPU memory, GPU memory, etc.). +This method will be called on each of the parallel workers (when diff --git a/docs-gb/api/mlserver/parallel/pool.md b/docs-gb/api/mlserver/parallel/pool.md new file mode 100644 index 000000000..10934381a --- /dev/null +++ b/docs-gb/api/mlserver/parallel/pool.md @@ -0,0 +1,93 @@ +# Module `mlserver.parallel.pool` + + +## Class `InferencePool` + + +**Description:** +The InferencePool class represents a pool of workers where we can run +inference on. + +Under the hood, it's responsible for managing a pool of multiprocessing +workers, where the model is loaded. +This approach lets MLServer work around the GIL to make sure that inference +can occur in parallel across multiple models or instances of a model. + +### Method `close` + + +**Signature:** `close(self)` + + +**Description:** +*No docstring available.* + +### Method `empty` + + +**Signature:** `empty(self) -> bool` + + +**Description:** +*No docstring available.* + +### Method `load_model` + + +**Signature:** `load_model(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `on_worker_stop` + + +**Signature:** `on_worker_stop(self, pid: int, exit_code: int)` + + +**Description:** +*No docstring available.* + +### Method `reload_model` + + +**Signature:** `reload_model(self, old_model: mlserver.model.MLModel, new_model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `unload_model` + + +**Signature:** `unload_model(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +## Class `WorkerRegistry` + + +**Description:** +Simple registry to keep track of which models have been loaded. +This can be used to re-load all models when a worker stops unexpectedly. + +### Method `add` + + +**Signature:** `add(self, model_settings: mlserver.settings.ModelSettings)` + + +**Description:** +*No docstring available.* + +### Method `remove` + + +**Signature:** `remove(self, model_settings: mlserver.settings.ModelSettings)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/parallel/registry.md b/docs-gb/api/mlserver/parallel/registry.md new file mode 100644 index 000000000..b0de12ff1 --- /dev/null +++ b/docs-gb/api/mlserver/parallel/registry.md @@ -0,0 +1,54 @@ +# Module `mlserver.parallel.registry` + + +## Class `InferencePoolRegistry` + + +**Description:** +Keeps track of the different inference pools loaded in the server. +Each inference pool will generally be used to load a different environment. + +### Method `close` + + +**Signature:** `close(self)` + + +**Description:** +*No docstring available.* + +### Method `load_model` + + +**Signature:** `load_model(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `model_initialiser` + + +**Signature:** `model_initialiser(self, model_settings: mlserver.settings.ModelSettings) -> mlserver.model.MLModel` + + +**Description:** +Used to initialise a model object in the ModelRegistry. + +### Method `reload_model` + + +**Signature:** `reload_model(self, old_model: mlserver.model.MLModel, new_model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `unload_model` + + +**Signature:** `unload_model(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/parallel/utils.md b/docs-gb/api/mlserver/parallel/utils.md new file mode 100644 index 000000000..9b210e021 --- /dev/null +++ b/docs-gb/api/mlserver/parallel/utils.md @@ -0,0 +1,29 @@ +# Module `mlserver.parallel.utils` + + +## Function `cancel_task` + + +**Signature:** `cancel_task(task: _asyncio.Task)` + + +**Description:** +*No docstring available.* + +## Function `configure_inference_pool` + + +**Signature:** `configure_inference_pool(settings: mlserver.settings.Settings)` + + +**Description:** +*No docstring available.* + +## Function `terminate_queue` + + +**Signature:** `terminate_queue(queue: >)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/parallel/worker.md b/docs-gb/api/mlserver/parallel/worker.md new file mode 100644 index 000000000..379eeabc3 --- /dev/null +++ b/docs-gb/api/mlserver/parallel/worker.md @@ -0,0 +1,113 @@ +# Module `mlserver.parallel.worker` + + +## Class `Worker` + + +**Description:** +Process objects represent activity that is run in a separate process +The class is analogous to `threading.Thread` + +### Method `close` + + +**Signature:** `close(self)` + + +**Description:** +Close the Process object. +This method releases resources held by the Process object. It is +an error to call this method if the child process is still running. + +### Method `coro_run` + + +**Signature:** `coro_run(self)` + + +**Description:** +*No docstring available.* + +### Method `is_alive` + + +**Signature:** `is_alive(self)` + + +**Description:** +Return whether process is alive + +### Method `join` + + +**Signature:** `join(self, timeout=None)` + + +**Description:** +Wait until child process terminates + +### Method `kill` + + +**Signature:** `kill(self)` + + +**Description:** +Terminate process; sends SIGKILL signal or uses TerminateProcess() + +### Method `run` + + +**Signature:** `run(self)` + + +**Description:** +Method to be run in sub-process; can be overridden in sub-class + +### Method `send_request` + + +**Signature:** `send_request(self, request_message: mlserver.parallel.messages.ModelRequestMessage)` + + +**Description:** +Send an inference request message to the worker. +Note that this method should be both multiprocess- and thread-safe. + +### Method `send_update` + + +**Signature:** `send_update(self, model_update: mlserver.parallel.messages.ModelUpdateMessage)` + + +**Description:** +Send a model update to the worker. +Note that this method should be both multiprocess- and thread-safe. + +### Method `start` + + +**Signature:** `start(self)` + + +**Description:** +Start child process + +### Method `stop` + + +**Signature:** `stop(self)` + + +**Description:** +Close the worker's main loop. +Note that this method should be both multiprocess- and thread-safe. + +### Method `terminate` + + +**Signature:** `terminate(self)` + + +**Description:** +Terminate process; sends SIGTERM signal or uses TerminateProcess() diff --git a/docs-gb/api/mlserver/raw.md b/docs-gb/api/mlserver/raw.md new file mode 100644 index 000000000..53fa2a000 --- /dev/null +++ b/docs-gb/api/mlserver/raw.md @@ -0,0 +1,38 @@ +# Module `mlserver.raw` + + +## Function `extract_raw` + + +**Signature:** `extract_raw(elems: List[Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]]) -> Tuple[List[Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]], List[bytes]]` + + +**Description:** +*No docstring available.* + +## Function `inject_raw` + + +**Signature:** `inject_raw(elems: List[Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]], raw_contents: List[bytes]) -> List[Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]]` + + +**Description:** +*No docstring available.* + +## Function `pack` + + +**Signature:** `pack(elem: Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput]) -> bytes` + + +**Description:** +*No docstring available.* + +## Function `unpack` + + +**Signature:** `unpack(elem: Union[mlserver.types.dataplane.RequestInput, mlserver.types.dataplane.ResponseOutput], raw: bytes) -> list` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/registry.md b/docs-gb/api/mlserver/registry.md new file mode 100644 index 000000000..2f3db2944 --- /dev/null +++ b/docs-gb/api/mlserver/registry.md @@ -0,0 +1,122 @@ +# Module `mlserver.registry` + + +## Class `MultiModelRegistry` + + +**Description:** +Multiple model registry, where each model can have multiple versions. + +### Method `get_model` + + +**Signature:** `get_model(self, name: str, version: Optional[str] = None) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `get_models` + + +**Signature:** `get_models(self, name: Optional[str] = None) -> List[mlserver.model.MLModel]` + + +**Description:** +*No docstring available.* + +### Method `load` + + +**Signature:** `load(self, model_settings: mlserver.settings.ModelSettings) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `unload` + + +**Signature:** `unload(self, name: str)` + + +**Description:** +*No docstring available.* + +### Method `unload_version` + + +**Signature:** `unload_version(self, name: str, version: Optional[str] = None)` + + +**Description:** +*No docstring available.* + +## Class `SingleModelRegistry` + + +**Description:** +Registry for a single model with multiple versions. + +### Method `empty` + + +**Signature:** `empty(self) -> bool` + + +**Description:** +*No docstring available.* + +### Method `get_model` + + +**Signature:** `get_model(self, version: Optional[str] = None) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `get_models` + + +**Signature:** `get_models(self) -> List[mlserver.model.MLModel]` + + +**Description:** +*No docstring available.* + +### Method `load` + + +**Signature:** `load(self, model_settings: mlserver.settings.ModelSettings) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `unload` + + +**Signature:** `unload(self)` + + +**Description:** +*No docstring available.* + +### Method `unload_version` + + +**Signature:** `unload_version(self, version: Optional[str] = None)` + + +**Description:** +*No docstring available.* + +## Function `model_initialiser` + + +**Signature:** `model_initialiser(model_settings: mlserver.settings.ModelSettings) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/repository.md b/docs-gb/api/mlserver/repository.md new file mode 100644 index 000000000..e37a84c5d --- /dev/null +++ b/docs-gb/api/mlserver/repository.md @@ -0,0 +1,2 @@ +# Module `mlserver.repository` + diff --git a/docs-gb/api/mlserver/repository/factory.md b/docs-gb/api/mlserver/repository/factory.md new file mode 100644 index 000000000..8ce1b762e --- /dev/null +++ b/docs-gb/api/mlserver/repository/factory.md @@ -0,0 +1,17 @@ +# Module `mlserver.repository.factory` + + +## Class `ModelRepositoryFactory` + + +**Description:** +*No docstring available.* + +### Method `resolve_model_repository` + + +**Signature:** `resolve_model_repository(settings: mlserver.settings.Settings) -> mlserver.repository.repository.ModelRepository` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/repository/load.md b/docs-gb/api/mlserver/repository/load.md new file mode 100644 index 000000000..2b3af1483 --- /dev/null +++ b/docs-gb/api/mlserver/repository/load.md @@ -0,0 +1,11 @@ +# Module `mlserver.repository.load` + + +## Function `load_model_settings` + + +**Signature:** `load_model_settings(model_settings_path: str) -> mlserver.settings.ModelSettings` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/repository/repository.md b/docs-gb/api/mlserver/repository/repository.md new file mode 100644 index 000000000..97890fe0e --- /dev/null +++ b/docs-gb/api/mlserver/repository/repository.md @@ -0,0 +1,51 @@ +# Module `mlserver.repository.repository` + + +## Class `ModelRepository` + + +**Description:** +*No docstring available.* + +### Method `find` + + +**Signature:** `find(self, name: str) -> List[mlserver.settings.ModelSettings]` + + +**Description:** +*No docstring available.* + +### Method `list` + + +**Signature:** `list(self) -> List[mlserver.settings.ModelSettings]` + + +**Description:** +*No docstring available.* + +## Class `SchemalessModelRepository` + + +**Description:** +Model repository, responsible of the discovery of models which can be +loaded onto the model registry. + +### Method `find` + + +**Signature:** `find(self, name: str) -> List[mlserver.settings.ModelSettings]` + + +**Description:** +*No docstring available.* + +### Method `list` + + +**Signature:** `list(self) -> List[mlserver.settings.ModelSettings]` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest.md b/docs-gb/api/mlserver/rest.md new file mode 100644 index 000000000..5bf47bc22 --- /dev/null +++ b/docs-gb/api/mlserver/rest.md @@ -0,0 +1,2 @@ +# Module `mlserver.rest` + diff --git a/docs-gb/api/mlserver/rest/app.md b/docs-gb/api/mlserver/rest/app.md new file mode 100644 index 000000000..0e70df388 --- /dev/null +++ b/docs-gb/api/mlserver/rest/app.md @@ -0,0 +1,53 @@ +# Module `mlserver.rest.app` + + +## Class `APIRoute` + + +**Description:** +Custom route to use our own Request handler. + +### Method `get_route_handler` + + +**Signature:** `get_route_handler(self) -> Callable` + + +**Description:** +*No docstring available.* + +### Method `handle` + + +**Signature:** `handle(self, scope: 'Scope', receive: 'Receive', send: 'Send') -> 'None'` + + +**Description:** +*No docstring available.* + +### Method `matches` + + +**Signature:** `matches(self, scope: collections.abc.MutableMapping[str, typing.Any]) -> Tuple[starlette.routing.Match, collections.abc.MutableMapping[str, Any]]` + + +**Description:** +*No docstring available.* + +### Method `url_path_for` + + +**Signature:** `url_path_for(self, name: 'str', /, **path_params: 'Any') -> 'URLPath'` + + +**Description:** +*No docstring available.* + +## Function `create_app` + + +**Signature:** `create_app(settings: mlserver.settings.Settings, data_plane: mlserver.handlers.dataplane.DataPlane, model_repository_handlers: mlserver.handlers.model_repository.ModelRepositoryHandlers) -> fastapi.applications.FastAPI` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/endpoints.md b/docs-gb/api/mlserver/rest/endpoints.md new file mode 100644 index 000000000..d3bc76e9a --- /dev/null +++ b/docs-gb/api/mlserver/rest/endpoints.md @@ -0,0 +1,142 @@ +# Module `mlserver.rest.endpoints` + + +## Class `Endpoints` + + +**Description:** +Implementation of REST endpoints. +These take care of the REST/HTTP-specific things and then delegate the +business logic to the internal handlers. + +### Method `docs` + + +**Signature:** `docs(self) -> starlette.responses.HTMLResponse` + + +**Description:** +*No docstring available.* + +### Method `infer` + + +**Signature:** `infer(self, raw_request: starlette.requests.Request, raw_response: starlette.responses.Response, payload: mlserver.types.dataplane.InferenceRequest, model_name: str, model_version: Optional[str] = None) -> mlserver.types.dataplane.InferenceResponse` + + +**Description:** +*No docstring available.* + +### Method `infer_stream` + + +**Signature:** `infer_stream(self, raw_request: starlette.requests.Request, payload: mlserver.types.dataplane.InferenceRequest, model_name: str, model_version: Optional[str] = None) -> starlette.responses.StreamingResponse` + + +**Description:** +*No docstring available.* + +### Method `live` + + +**Signature:** `live(self) -> starlette.responses.Response` + + +**Description:** +*No docstring available.* + +### Method `metadata` + + +**Signature:** `metadata(self) -> mlserver.types.dataplane.MetadataServerResponse` + + +**Description:** +*No docstring available.* + +### Method `model_docs` + + +**Signature:** `model_docs(self, model_name: str, model_version: Optional[str] = None) -> starlette.responses.HTMLResponse` + + +**Description:** +*No docstring available.* + +### Method `model_metadata` + + +**Signature:** `model_metadata(self, model_name: str, model_version: Optional[str] = None) -> mlserver.types.dataplane.MetadataModelResponse` + + +**Description:** +*No docstring available.* + +### Method `model_openapi` + + +**Signature:** `model_openapi(self, model_name: str, model_version: Optional[str] = None) -> dict` + + +**Description:** +*No docstring available.* + +### Method `model_ready` + + +**Signature:** `model_ready(self, model_name: str, model_version: Optional[str] = None) -> starlette.responses.Response` + + +**Description:** +*No docstring available.* + +### Method `openapi` + + +**Signature:** `openapi(self) -> dict` + + +**Description:** +*No docstring available.* + +### Method `ready` + + +**Signature:** `ready(self) -> starlette.responses.Response` + + +**Description:** +*No docstring available.* + +## Class `ModelRepositoryEndpoints` + + +**Description:** +*No docstring available.* + +### Method `index` + + +**Signature:** `index(self, payload: mlserver.types.model_repository.RepositoryIndexRequest) -> mlserver.types.model_repository.RepositoryIndexResponse` + + +**Description:** +*No docstring available.* + +### Method `load` + + +**Signature:** `load(self, model_name: str) -> starlette.responses.Response` + + +**Description:** +*No docstring available.* + +### Method `unload` + + +**Signature:** `unload(self, model_name: str) -> starlette.responses.Response` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/errors.md b/docs-gb/api/mlserver/rest/errors.md new file mode 100644 index 000000000..02d2e7a70 --- /dev/null +++ b/docs-gb/api/mlserver/rest/errors.md @@ -0,0 +1,188 @@ +# Module `mlserver.rest.errors` + + +## Class `APIErrorResponse` + + +**Description:** +!!! abstract "Usage Documentation" +[Models](../concepts/models.md) + +A base class for creating Pydantic models. + +**Parameters:** +- `__class_vars__` (unknown): The names of the class variables defined on the model. +- `__private_attributes__` (unknown): Metadata about the private attributes of the model. +- `__signature__` (unknown): The synthesized `__init__` [`Signature`][inspect.Signature] of the model. +- `__pydantic_complete__` (unknown): Whether model building is completed, or if there are still undefined fields. +- `__pydantic_core_schema__` (unknown): The core schema of the model. +- `__pydantic_custom_init__` (unknown): Whether the model has a custom `__init__` function. +- `__pydantic_decorators__` (unknown): Metadata containing the decorators defined on the model. +This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1. +- `__pydantic_generic_metadata__` (unknown): Metadata for generic models; contains data used for a similar purpose to +__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these. +- `__pydantic_parent_namespace__` (unknown): Parent namespace of the model, used for automatic rebuilding of models. +- `__pydantic_post_init__` (unknown): The name of the post-init method for the model, if defined. +- `__pydantic_root_model__` (unknown): Whether the model is a [`RootModel`][pydantic.root_model.RootModel]. +- `__pydantic_serializer__` (unknown): The `pydantic-core` `SchemaSerializer` used to dump instances of the model. +- `__pydantic_validator__` (unknown): The `pydantic-core` `SchemaValidator` used to validate instances of the model. +- `__pydantic_fields__` (unknown): A dictionary of field names and their corresponding [`FieldInfo`][pydantic.fields.FieldInfo] objects. +- `__pydantic_computed_fields__` (unknown): A dictionary of computed field names and their corresponding [`ComputedFieldInfo`][pydantic.fields.ComputedFieldInfo] objects. +- `__pydantic_extra__` (unknown): A dictionary containing extra values, if [`extra`][pydantic.config.ConfigDict.extra] +is set to `'allow'`. +- `__pydantic_fields_set__` (unknown): The names of fields explicitly set during instantiation. +- `__pydantic_private__` (unknown): Values of private attributes set on the model instance. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Function `handle_mlserver_error` + + +**Signature:** `handle_mlserver_error(request: starlette.requests.Request, exc: mlserver.errors.MLServerError) -> mlserver.rest.responses.Response` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/logging.md b/docs-gb/api/mlserver/rest/logging.md new file mode 100644 index 000000000..4b56dfd08 --- /dev/null +++ b/docs-gb/api/mlserver/rest/logging.md @@ -0,0 +1,30 @@ +# Module `mlserver.rest.logging` + + +## Class `HealthEndpointFilter` + + +**Description:** +Filter to avoid logging health endpoints. +From: + https://github.com/encode/starlette/issues/864#issuecomment-653076434 + +### Method `filter` + + +**Signature:** `filter(self, record: logging.LogRecord) -> bool` + + +**Description:** +Determine if the specified record is to be logged. +Returns True if the record should be logged, or False otherwise. +If deemed appropriate, the record may be modified in-place. + +## Function `disable_health_access_logs` + + +**Signature:** `disable_health_access_logs() -> None` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/openapi.md b/docs-gb/api/mlserver/rest/openapi.md new file mode 100644 index 000000000..b1b8f3a9b --- /dev/null +++ b/docs-gb/api/mlserver/rest/openapi.md @@ -0,0 +1,2 @@ +# Module `mlserver.rest.openapi` + diff --git a/docs-gb/api/mlserver/rest/openapi/schema.md b/docs-gb/api/mlserver/rest/openapi/schema.md new file mode 100644 index 000000000..a9ad2eb4f --- /dev/null +++ b/docs-gb/api/mlserver/rest/openapi/schema.md @@ -0,0 +1,11 @@ +# Module `mlserver.rest.openapi.schema` + + +## Function `get_model_schema_uri` + + +**Signature:** `get_model_schema_uri(model_name: str, model_version: Optional[str]) -> str` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/requests.md b/docs-gb/api/mlserver/rest/requests.md new file mode 100644 index 000000000..708f6ce8b --- /dev/null +++ b/docs-gb/api/mlserver/rest/requests.md @@ -0,0 +1,117 @@ +# Module `mlserver.rest.requests` + + +## Class `Request` + + +**Description:** +Custom request class which uses `orjson` if present. +Otherwise, it falls back to the standard FastAPI request. + +### Method `body` + + +**Signature:** `body(self) -> bytes` + + +**Description:** +*No docstring available.* + +### Method `close` + + +**Signature:** `close(self) -> 'None'` + + +**Description:** +*No docstring available.* + +### Method `form` + + +**Signature:** `form(self, *, max_files: 'int | float' = 1000, max_fields: 'int | float' = 1000, max_part_size: 'int' = 1048576) -> 'AwaitableOrContextManager[FormData]'` + + +**Description:** +*No docstring available.* + +### Method `get` + + +**Signature:** `get(self, key, default=None)` + + +**Description:** +D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. + +### Method `is_disconnected` + + +**Signature:** `is_disconnected(self) -> 'bool'` + + +**Description:** +*No docstring available.* + +### Method `items` + + +**Signature:** `items(self)` + + +**Description:** +D.items() -> a set-like object providing a view on D's items + +### Method `json` + + +**Signature:** `json(self) -> Any` + + +**Description:** +*No docstring available.* + +### Method `keys` + + +**Signature:** `keys(self)` + + +**Description:** +D.keys() -> a set-like object providing a view on D's keys + +### Method `send_push_promise` + + +**Signature:** `send_push_promise(self, path: 'str') -> 'None'` + + +**Description:** +*No docstring available.* + +### Method `stream` + + +**Signature:** `stream(self) -> 'AsyncGenerator[bytes, None]'` + + +**Description:** +*No docstring available.* + +### Method `url_for` + + +**Signature:** `url_for(self, name: 'str', /, **path_params: 'Any') -> 'URL'` + + +**Description:** +*No docstring available.* + +### Method `values` + + +**Signature:** `values(self)` + + +**Description:** +D.values() -> an object providing a view on D's values diff --git a/docs-gb/api/mlserver/rest/responses.md b/docs-gb/api/mlserver/rest/responses.md new file mode 100644 index 000000000..ea471a488 --- /dev/null +++ b/docs-gb/api/mlserver/rest/responses.md @@ -0,0 +1,61 @@ +# Module `mlserver.rest.responses` + + +## Class `Response` + + +**Description:** +Custom Response that will use the encode_to_json_bytes function to +encode given content to json based on library availability. +See mlserver/codecs/utils.py for more details + +### Method `delete_cookie` + + +**Signature:** `delete_cookie(self, key: 'str', path: 'str' = '/', domain: 'str | None' = None, secure: 'bool' = False, httponly: 'bool' = False, samesite: "Literal['lax', 'strict', 'none'] | None" = 'lax') -> 'None'` + + +**Description:** +*No docstring available.* + +### Method `init_headers` + + +**Signature:** `init_headers(self, headers: 'Mapping[str, str] | None' = None) -> 'None'` + + +**Description:** +*No docstring available.* + +### Method `render` + + +**Signature:** `render(self, content: Any) -> bytes` + + +**Description:** +*No docstring available.* + +### Method `set_cookie` + + +**Signature:** `set_cookie(self, key: 'str', value: 'str' = '', max_age: 'int | None' = None, expires: 'datetime | str | int | None' = None, path: 'str | None' = '/', domain: 'str | None' = None, secure: 'bool' = False, httponly: 'bool' = False, samesite: "Literal['lax', 'strict', 'none'] | None" = 'lax', partitioned: 'bool' = False) -> 'None'` + + +**Description:** +*No docstring available.* + +## Class `ServerSentEvent` + + +**Description:** +*No docstring available.* + +### Method `encode` + + +**Signature:** `encode(self) -> bytes` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/server.md b/docs-gb/api/mlserver/rest/server.md new file mode 100644 index 000000000..39795dd47 --- /dev/null +++ b/docs-gb/api/mlserver/rest/server.md @@ -0,0 +1,44 @@ +# Module `mlserver.rest.server` + + +## Class `RESTServer` + + +**Description:** +*No docstring available.* + +### Method `add_custom_handlers` + + +**Signature:** `add_custom_handlers(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `delete_custom_handlers` + + +**Signature:** `delete_custom_handlers(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `start` + + +**Signature:** `start(self)` + + +**Description:** +*No docstring available.* + +### Method `stop` + + +**Signature:** `stop(self, sig: Optional[int] = None)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/rest/utils.md b/docs-gb/api/mlserver/rest/utils.md new file mode 100644 index 000000000..20479670d --- /dev/null +++ b/docs-gb/api/mlserver/rest/utils.md @@ -0,0 +1,29 @@ +# Module `mlserver.rest.utils` + + +## Function `matches` + + +**Signature:** `matches(route: fastapi.routing.APIRoute, custom_handler: mlserver.handlers.custom.CustomHandler, handler_method: Callable) -> bool` + + +**Description:** +*No docstring available.* + +## Function `to_scope` + + +**Signature:** `to_scope(custom_handler: mlserver.handlers.custom.CustomHandler) -> collections.abc.MutableMapping[str, typing.Any]` + + +**Description:** +*No docstring available.* + +## Function `to_status_code` + + +**Signature:** `to_status_code(flag: bool, error_code: int = 400) -> int` + + +**Description:** +Convert a boolean flag into a HTTP status code. diff --git a/docs-gb/api/mlserver/server.md b/docs-gb/api/mlserver/server.md new file mode 100644 index 000000000..a525f0132 --- /dev/null +++ b/docs-gb/api/mlserver/server.md @@ -0,0 +1,53 @@ +# Module `mlserver.server` + + +## Class `MLServer` + + +**Description:** +*No docstring available.* + +### Method `add_custom_handlers` + + +**Signature:** `add_custom_handlers(self, model: mlserver.model.MLModel) -> mlserver.model.MLModel` + + +**Description:** +*No docstring available.* + +### Method `reload_custom_handlers` + + +**Signature:** `reload_custom_handlers(self, old_model: mlserver.model.MLModel, new_model: mlserver.model.MLModel)` + + +**Description:** +*No docstring available.* + +### Method `remove_custom_handlers` + + +**Signature:** `remove_custom_handlers(self, model: mlserver.model.MLModel)` + + +**Description:** +*No docstring available.* + +### Method `start` + + +**Signature:** `start(self, models_settings: List[mlserver.settings.ModelSettings] = [])` + + +**Description:** +*No docstring available.* + +### Method `stop` + + +**Signature:** `stop(self, sig: Optional[int] = None)` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/settings.md b/docs-gb/api/mlserver/settings.md new file mode 100644 index 000000000..f68ff5694 --- /dev/null +++ b/docs-gb/api/mlserver/settings.md @@ -0,0 +1,954 @@ +# Module `mlserver.settings` + + +## Class `BaseSettings` + + +**Description:** +Base class for settings, allowing values to be overridden by environment variables. +This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose), +Heroku and any 12 factor app design. + +All the below attributes can be set via `model_config`. + +**Parameters:** +- `_case_sensitive` (unknown): Whether environment and CLI variable names should be read with case-sensitivity. +Defaults to `None`. +- `_nested_model_default_partial_update` (unknown): Whether to allow partial updates on nested model default object fields. +Defaults to `False`. +- `_env_prefix` (unknown): Prefix for all environment variables. Defaults to `None`. +- `_env_file` (unknown): The env file(s) to load settings values from. Defaults to `Path('')`, which +means that the value from `model_config['env_file']` should be used. You can also pass +`None` to indicate that environment variables should not be loaded from an env file. +- `_env_file_encoding` (unknown): The env file encoding, e.g. `'latin-1'`. Defaults to `None`. +- `_env_ignore_empty` (unknown): Ignore environment variables where the value is an empty string. Default to `False`. +- `_env_nested_delimiter` (unknown): The nested env values delimiter. Defaults to `None`. +- `_env_nested_max_split` (unknown): The nested env values maximum nesting. Defaults to `None`, which means no limit. +- `_env_parse_none_str` (unknown): The env string value that should be parsed (e.g. "null", "void", "None", etc.) +into `None` type(None). Defaults to `None` type(None), which means no parsing should occur. +- `_env_parse_enums` (unknown): Parse enum field names to values. Defaults to `None.`, which means no parsing should occur. +- `_cli_prog_name` (unknown): The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`. +Otherwise, defaults to sys.argv[0]. +- `_cli_parse_args` (unknown): The list of CLI arguments to parse. Defaults to None. +If set to `True`, defaults to sys.argv[1:]. +- `_cli_settings_source` (unknown): Override the default CLI settings source with a user defined instance. Defaults to None. +- `_cli_parse_none_str` (unknown): The CLI string value that should be parsed (e.g. "null", "void", "None", etc.) into +`None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to "null" if +_cli_avoid_json is `False`, and "None" if _cli_avoid_json is `True`. +- `_cli_hide_none_type` (unknown): Hide `None` values in CLI help text. Defaults to `False`. +- `_cli_avoid_json` (unknown): Avoid complex JSON objects in CLI help text. Defaults to `False`. +- `_cli_enforce_required` (unknown): Enforce required fields at the CLI. Defaults to `False`. +- `_cli_use_class_docs_for_groups` (unknown): Use class docstrings in CLI group help text instead of field descriptions. +Defaults to `False`. +- `_cli_exit_on_error` (unknown): Determines whether or not the internal parser exits with error info when an error occurs. +Defaults to `True`. +- `_cli_prefix` (unknown): The root parser command line arguments prefix. Defaults to "". +- `_cli_flag_prefix_char` (unknown): The flag prefix character to use for CLI optional arguments. Defaults to '-'. +- `_cli_implicit_flags` (unknown): Whether `bool` fields should be implicitly converted into CLI boolean flags. +(e.g. --flag, --no-flag). Defaults to `False`. +- `_cli_ignore_unknown_args` (unknown): Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`. +- `_cli_kebab_case` (unknown): CLI args use kebab case. Defaults to `False`. +- `_cli_shortcuts` (unknown): Mapping of target field name to alias names. Defaults to `None`. +- `_secrets_dir` (unknown): The secret files directory or a sequence of directories. Defaults to `None`. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `json` + + +**Signature:** `json(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `CORSSettings` + + +**Description:** +Base class for settings, allowing values to be overridden by environment variables. +This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose), +Heroku and any 12 factor app design. + +All the below attributes can be set via `model_config`. + +**Parameters:** +- `_case_sensitive` (unknown): Whether environment and CLI variable names should be read with case-sensitivity. +Defaults to `None`. +- `_nested_model_default_partial_update` (unknown): Whether to allow partial updates on nested model default object fields. +Defaults to `False`. +- `_env_prefix` (unknown): Prefix for all environment variables. Defaults to `None`. +- `_env_file` (unknown): The env file(s) to load settings values from. Defaults to `Path('')`, which +means that the value from `model_config['env_file']` should be used. You can also pass +`None` to indicate that environment variables should not be loaded from an env file. +- `_env_file_encoding` (unknown): The env file encoding, e.g. `'latin-1'`. Defaults to `None`. +- `_env_ignore_empty` (unknown): Ignore environment variables where the value is an empty string. Default to `False`. +- `_env_nested_delimiter` (unknown): The nested env values delimiter. Defaults to `None`. +- `_env_nested_max_split` (unknown): The nested env values maximum nesting. Defaults to `None`, which means no limit. +- `_env_parse_none_str` (unknown): The env string value that should be parsed (e.g. "null", "void", "None", etc.) +into `None` type(None). Defaults to `None` type(None), which means no parsing should occur. +- `_env_parse_enums` (unknown): Parse enum field names to values. Defaults to `None.`, which means no parsing should occur. +- `_cli_prog_name` (unknown): The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`. +Otherwise, defaults to sys.argv[0]. +- `_cli_parse_args` (unknown): The list of CLI arguments to parse. Defaults to None. +If set to `True`, defaults to sys.argv[1:]. +- `_cli_settings_source` (unknown): Override the default CLI settings source with a user defined instance. Defaults to None. +- `_cli_parse_none_str` (unknown): The CLI string value that should be parsed (e.g. "null", "void", "None", etc.) into +`None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to "null" if +_cli_avoid_json is `False`, and "None" if _cli_avoid_json is `True`. +- `_cli_hide_none_type` (unknown): Hide `None` values in CLI help text. Defaults to `False`. +- `_cli_avoid_json` (unknown): Avoid complex JSON objects in CLI help text. Defaults to `False`. +- `_cli_enforce_required` (unknown): Enforce required fields at the CLI. Defaults to `False`. +- `_cli_use_class_docs_for_groups` (unknown): Use class docstrings in CLI group help text instead of field descriptions. +Defaults to `False`. +- `_cli_exit_on_error` (unknown): Determines whether or not the internal parser exits with error info when an error occurs. +Defaults to `True`. +- `_cli_prefix` (unknown): The root parser command line arguments prefix. Defaults to "". +- `_cli_flag_prefix_char` (unknown): The flag prefix character to use for CLI optional arguments. Defaults to '-'. +- `_cli_implicit_flags` (unknown): Whether `bool` fields should be implicitly converted into CLI boolean flags. +(e.g. --flag, --no-flag). Defaults to `False`. +- `_cli_ignore_unknown_args` (unknown): Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`. +- `_cli_kebab_case` (unknown): CLI args use kebab case. Defaults to `False`. +- `_cli_shortcuts` (unknown): Mapping of target field name to alias names. Defaults to `None`. +- `_secrets_dir` (unknown): The secret files directory or a sequence of directories. Defaults to `None`. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `json` + + +**Signature:** `json(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `ModelParameters` + + +**Description:** +Parameters that apply only to a particular instance of a model. +This can include things like model weights, or arbitrary ``extra`` +parameters particular to the underlying inference runtime. +The main difference with respect to ``ModelSettings`` is that parameters +can change on each instance (e.g. each version) of the model. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `json` + + +**Signature:** `json(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +### Method `set_inference_pool_gid` + + +**Signature:** `set_inference_pool_gid(self) -> Self` + + +**Description:** +*No docstring available.* + +## Class `ModelSettings` + + +**Description:** +Base class for settings, allowing values to be overridden by environment variables. +This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose), +Heroku and any 12 factor app design. + +All the below attributes can be set via `model_config`. + +**Parameters:** +- `_case_sensitive` (unknown): Whether environment and CLI variable names should be read with case-sensitivity. +Defaults to `None`. +- `_nested_model_default_partial_update` (unknown): Whether to allow partial updates on nested model default object fields. +Defaults to `False`. +- `_env_prefix` (unknown): Prefix for all environment variables. Defaults to `None`. +- `_env_file` (unknown): The env file(s) to load settings values from. Defaults to `Path('')`, which +means that the value from `model_config['env_file']` should be used. You can also pass +`None` to indicate that environment variables should not be loaded from an env file. +- `_env_file_encoding` (unknown): The env file encoding, e.g. `'latin-1'`. Defaults to `None`. +- `_env_ignore_empty` (unknown): Ignore environment variables where the value is an empty string. Default to `False`. +- `_env_nested_delimiter` (unknown): The nested env values delimiter. Defaults to `None`. +- `_env_nested_max_split` (unknown): The nested env values maximum nesting. Defaults to `None`, which means no limit. +- `_env_parse_none_str` (unknown): The env string value that should be parsed (e.g. "null", "void", "None", etc.) +into `None` type(None). Defaults to `None` type(None), which means no parsing should occur. +- `_env_parse_enums` (unknown): Parse enum field names to values. Defaults to `None.`, which means no parsing should occur. +- `_cli_prog_name` (unknown): The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`. +Otherwise, defaults to sys.argv[0]. +- `_cli_parse_args` (unknown): The list of CLI arguments to parse. Defaults to None. +If set to `True`, defaults to sys.argv[1:]. +- `_cli_settings_source` (unknown): Override the default CLI settings source with a user defined instance. Defaults to None. +- `_cli_parse_none_str` (unknown): The CLI string value that should be parsed (e.g. "null", "void", "None", etc.) into +`None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to "null" if +_cli_avoid_json is `False`, and "None" if _cli_avoid_json is `True`. +- `_cli_hide_none_type` (unknown): Hide `None` values in CLI help text. Defaults to `False`. +- `_cli_avoid_json` (unknown): Avoid complex JSON objects in CLI help text. Defaults to `False`. +- `_cli_enforce_required` (unknown): Enforce required fields at the CLI. Defaults to `False`. +- `_cli_use_class_docs_for_groups` (unknown): Use class docstrings in CLI group help text instead of field descriptions. +Defaults to `False`. +- `_cli_exit_on_error` (unknown): Determines whether or not the internal parser exits with error info when an error occurs. +Defaults to `True`. +- `_cli_prefix` (unknown): The root parser command line arguments prefix. Defaults to "". +- `_cli_flag_prefix_char` (unknown): The flag prefix character to use for CLI optional arguments. Defaults to '-'. +- `_cli_implicit_flags` (unknown): Whether `bool` fields should be implicitly converted into CLI boolean flags. +(e.g. --flag, --no-flag). Defaults to `False`. +- `_cli_ignore_unknown_args` (unknown): Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`. +- `_cli_kebab_case` (unknown): CLI args use kebab case. Defaults to `False`. +- `_cli_shortcuts` (unknown): Mapping of target field name to alias names. Defaults to `None`. +- `_secrets_dir` (unknown): The secret files directory or a sequence of directories. Defaults to `None`. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `json` + + +**Signature:** `json(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self: 'BaseModel', context: 'Any', /) -> 'None'` + + +**Description:** +This function is meant to behave like a BaseModel method to initialise private attributes. +It takes context as an argument since that's what pydantic-core passes when calling it. + +**Parameters:** +- `self` (unknown): The BaseModel instance. +- `context` (unknown): The context. + +## Class `Settings` + + +**Description:** +Base class for settings, allowing values to be overridden by environment variables. +This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose), +Heroku and any 12 factor app design. + +All the below attributes can be set via `model_config`. + +**Parameters:** +- `_case_sensitive` (unknown): Whether environment and CLI variable names should be read with case-sensitivity. +Defaults to `None`. +- `_nested_model_default_partial_update` (unknown): Whether to allow partial updates on nested model default object fields. +Defaults to `False`. +- `_env_prefix` (unknown): Prefix for all environment variables. Defaults to `None`. +- `_env_file` (unknown): The env file(s) to load settings values from. Defaults to `Path('')`, which +means that the value from `model_config['env_file']` should be used. You can also pass +`None` to indicate that environment variables should not be loaded from an env file. +- `_env_file_encoding` (unknown): The env file encoding, e.g. `'latin-1'`. Defaults to `None`. +- `_env_ignore_empty` (unknown): Ignore environment variables where the value is an empty string. Default to `False`. +- `_env_nested_delimiter` (unknown): The nested env values delimiter. Defaults to `None`. +- `_env_nested_max_split` (unknown): The nested env values maximum nesting. Defaults to `None`, which means no limit. +- `_env_parse_none_str` (unknown): The env string value that should be parsed (e.g. "null", "void", "None", etc.) +into `None` type(None). Defaults to `None` type(None), which means no parsing should occur. +- `_env_parse_enums` (unknown): Parse enum field names to values. Defaults to `None.`, which means no parsing should occur. +- `_cli_prog_name` (unknown): The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`. +Otherwise, defaults to sys.argv[0]. +- `_cli_parse_args` (unknown): The list of CLI arguments to parse. Defaults to None. +If set to `True`, defaults to sys.argv[1:]. +- `_cli_settings_source` (unknown): Override the default CLI settings source with a user defined instance. Defaults to None. +- `_cli_parse_none_str` (unknown): The CLI string value that should be parsed (e.g. "null", "void", "None", etc.) into +`None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to "null" if +_cli_avoid_json is `False`, and "None" if _cli_avoid_json is `True`. +- `_cli_hide_none_type` (unknown): Hide `None` values in CLI help text. Defaults to `False`. +- `_cli_avoid_json` (unknown): Avoid complex JSON objects in CLI help text. Defaults to `False`. +- `_cli_enforce_required` (unknown): Enforce required fields at the CLI. Defaults to `False`. +- `_cli_use_class_docs_for_groups` (unknown): Use class docstrings in CLI group help text instead of field descriptions. +Defaults to `False`. +- `_cli_exit_on_error` (unknown): Determines whether or not the internal parser exits with error info when an error occurs. +Defaults to `True`. +- `_cli_prefix` (unknown): The root parser command line arguments prefix. Defaults to "". +- `_cli_flag_prefix_char` (unknown): The flag prefix character to use for CLI optional arguments. Defaults to '-'. +- `_cli_implicit_flags` (unknown): Whether `bool` fields should be implicitly converted into CLI boolean flags. +(e.g. --flag, --no-flag). Defaults to `False`. +- `_cli_ignore_unknown_args` (unknown): Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`. +- `_cli_kebab_case` (unknown): CLI args use kebab case. Defaults to `False`. +- `_cli_shortcuts` (unknown): Mapping of target field name to alias names. Defaults to `None`. +- `_secrets_dir` (unknown): The secret files directory or a sequence of directories. Defaults to `None`. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `json` + + +**Signature:** `json(self, by_alias=True, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +Ensure that aliases are used, and that unset / none fields are ignored. + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self: 'BaseModel', context: 'Any', /) -> 'None'` + + +**Description:** +This function is meant to behave like a BaseModel method to initialise private attributes. +It takes context as an argument since that's what pydantic-core passes when calling it. + +**Parameters:** +- `self` (unknown): The BaseModel instance. +- `context` (unknown): The context. diff --git a/docs-gb/api/mlserver/tracing.md b/docs-gb/api/mlserver/tracing.md new file mode 100644 index 000000000..1360a965c --- /dev/null +++ b/docs-gb/api/mlserver/tracing.md @@ -0,0 +1,11 @@ +# Module `mlserver.tracing` + + +## Function `get_tracer_provider` + + +**Signature:** `get_tracer_provider(settings: mlserver.settings.Settings) -> opentelemetry.sdk.trace.TracerProvider` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/types.md b/docs-gb/api/mlserver/types.md new file mode 100644 index 000000000..9e88c5f36 --- /dev/null +++ b/docs-gb/api/mlserver/types.md @@ -0,0 +1,2 @@ +# Module `mlserver.types` + diff --git a/docs-gb/api/mlserver/types/base.md b/docs-gb/api/mlserver/types/base.md new file mode 100644 index 000000000..d4cba688e --- /dev/null +++ b/docs-gb/api/mlserver/types/base.md @@ -0,0 +1,157 @@ +# Module `mlserver.types.base` + + +## Class `BaseModel` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. diff --git a/docs-gb/api/mlserver/types/dataplane.md b/docs-gb/api/mlserver/types/dataplane.md new file mode 100644 index 000000000..77c8e8f53 --- /dev/null +++ b/docs-gb/api/mlserver/types/dataplane.md @@ -0,0 +1,2062 @@ +# Module `mlserver.types.dataplane` + + +## Class `Datatype` + + +**Description:** +Create a collection of name/value pairs. +Example enumeration: + +>>> class Color(Enum): +... RED = 1 +... BLUE = 2 +... GREEN = 3 + +Access them by: + +- attribute access: + + >>> Color.RED + + +- value lookup: + + >>> Color(1) + + +- name lookup: + + >>> Color['RED'] + + +Enumerations can be iterated over, and know how many members they have: + +>>> len(Color) +3 + +>>> list(Color) +[, , ] + +Methods can be added to enumerations, and members can have their own +attributes -- see the documentation for details. + +## Class `InferenceErrorResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `InferenceRequest` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `InferenceResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `MetadataModelErrorResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `MetadataModelResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `MetadataServerErrorResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `MetadataServerResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `MetadataTensor` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `Parameters` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `RequestInput` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `RequestOutput` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `ResponseOutput` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `TensorData` + + +**Description:** +!!! abstract "Usage Documentation" +[`RootModel` and Custom Root Types](../concepts/models.md#rootmodel-and-custom-root-types) + +A Pydantic `BaseModel` for the root object of the model. + +**Parameters:** +- `root` (unknown): The root object of the model. +- `__pydantic_root_model__` (unknown): Whether the model is a RootModel. +- `__pydantic_private__` (unknown): Private fields in the model. +- `__pydantic_extra__` (unknown): Extra fields in the model. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. diff --git a/docs-gb/api/mlserver/types/model_repository.md b/docs-gb/api/mlserver/types/model_repository.md new file mode 100644 index 000000000..ab6e8cd42 --- /dev/null +++ b/docs-gb/api/mlserver/types/model_repository.md @@ -0,0 +1,822 @@ +# Module `mlserver.types.model_repository` + + +## Class `RepositoryIndexRequest` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `RepositoryIndexResponse` + + +**Description:** +!!! abstract "Usage Documentation" +[`RootModel` and Custom Root Types](../concepts/models.md#rootmodel-and-custom-root-types) + +A Pydantic `BaseModel` for the root object of the model. + +**Parameters:** +- `root` (unknown): The root object of the model. +- `__pydantic_root_model__` (unknown): Whether the model is a RootModel. +- `__pydantic_private__` (unknown): Private fields in the model. +- `__pydantic_extra__` (unknown): Extra fields in the model. + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, *, mode: "Literal['json', 'python'] | str" = 'python', include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'dict[str, Any]'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, *, indent: 'int | None' = None, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, context: 'Any | None' = None, by_alias: 'bool | None' = None, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, round_trip: 'bool' = False, warnings: "bool | Literal['none', 'warn', 'error']" = True, fallback: 'Callable[[Any], Any] | None' = None, serialize_as_any: 'bool' = False) -> 'str'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `RepositoryIndexResponseItem` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `RepositoryLoadErrorResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `RepositoryUnloadErrorResponse` + + +**Description:** +Override Pydantic's BaseModel class to ensure all payloads exclude unset +fields by default. + +From: + https://github.com/pydantic/pydantic/issues/1387#issuecomment-612901525 + +### Method `copy` + + +**Signature:** `copy(self, *, include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, update: 'Dict[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +Returns a copy of the model. +!!! warning "Deprecated" + This method is now deprecated; use `model_copy` instead. + +If you need `include` or `exclude`, use: + +```python {test="skip" lint="skip"} +data = self.model_dump(include=include, exclude=exclude, round_trip=True) +data = {**data, **(update or {})} +copied = self.model_validate(data) +``` + +**Parameters:** +- `include` (unknown): Optional set or mapping specifying which fields to include in the copied model. +- `exclude` (unknown): Optional set or mapping specifying which fields to exclude in the copied model. +- `update` (unknown): Optional dictionary of field-value pairs to override field values in the copied model. +- `deep` (unknown): If True, the values of fields that are Pydantic models will be deep-copied. + +**Returns:** +- (unknown): A copy of the model with included, excluded and updated fields as specified. + +### Method `dict` + + +**Signature:** `dict(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False) -> 'Dict[str, Any]'` + + +**Description:** +*No docstring available.* + +### Method `json` + + +**Signature:** `json(self, *, include: 'IncEx | None' = None, exclude: 'IncEx | None' = None, by_alias: 'bool' = False, exclude_unset: 'bool' = False, exclude_defaults: 'bool' = False, exclude_none: 'bool' = False, encoder: 'Callable[[Any], Any] | None' = PydanticUndefined, models_as_dict: 'bool' = PydanticUndefined, **dumps_kwargs: 'Any') -> 'str'` + + +**Description:** +*No docstring available.* + +### Method `model_copy` + + +**Signature:** `model_copy(self, *, update: 'Mapping[str, Any] | None' = None, deep: 'bool' = False) -> 'Self'` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_copy`](../concepts/serialization.md#model_copy) + +Returns a copy of the model. + +!!! note + The underlying instance's [`__dict__`][object.__dict__] attribute is copied. This + might have unexpected side effects if you store anything in it, on top of the model + fields (e.g. the value of [cached properties][functools.cached_property]). + +**Parameters:** +- `update` (unknown): Values to change/add in the new model. Note: the data is not validated +before creating the new model. You should trust this data. +- `deep` (unknown): Set to `True` to make a deep copy of the model. + +**Returns:** +- (unknown): New model instance. + +### Method `model_dump` + + +**Signature:** `model_dump(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump`](../concepts/serialization.md#modelmodel_dump) + +Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + +**Parameters:** +- `mode` (unknown): The mode in which `to_python` should run. +If mode is 'json', the output will only contain JSON serializable types. +If mode is 'python', the output may contain non-JSON-serializable Python objects. +- `include` (unknown): A set of fields to include in the output. +- `exclude` (unknown): A set of fields to exclude from the output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to use the field's alias in the dictionary key if defined. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A dictionary representation of the model. + +### Method `model_dump_json` + + +**Signature:** `model_dump_json(self, exclude_unset=True, exclude_none=True, **kwargs)` + + +**Description:** +!!! abstract "Usage Documentation" +[`model_dump_json`](../concepts/serialization.md#modelmodel_dump_json) + +Generates a JSON representation of the model using Pydantic's `to_json` method. + +**Parameters:** +- `indent` (unknown): Indentation to use in the JSON output. If None is passed, the output will be compact. +- `include` (unknown): Field(s) to include in the JSON output. +- `exclude` (unknown): Field(s) to exclude from the JSON output. +- `context` (unknown): Additional context to pass to the serializer. +- `by_alias` (unknown): Whether to serialize using field aliases. +- `exclude_unset` (unknown): Whether to exclude fields that have not been explicitly set. +- `exclude_defaults` (unknown): Whether to exclude fields that are set to their default value. +- `exclude_none` (unknown): Whether to exclude fields that have a value of `None`. +- `round_trip` (unknown): If True, dumped values should be valid as input for non-idempotent types such as Json[T]. +- `warnings` (unknown): How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, +"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. +- `fallback` (unknown): A function to call when an unknown value is encountered. If not provided, +a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. +- `serialize_as_any` (unknown): Whether to serialize fields with duck-typing serialization behavior. + +**Returns:** +- (unknown): A JSON string representation of the model. + +### Method `model_post_init` + + +**Signature:** `model_post_init(self, context: 'Any', /) -> 'None'` + + +**Description:** +Override this method to perform additional initialization after `__init__` and `model_construct`. +This is useful if you want to do some validation that requires the entire model to be initialized. + +## Class `State` + + +**Description:** +Create a collection of name/value pairs. +Example enumeration: + +>>> class Color(Enum): +... RED = 1 +... BLUE = 2 +... GREEN = 3 + +Access them by: + +- attribute access: + + >>> Color.RED + + +- value lookup: + + >>> Color(1) + + +- name lookup: + + >>> Color['RED'] + + +Enumerations can be iterated over, and know how many members they have: + +>>> len(Color) +3 + +>>> list(Color) +[, , ] + +Methods can be added to enumerations, and members can have their own +attributes -- see the documentation for details. diff --git a/docs-gb/api/mlserver/utils.md b/docs-gb/api/mlserver/utils.md new file mode 100644 index 000000000..637c70458 --- /dev/null +++ b/docs-gb/api/mlserver/utils.md @@ -0,0 +1,74 @@ +# Module `mlserver.utils` + + +## Function `extract_headers` + + +**Signature:** `extract_headers(inference_response: mlserver.types.dataplane.InferenceResponse) -> Optional[Dict[str, str]]` + + +**Description:** +*No docstring available.* + +## Function `generate_uuid` + + +**Signature:** `generate_uuid() -> str` + + +**Description:** +*No docstring available.* + +## Function `get_model_uri` + + +**Signature:** `get_model_uri(settings: mlserver.settings.ModelSettings, wellknown_filenames: List[str] = []) -> str` + + +**Description:** +*No docstring available.* + +## Function `get_wrapped_method` + + +**Signature:** `get_wrapped_method(f: Callable) -> Callable` + + +**Description:** +*No docstring available.* + +## Function `insert_headers` + + +**Signature:** `insert_headers(inference_request: mlserver.types.dataplane.InferenceRequest, headers: Dict[str, str]) -> mlserver.types.dataplane.InferenceRequest` + + +**Description:** +*No docstring available.* + +## Function `install_uvloop_event_loop` + + +**Signature:** `install_uvloop_event_loop()` + + +**Description:** +*No docstring available.* + +## Function `schedule_with_callback` + + +**Signature:** `schedule_with_callback(coro, cb) -> _asyncio.Task` + + +**Description:** +*No docstring available.* + +## Function `to_absolute_path` + + +**Signature:** `to_absolute_path(model_settings: mlserver.settings.ModelSettings, uri: str) -> str` + + +**Description:** +*No docstring available.* diff --git a/docs-gb/api/mlserver/version.md b/docs-gb/api/mlserver/version.md new file mode 100644 index 000000000..502f6f286 --- /dev/null +++ b/docs-gb/api/mlserver/version.md @@ -0,0 +1,2 @@ +# Module `mlserver.version` + diff --git a/generate_api_docs.py b/generate_api_docs.py new file mode 100644 index 000000000..c85c9ddec --- /dev/null +++ b/generate_api_docs.py @@ -0,0 +1,104 @@ +import os +import sys +import inspect +import importlib +import pkgutil +from pathlib import Path +from types import ModuleType +import docstring_parser + +# Configurable values +BASE_PACKAGE = "mlserver" +PYTHON_SRC = Path("python") +DOCS_DIR = Path("docs-gb/api") +SUMMARY_FILE = Path("docs-gb/api/SUMMARY.md") + +# Ensure the Python source directory is in sys.path +sys.path.insert(0, str(PYTHON_SRC.resolve())) +DOCS_DIR.mkdir(parents=True, exist_ok=True) + + +def write_md_header(title, level=1): + return f"{'#' * level} {title}\n\n" + + +def format_docstring(obj): + raw = inspect.getdoc(obj) + if not raw: + return "*No docstring available.*" + try: + parsed = docstring_parser.parse(raw) + except Exception: + return raw # fallback if badly formatted + + output = [] + if parsed.short_description: + output.append(parsed.short_description) + if parsed.long_description: + output.append(parsed.long_description) + if parsed.params: + output.append("\n**Parameters:**") + for p in parsed.params: + output.append(f"- `{p.arg_name}` ({p.type_name or 'unknown'}): {p.description}") + if parsed.returns: + output.append("\n**Returns:**") + output.append(f"- ({parsed.returns.type_name or 'unknown'}): {parsed.returns.description}") + return "\n".join(output) + + +def document_module(mod: ModuleType, module_name: str) -> str: + lines = [write_md_header(f"Module `{module_name}`")] + + for name, member in inspect.getmembers(mod): + if name.startswith("_"): + continue + + if inspect.isclass(member) and member.__module__ == module_name: + lines.append(write_md_header(f"Class `{name}`", 2)) + lines.append(f"**Description:**\n{format_docstring(member)}\n") + for meth_name, meth in inspect.getmembers(member, inspect.isfunction): + if meth_name.startswith("_"): + continue + lines.append(write_md_header(f"Method `{meth_name}`", 3)) + lines.append(f"**Signature:** `{meth_name}{inspect.signature(meth)}`\n\n") + lines.append(f"**Description:**\n{format_docstring(meth)}\n") + + elif inspect.isfunction(member) and member.__module__ == module_name: + lines.append(write_md_header(f"Function `{name}`", 2)) + lines.append(f"**Signature:** `{name}{inspect.signature(member)}`\n\n") + lines.append(f"**Description:**\n{format_docstring(member)}\n") + + return "\n".join(lines) + + +def walk_package(package_name): + package = importlib.import_module(package_name) + yield package_name, package + for _, name, _ in pkgutil.walk_packages(package.__path__, prefix=f"{package_name}."): + try: + submodule = importlib.import_module(name) + yield name, submodule + except Exception as e: + print(f"⚠️ Skipping {name}: {e}") + continue + + +def generate_all_docs(): + summary_lines = ["# Summary\n", "* [Home](README.md)\n", "* [API Reference](api/index.md)\n"] + (DOCS_DIR / "index.md").write_text(write_md_header("API Reference")) + + for modname, module in walk_package(BASE_PACKAGE): + rel_path = modname.replace(".", "/") + ".md" + out_path = DOCS_DIR / rel_path + out_path.parent.mkdir(parents=True, exist_ok=True) + print(f"📄 Generating: {rel_path}") + out_path.write_text(document_module(module, modname)) + summary_lines.append(f" * [{modname}](api/{rel_path})\n") + + SUMMARY_FILE.write_text("".join(summary_lines)) + print(f"\n✅ Docs written to: {DOCS_DIR}/") + print(f"📚 Sidebar: {SUMMARY_FILE}") + + +if __name__ == "__main__": + generate_all_docs() From 10027309aa3f80ba1580b1763fbe1e138582dc88 Mon Sep 17 00:00:00 2001 From: Rakavitha Kodhandapani Date: Tue, 16 Sep 2025 14:34:48 +0530 Subject: [PATCH 2/2] added new reference section --- docs-gb/SUMMARY.md | 99 ++++++++++++++++++++++++++ docs-gb/api/mlserver/parallel/utils.md | 2 +- 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/docs-gb/SUMMARY.md b/docs-gb/SUMMARY.md index 5dfd5c1bb..ed3583d98 100644 --- a/docs-gb/SUMMARY.md +++ b/docs-gb/SUMMARY.md @@ -51,3 +51,102 @@ * [Deploying a Custom Tensorflow Model with MLServer and Seldon Core](examples/cassava/README.md) * [Changelog](changelog.md) * [Release Notes](https://github.com/SeldonIO/MLServer/releases) + +## Reference + +* [API Reference](api/index.md) + * [mlserver](api/mlserver.md) + * [mlserver.batching](api/mlserver/batching.md) + * [mlserver.batching.adaptive](api/mlserver/batching/adaptive.md) + * [mlserver.batching.hooks](api/mlserver/batching/hooks.md) + * [mlserver.batching.requests](api/mlserver/batching/requests.md) + * [mlserver.batching.shape](api/mlserver/batching/shape.md) + * [mlserver.cache](api/mlserver/cache.md) + * [mlserver.cache.cache](api/mlserver/cache/cache.md) + * [mlserver.cache.local](api/mlserver/cache/local.md) + * [mlserver.cache.local.local](api/mlserver/cache/local/local.md) + * [mlserver.cloudevents](api/mlserver/cloudevents.md) + * [mlserver.codecs](api/mlserver/codecs.md) + * [mlserver.codecs.base](api/mlserver/codecs/base.md) + * [mlserver.codecs.base64](api/mlserver/codecs/base64.md) + * [mlserver.codecs.datetime](api/mlserver/codecs/datetime.md) + * [mlserver.codecs.decorator](api/mlserver/codecs/decorator.md) + * [mlserver.codecs.errors](api/mlserver/codecs/errors.md) + * [mlserver.codecs.json](api/mlserver/codecs/json.md) + * [mlserver.codecs.lists](api/mlserver/codecs/lists.md) + * [mlserver.codecs.numpy](api/mlserver/codecs/numpy.md) + * [mlserver.codecs.pandas](api/mlserver/codecs/pandas.md) + * [mlserver.codecs.string](api/mlserver/codecs/string.md) + * [mlserver.codecs.utils](api/mlserver/codecs/utils.md) + * [mlserver.context](api/mlserver/context.md) + * [mlserver.env](api/mlserver/env.md) + * [mlserver.errors](api/mlserver/errors.md) + * [mlserver.grpc](api/mlserver/grpc.md) + * [mlserver.grpc.converters](api/mlserver/grpc/converters.md) + * [mlserver.grpc.dataplane_pb2](api/mlserver/grpc/dataplane_pb2.md) + * [mlserver.grpc.dataplane_pb2_grpc](api/mlserver/grpc/dataplane_pb2_grpc.md) + * [mlserver.grpc.interceptors](api/mlserver/grpc/interceptors.md) + * [mlserver.grpc.logging](api/mlserver/grpc/logging.md) + * [mlserver.grpc.model_repository](api/mlserver/grpc/model_repository.md) + * [mlserver.grpc.model_repository_pb2](api/mlserver/grpc/model_repository_pb2.md) + * [mlserver.grpc.model_repository_pb2_grpc](api/mlserver/grpc/model_repository_pb2_grpc.md) + * [mlserver.grpc.server](api/mlserver/grpc/server.md) + * [mlserver.grpc.servicers](api/mlserver/grpc/servicers.md) + * [mlserver.grpc.utils](api/mlserver/grpc/utils.md) + * [mlserver.handlers](api/mlserver/handlers.md) + * [mlserver.handlers.custom](api/mlserver/handlers/custom.md) + * [mlserver.handlers.dataplane](api/mlserver/handlers/dataplane.md) + * [mlserver.handlers.model_repository](api/mlserver/handlers/model_repository.md) + * [mlserver.kafka](api/mlserver/kafka.md) + * [mlserver.kafka.errors](api/mlserver/kafka/errors.md) + * [mlserver.kafka.handlers](api/mlserver/kafka/handlers.md) + * [mlserver.kafka.logging](api/mlserver/kafka/logging.md) + * [mlserver.kafka.message](api/mlserver/kafka/message.md) + * [mlserver.kafka.server](api/mlserver/kafka/server.md) + * [mlserver.logging](api/mlserver/logging.md) + * [mlserver.metrics](api/mlserver/metrics.md) + * [mlserver.metrics.context](api/mlserver/metrics/context.md) + * [mlserver.metrics.errors](api/mlserver/metrics/errors.md) + * [mlserver.metrics.logging](api/mlserver/metrics/logging.md) + * [mlserver.metrics.prometheus](api/mlserver/metrics/prometheus.md) + * [mlserver.metrics.registry](api/mlserver/metrics/registry.md) + * [mlserver.metrics.server](api/mlserver/metrics/server.md) + * [mlserver.middleware](api/mlserver/middleware.md) + * [mlserver.model](api/mlserver/model.md) + * [mlserver.parallel](api/mlserver/parallel.md) + * [mlserver.parallel.dispatcher](api/mlserver/parallel/dispatcher.md) + * [mlserver.parallel.errors](api/mlserver/parallel/errors.md) + * [mlserver.parallel.logging](api/mlserver/parallel/logging.md) + * [mlserver.parallel.messages](api/mlserver/parallel/messages.md) + * [mlserver.parallel.model](api/mlserver/parallel/model.md) + * [mlserver.parallel.pool](api/mlserver/parallel/pool.md) + * [mlserver.parallel.registry](api/mlserver/parallel/registry.md) + * [mlserver.parallel.utils](api/mlserver/parallel/utils.md) + * [mlserver.parallel.worker](api/mlserver/parallel/worker.md) + * [mlserver.raw](api/mlserver/raw.md) + * [mlserver.registry](api/mlserver/registry.md) + * [mlserver.repository](api/mlserver/repository.md) + * [mlserver.repository.factory](api/mlserver/repository/factory.md) + * [mlserver.repository.load](api/mlserver/repository/load.md) + * [mlserver.repository.repository](api/mlserver/repository/repository.md) + * [mlserver.rest](api/mlserver/rest.md) + * [mlserver.rest.app](api/mlserver/rest/app.md) + * [mlserver.rest.endpoints](api/mlserver/rest/endpoints.md) + * [mlserver.rest.errors](api/mlserver/rest/errors.md) + * [mlserver.rest.logging](api/mlserver/rest/logging.md) + * [mlserver.rest.openapi](api/mlserver/rest/openapi.md) + * [mlserver.rest.openapi.schema](api/mlserver/rest/openapi/schema.md) + * [mlserver.rest.requests](api/mlserver/rest/requests.md) + * [mlserver.rest.responses](api/mlserver/rest/responses.md) + * [mlserver.rest.server](api/mlserver/rest/server.md) + * [mlserver.rest.utils](api/mlserver/rest/utils.md) + * [mlserver.server](api/mlserver/server.md) + * [mlserver.settings](api/mlserver/settings.md) + * [mlserver.tracing](api/mlserver/tracing.md) + * [mlserver.types](api/mlserver/types.md) + * [mlserver.types.base](api/mlserver/types/base.md) + * [mlserver.types.dataplane](api/mlserver/types/dataplane.md) + * [mlserver.types.model_repository](api/mlserver/types/model_repository.md) + * [mlserver.utils](api/mlserver/utils.md) + * [mlserver.version](api/mlserver/version.md) + diff --git a/docs-gb/api/mlserver/parallel/utils.md b/docs-gb/api/mlserver/parallel/utils.md index 9b210e021..b469f6c7e 100644 --- a/docs-gb/api/mlserver/parallel/utils.md +++ b/docs-gb/api/mlserver/parallel/utils.md @@ -22,7 +22,7 @@ ## Function `terminate_queue` -**Signature:** `terminate_queue(queue: >)` +**Signature:** `terminate_queue(queue: >)` **Description:**