System One Model Factory
Builds decision services for the models on one System One endpoint. Every service the factory builds shares one HTTP client and one key supplier.
Building a service never resolves the key or contacts the endpoint. The key is read on each call, so a rotated key takes effect on the next call. A blank key sends no Authorization header, which suits endpoints that need none. The endpoint's binding validates the default model at construction, before credentials are read.
When restClientBuilder is given, a clone of it is used, so its transport, interceptors and timeouts apply. Otherwise the factory builds a client with the endpoint's timeouts that does not follow redirects.
Parameters
where the models live
the model build and buildValidated return
supplies the key for each call
the application's HTTP client builder, or null for the factory's own
records decision and request observations
Inheritors
Constructors
Functions
Returns a service for the default model.
Returns a service for the named model. The endpoint's binding checks the name first, and the endpoint decides whether a model it accepts exists.
Reads the key once, checks it by listing the endpoint's models with it, then returns a service for the default model. A missing key, a rejected listing or an unreachable endpoint all count as an invalid key. A key supplier that throws InvalidApiKeyException itself, as one that insists on a key does for a blank one, counts as a missing key. An already interrupted caller is cancelled before the key is read, including when no key is configured. An interrupted key supplier also throws a CancellationException.
Lists the models the endpoint serves.