Class WatsonxScoringModel
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxScoringModel
- All Implemented Interfaces:
ScoringModel
A
ScoringModel implementation that integrates IBM watsonx.ai with LangChain4j.
Example usage:
ScoringModel scoringModel = new WatsonxScoringModel.builder()
.url("https://...") // or use CloudRegion
.apiKey("...")
.projectId("...")
.modelId("cross-encoder/ms-marco-minilm-l-12-v2")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructingWatsonxScoringModelinstances with configurable parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic WatsonxScoringModel.Builderbuilder()Returns a newWatsonxScoringModel.Builderinstance.scoreAll(List<TextSegment> segments, String query) Scores all providedTextSegments against a given query.scoreAll(List<TextSegment> segments, String query, com.ibm.watsonx.ai.rerank.RerankParameters parameters) Scores all providedTextSegments against a given query using the givenRerankParameters.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ScoringModel
score, score
-
Method Details
-
scoreAll
Description copied from interface:ScoringModelScores all providedTextSegments against a given query.- Specified by:
scoreAllin interfaceScoringModel- Parameters:
segments- The list ofTextSegments 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.
-
scoreAll
public Response<List<Double>> scoreAll(List<TextSegment> segments, String query, com.ibm.watsonx.ai.rerank.RerankParameters parameters) Scores all providedTextSegments against a given query using the givenRerankParameters.- Parameters:
segments- The list ofTextSegments to score.query- The query against which to score the segments.parameters- the rerank parameters to use.- Returns:
- the list of scores. The order of scores corresponds to the order of
TextSegments.
-
builder
Returns a newWatsonxScoringModel.Builderinstance.Example usage:
ScoringModel scoringModel = new WatsonxScoringModel.builder() .url("https://...") // or use CloudRegion .apiKey("...") .projectId("...") .modelId("cross-encoder/ms-marco-minilm-l-12-v2") .build();
-