Interface DecisionModelClient


@DoNotInherit public interface DecisionModelClient
Asks a decision model a set of questions about an input. A decision model answers each question with probabilities instead of generated text.

Inject this client into endpoints, agents, workflows, consumers, timed actions and the service setup.


 Decision decision =
     decisionModelClient.input(ticket).questions(ROUTE, SEVERITY).invoke();
 Answer.Choice route = decision.answer(ROUTE);
 

The client uses the provider configured in akka.javasdk.decision.model-provider unless you choose one with model(DecisionModelProvider).

The client sends the input and the questions to the model API as they are. Guardrails and sanitizers do not apply to a decision request. To mask sensitive text before the call, use the SanitizerClient.

A call fails with:

  • IllegalArgumentException for an invalid request or configuration: an unsupported input, no questions, duplicate question keys, more options or levels than the provider supports, no provider configured, an unknown provider, a provider configuration section without a required key, or a provider without a model name or API key. Configuration failures surface on the first call.
  • RateLimitException when the model API answers with a rate limit status (429) after the configured retries.
  • ModelTimeoutException when a request to the model API times out.
  • InternalServerException when the model API answers with a server error status (5xx) after the configured retries.
  • ModelException for other failures, such as a rejected request or an unusable response.
  • The unchanged exception of a DecisionModelProvider.Custom provider, when one is used.

Not for user extension.