Package org.springframework.ai.decision
Class DecisionResponse
java.lang.Object
org.springframework.ai.decision.DecisionResponse
- All Implemented Interfaces:
ModelResponse<DecisionResult>
The response of a
DecisionModel: one DecisionResult per question, in
the order the questions were asked, and the response metadata.
A response is built with builder(DecisionPrompt), which orders the answers by
the prompt's questions and checks that each one answers its question, so a response
always matches the prompt it answers.
- Since:
- 2.1.0
- Author:
- Thomas Vitale
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds aDecisionResponsethat answers aDecisionPrompt. -
Method Summary
Modifier and TypeMethodDescriptionstatic DecisionResponse.Builderbuilder(DecisionPrompt prompt) A builder for the response to the given prompt.booleanThe answer to the given question.<A extends DecisionAnswer>
AThe answer to the given question, as the given type.The answers, keyed by question name, in the order the questions were asked.Retrieves the response metadata associated with the AI model's response.@Nullable DecisionResultThe first result, ornullwhen there are none.Retrieves the list of generated outputs by the AI model.booleanWhether the question was answered, including by a refusal.inthashCode()booleanWhether the provider refused to answer the given question.toString()
-
Method Details
-
builder
A builder for the response to the given prompt.DecisionResponse.Builder.build()orders the answers by the prompt's questions and checks that each question is answered by an answer of the matching type. -
getResults
Description copied from interface:ModelResponseRetrieves the list of generated outputs by the AI model.- Specified by:
getResultsin interfaceModelResponse<DecisionResult>- Returns:
- the list of generated outputs
-
getResult
The first result, ornullwhen there are none.- Specified by:
getResultin interfaceModelResponse<DecisionResult>- Returns:
- the result generated by the AI model
-
getMetadata
Description copied from interface:ModelResponseRetrieves the response metadata associated with the AI model's response.- Specified by:
getMetadatain interfaceModelResponse<DecisionResult>- Returns:
- the response metadata
-
getAnswers
The answers, keyed by question name, in the order the questions were asked. -
hasAnswer
Whether the question was answered, including by a refusal. -
getAnswer
The answer to the given question. -
getAnswer
The answer to the given question, as the given type. Fails with anIllegalStateExceptionwhen the provider refused to answer. -
getYesNo
-
getChoice
-
getScore
-
isRefused
Whether the provider refused to answer the given question. -
equals
-
hashCode
public int hashCode() -
toString
-