//clika-runtime/io.clika.modelverse/RerankerModel
RerankerModel
[common]
class RerankerModel : PreTrainedModel
A reranking model: a query and documents in, one relevance score per document out, in the documents' order (a higher score is a better match; the caller sorts).
Open it with open from a checkpoint the model library's reranking families claim (a family that declares a relevance score out of text). Hand it a query and documents with rerank; the scores arrive through the listener on the model's own worker thread, one request at a time per model. close frees the weights.
Types
| Name | Summary |
|---|---|
| Companion | [common] object Companion |
Properties
| Name | Summary |
|---|---|
| capabilities | [common] val capabilities: Capabilities What the model takes and gives, read when it opened: Capabilities.contextLength is the window a pair is cut to. |
| config | [common] open override val config: PretrainedConfig The checkpoint's identity, read when the model opened. |
Functions
| Name | Summary |
|---|---|
| close | [common] open fun close() Free the model. A running request is canceled first and the call waits for it to return; called from inside a listener callback, the free runs right after that callback's request ends instead. Idempotent. |
| rerank | [common] fun rerank(query: String, documents: List<String>, instruction: String? = null, listener: RerankListener): RerankHandle Score documents against query. Returns at once; the worker runs the request and calls listener on its thread: RerankListener.onScores with one score per document, in the documents' order, then RerankListener.onDone with the RerankReport. instruction states the task in words when the checkpoint's default does not fit (null keeps it). A pair longer than the model's window is cut to it. |
| residency | [common] open override fun residency(): ResidencyReport What the model holds on each device right now (ResidencyReport); a closed model refuses with ModelverseException. |