Convenient interface for utilizing various ranking models via API and locally.
- Supports multiple ranking models
- Flexible adapter system for different model implementations
- GPU acceleration support (when available)
- Easy-to-use API for document ranking
The SmartRankModel
constructor accepts two parameters:
-
env
: The environment object containing adapter configurations -
opts
: Model configuration options
-
model_key
: Identifier for the model in themodels.json
file -
adapter
: The adapter to use for this model -
use_gpu
: Boolean to enable/disable GPU acceleration (auto-detected if not specified) -
gpu_batch_size
: Batch size for GPU processing (default: 10)
Adapters should be implemented and added to the env.opts.smart_rank_adapters
object. Each adapter should implement the following methods:
-
constructor(model)
: Initialize the adapter -
load()
: Load the model -
rank(query, documents)
: Rank the documents based on the query
MIT License. See LICENSE
file for details.