ask

open fun ask(input: String, spec: DecisionSpec): DecisionResponse

Answers the questions of a spec against the given input. It behaves as ask with a request.

Return

one answer per question, in spec order

Parameters

input

the text the model reasons over, which may be empty

spec

the questions to answer

Throws

if this service cannot answer the spec. No provider call has been made.


Answers a request.

The whole request is checked against capabilities before any provider call. A service that implements QuestionSetExecution answers the whole request in one call. Any other service answers each question in spec order: a proposition through PropositionAssessment when implemented and through assess otherwise, a choice through classify with a classification request built from the question, and a rating through RatingAssessment. Provider failures come back as typed failure outcomes, and the remaining questions are still asked. A decorator routes this call through the shared execution path, so a delegate's own override of this method is not called through a decorator. A service customizes execution through capabilities and the hook interfaces.

An interruption surfaces as an unchecked java.util.concurrent.CancellationException whose cause is the InterruptedException, with the thread's interrupt flag set, so callers never handle a checked exception.

Return

one answer per question, in spec order

Parameters

request

the input and the questions to answer

Throws

if this service cannot answer the request. No provider call has been made.

if the thread is interrupted during the ask