Package org.mockserver.llm.codec
Class RerankScoring
java.lang.Object
org.mockserver.llm.codec.RerankScoring
Shared, deterministic rerank scoring used by the rerank codecs (Cohere,
Voyage). Producing one result per candidate document, each scored with a
reproducible relevance score in
(0, 1), sorted descending, then capped
to topN. The response shape is identical across both providers:
{"results":[{"index":N,"relevance_score":F}, ...]}.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe provider-specific envelope wrapping the per-document scores.static final classOne scored, original-index-tagged document. -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponseencode(RerankResponse rerank, List<String> documents, String model, RerankScoring.Envelope envelope) Build the provider-correct rerank HTTP response from the scored documents, using the provider's envelope shape.static List<RerankScoring.Scored>score(RerankResponse rerank, List<String> documents) Score each document and return them sorted by descending relevance, capped totopNwhen set.
-
Method Details
-
score
Score each document and return them sorted by descending relevance, capped totopNwhen set. -
encode
public static HttpResponse encode(RerankResponse rerank, List<String> documents, String model, RerankScoring.Envelope envelope) Build the provider-correct rerank HTTP response from the scored documents, using the provider's envelope shape.
-