Package dev.langchain4j.model.scoring
Interface ScoringModel
-
- All Implemented Interfaces:
public interface ScoringModelRepresents a model capable of scoring a text against a query. Useful for identifying the most relevant texts when scoring multiple texts against the same query. The scoring model can be employed for re-ranking purposes.
-
-
Method Summary
Modifier and Type Method Description Response<Double>score(String text, String query)Scores a given text against a given query. Response<Double>score(TextSegment segment, String query)Scores a given TextSegment against a given query. abstract Response<List<Double>>scoreAll(List<TextSegment> segments, String query)Scores all provided TextSegments against a given query. -
-
Method Detail
-
score
Response<Double> score(String text, String query)
Scores a given text against a given query.
- Parameters:
text- The text to be scored.query- The query against which to score the text.- Returns:
the score.
-
score
Response<Double> score(TextSegment segment, String query)
Scores a given TextSegment against a given query.
- Parameters:
segment- The TextSegment to be scored.query- The query against which to score the segment.- Returns:
the score.
-
scoreAll
abstract Response<List<Double>> scoreAll(List<TextSegment> segments, String query)
Scores all provided TextSegments against a given query.
- Parameters:
segments- The list of TextSegments to score.query- The query against which to score the segments.- Returns:
the list of scores. The order of scores corresponds to the order of TextSegments.
-
-
-
-