Package dev.langchain4j.model.watsonx
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 class
Builder class for constructingWatsonxScoringModel
instances with configurable parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic WatsonxScoringModel.Builder
builder()
Returns a newWatsonxScoringModel.Builder
instance.scoreAll
(List<TextSegment> segments, String query) Scores all providedTextSegment
s against a given query.scoreAll
(List<TextSegment> segments, String query, com.ibm.watsonx.ai.rerank.RerankParameters parameters) Scores all providedTextSegment
s against a given query using the givenRerankParameters
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.model.scoring.ScoringModel
score, score
-
Method Details
-
scoreAll
Description copied from interface:ScoringModel
Scores all providedTextSegment
s against a given query.- Specified by:
scoreAll
in interfaceScoringModel
- Parameters:
segments
- The list ofTextSegment
s 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
TextSegment
s.
-
scoreAll
public Response<List<Double>> scoreAll(List<TextSegment> segments, String query, com.ibm.watsonx.ai.rerank.RerankParameters parameters) Scores all providedTextSegment
s against a given query using the givenRerankParameters
.- Parameters:
segments
- The list ofTextSegment
s 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
TextSegment
s.
-
builder
Returns a newWatsonxScoringModel.Builder
instance.Example usage:
ScoringModel scoringModel = new WatsonxScoringModel.builder() .url("https://...") // or use CloudRegion .apiKey("...") .projectId("...") .modelId("cross-encoder/ms-marco-minilm-l-12-v2") .build();
-