Class RefusalAnswer

java.lang.Object
dev.langchain4j.model.decision.response.RefusalAnswer
All Implemented Interfaces:
DecisionAnswer

@Experimental public final class RefusalAnswer extends Object implements DecisionAnswer
The answer to a question that the decision model refused to answer, for example because the input or the question goes against the usage policies of the provider. The other questions of the request can still have regular answers.

Use DecisionResponse.isRefused(String) to check whether a question was refused: the typed accessors of DecisionResponse, such as DecisionResponse.yesNo(String), throw a ContentFilteredException for a refused question.

Since:
1.22.0
  • Method Details