Class JudgeRequest
java.lang.Object
dev.langchain4j.test.judge.JudgeRequest
What a
Judge evaluates: a text, the criteria to check it against and, optionally, the
context the text responds to (a user message or a conversation) and the sources it should be
based on.
JudgeRequest request = JudgeRequest.builder()
.text(answer)
.context(JudgeContext.from(question))
.sources(retrievedTexts)
.criteria(
JudgeCriterion.from("says that the return period is 14 days"),
JudgeCriterion.from("contains only claims that are stated in the sources"))
.build();
List<JudgeVerdict> verdicts = judge.evaluate(request).verdicts();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic JudgeRequest.Builderbuilder()Creates a builder of a request: the text to judge and the criteria are required.context()criteria()The criteria to check the text against, never empty.booleaninthashCode()sources()The sources the text should be based on, for example retrieved documents, ornullif not given.text()The text to judge, for example the response of an AI Service.toString()
-
Method Details
-
builder
Creates a builder of a request: the text to judge and the criteria are required. -
text
The text to judge, for example the response of an AI Service. -
context
-
sources
-
criteria
The criteria to check the text against, never empty. -
equals
-
hashCode
-
toString
-