Package dev.langchain4j.adaptiverag
Class RetrievalGrader
java.lang.Object
dev.langchain4j.adaptiverag.RetrievalGrader
- All Implemented Interfaces:
Function<RetrievalGrader.Arguments,
RetrievalGrader.Score>
public class RetrievalGrader
extends Object
implements Function<RetrievalGrader.Arguments,RetrievalGrader.Score>
The RetrievalGrader class implements a function to assess the relevance of a retrieved document
to a user's question. It uses an AI service to generate a binary score ('yes' or 'no') indicating relevance.
This class relies on external services for processing and grading documents, making it dependent
on network availability and the stability of the used API.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a structure for holding the arguments needed to process a user's query.static class
A static class that represents a score in a binary format. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionApplies the provided arguments to generate a score using a chat language model.
-
Constructor Details
-
RetrievalGrader
public RetrievalGrader()
-
-
Method Details
-
apply
Applies the provided arguments to generate a score using a chat language model.- Specified by:
apply
in interfaceFunction<RetrievalGrader.Arguments,
RetrievalGrader.Score> - Parameters:
args
- The arguments containing the necessary information for processing.- Returns:
- A
RetrievalGrader.Score
object representing the result of the processing.
-