Package dev.langchain4j.adaptiverag
Class AnswerGrader
java.lang.Object
dev.langchain4j.adaptiverag.AnswerGrader
- All Implemented Interfaces:
Function<AnswerGrader.Arguments,
AnswerGrader.Score>
public class AnswerGrader
extends Object
implements Function<AnswerGrader.Arguments,AnswerGrader.Score>
Class to grade answers based on whether they address a given question.
Implements the Function interface to take in Arguments and output a Score.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents the arguments for a structured prompt, encapsulating both a user's question and an LLM-generated response.static class
Binary score to assess answer addresses question. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(AnswerGrader.Arguments args) Applies the given arguments to generate a score using a language model.
-
Constructor Details
-
AnswerGrader
public AnswerGrader()
-
-
Method Details
-
apply
Applies the given arguments to generate a score using a language model.- Specified by:
apply
in interfaceFunction<AnswerGrader.Arguments,
AnswerGrader.Score> - Parameters:
args
- The input arguments for the prompt.- Returns:
- The generated score based on the prompt and model configuration.
-