Class JudgeCriterion
java.lang.Object
dev.langchain4j.test.judge.JudgeCriterion
A criterion for a
Judge, written in natural language, for example "mentions the refund amount".
Optionally, it defines when it is satisfied and when it is not, which makes the verdicts more consistent and lets the team
agree on what the criterion means:
JudgeCriterion.from("mentions the refund amount")
.satisfiedWhen("the response states the amount of money that will be refunded")
.notSatisfiedWhen("the response only says that a refund will be made, without the amount");
A criterion is immutable: satisfiedWhen(String) and notSatisfiedWhen(String) return a new
criterion.-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic JudgeCriterionCreates a criterion, for exampleJudgeCriterion.from("is polite").inthashCode()When this criterion is not satisfied, ornullif not defined.notSatisfiedWhen(String notSatisfiedWhen) Returns a copy of this criterion that defines when it is not satisfied.When this criterion is satisfied, ornullif not defined.satisfiedWhen(String satisfiedWhen) Returns a copy of this criterion that defines when it is satisfied.text()The criterion, written in natural language, for example "is polite".toString()
-
Method Details
-
from
Creates a criterion, for exampleJudgeCriterion.from("is polite"). -
satisfiedWhen
Returns a copy of this criterion that defines when it is satisfied. -
notSatisfiedWhen
Returns a copy of this criterion that defines when it is not satisfied. -
text
The criterion, written in natural language, for example "is polite". -
satisfiedWhen
When this criterion is satisfied, ornullif not defined. -
notSatisfiedWhen
When this criterion is not satisfied, ornullif not defined. -
equals
-
hashCode
-
toString
-