Argument parsing with structured class.
Project description
ReRanker
ReRanker for hybrid retrieval.
Installation
pip install reranker
Usage
from datetime import datetime, timedelta
from reranker import ReRanker, CrossEncoderClient, TimeDecayRanker
reranker = ReRanker(
steps=[
CrossEncoderClient(
model_name="cross-encoder/ms-marco-MiniLM-L-6-v2",
addr="http://localhost:8000",
),
TimeDecayRanker(decay_rate=0.5),
]
)
reranker.rank(
query="What is the capital of France?",
docs=[
"Paris is the capital of France.",
"The Eiffel Tower is in Paris.",
"The Louvre is in Paris.",
],
)
reranker.rank(
query=Record(
text="What is the capital of France?",
timestamp=datetime.now(),
),
docs=[
Record(
text="Paris is the capital of France.",
timestamp=datetime.now() - timedelta(days=1),
),
Record(
text="The Eiffel Tower is in Paris.",
timestamp=datetime.now() - timedelta(days=2),
),
Record(
text="The Louvre is in Paris.",
timestamp=datetime.now() - timedelta(days=3),
),
]
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reranker-0.1.0.tar.gz
(9.6 kB
view details)
Built Distribution
File details
Details for the file reranker-0.1.0.tar.gz
.
File metadata
- Download URL: reranker-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8058ee9e570ce8c965b4e10447829c538dc8a9edf325162fc9f3341bb6deeb37 |
|
MD5 | c7399c4ca0b81a546bb1e45948742e19 |
|
BLAKE2b-256 | 9d61e3663465f8c4fc269d93825cab8ad83fd1704b8ca91bcc3d1091bbb6c380 |
File details
Details for the file reranker-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: reranker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 006130f61bad704d582093e3c2827c8378e1d862b119124767dfa944bd4f7e56 |
|
MD5 | 3dab8fd521b9d870864204491e979918 |
|
BLAKE2b-256 | 3dd87d5bec7eb3e07b7a5f6bf0035c3d6aeff0bdb232d3d0270f60be2bd28808 |