Package akka.javasdk.decision
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:
IllegalArgumentExceptionfor 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.RateLimitExceptionwhen the model API answers with a rate limit status (429) after the configured retries.ModelTimeoutExceptionwhen a request to the model API times out.InternalServerExceptionwhen the model API answers with a server error status (5xx) after the configured retries.ModelExceptionfor other failures, such as a rejected request or an unusable response.- The unchanged exception of a
DecisionModelProvider.Customprovider, when one is used.
Not for user extension.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA request with an input.static interfaceA complete request. -
Method Summary
Modifier and TypeMethodDescriptionStart a request about the given input.model(DecisionModelProvider provider) A client that sends its requests to the given provider.
-
Method Details
-
model
A client that sends its requests to the given provider. -
input
Start a request about the given input. AStringis sent as text. Any other object is serialized to JSON.- Throws:
IllegalArgumentException- when the input is an empty string, or of a type that does not serialize to JSON text, an object or an array, such as a number, a boolean or a byte arrayNullPointerException- when the input is null
-