deepjavalibrary / djl-serving

A universal scalable machine learning model deployment solution
Apache License 2.0
182 stars 59 forks source link

[serving] introduce interface to customize http response status retur… #2113

Closed siddvenk closed 1 week ago

siddvenk commented 1 week ago

This PR introduces an interface, HttpResponseStatusMapper that exposes a single method that accepts a Throwable and returns an HttpResponseStatus.

This will allow users to customize the behavior of responses returned to the client for certain error conditions.

It also introduces an HttpResponseStatusProvider. This object allows plugins to register their implementations of HttpResponseStatusMapper with DJLServing and use them in the inference request handler

zachgk commented 1 week ago

Is there a motivating use case for this change? Do we expect different users to require different mappings, especially to the extent of creating custom ones. Or do we expect it to mostly be first-party HttpResponseStatusMappers?