Skip to main content

SentenceTransformers cross-encoder reranker for AgentForge

Project description

agentforge-reranker-sentence-transformers

SentenceTransformers cross-encoder reranker for the AgentForge framework (feat-021 default concrete impl).

Registers as agentforge.rerankers:sentence-transformers and implements the Reranker ABC from agentforge-core.

Installation

pip install agentforge-reranker-sentence-transformers[sentence-transformers]

The [sentence-transformers] extra pulls in sentence-transformers>=3.0 (~500MB for base + one model). Without it, the production factory raises ModuleError with pip remediation.

Usage

from agentforge import Retriever
from agentforge_reranker_sentence_transformers import (
    SentenceTransformersReranker,
)

reranker = SentenceTransformersReranker.from_config(
    model="cross-encoder/ms-marco-MiniLM-L-6-v2",
)
retriever = Retriever(
    store=vector_store,
    embedder=embedding_client,
    reranker=reranker,
    over_fetch_factor=3,
)
results = await retriever.retrieve("how do I deploy?", top_k=5)

Score normalisation

The cross-encoder returns raw logits (typically -10..+10). The reranker applies a sigmoid (1 / (1 + exp(-x))) so returned scores are normalised to (0, 1) — fitting the VectorMatch.score contract from agentforge-core.

License

Apache-2.0.

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file agentforge_reranker_sentence_transformers-0.2.4.tar.gz.

File metadata

File hashes

Hashes for agentforge_reranker_sentence_transformers-0.2.4.tar.gz
Algorithm Hash digest
SHA256 70e725a52b3063fdb928c41640d10ed1ea5b4cca540b3942fac6a2c84a340265
MD5 906e82ccf6a9e08298a828594ce829a1
BLAKE2b-256 048146befe0bb522870a1e34c80f96902e4495fd8a96a38999e819721d522f2d

See more details on using hashes here.

File details

Details for the file agentforge_reranker_sentence_transformers-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for agentforge_reranker_sentence_transformers-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d751083df141d01a4acfed5d7886c19b60b35d1fe2edd262988c1cffda0fca8f
MD5 c3682d0fdfb2f4ce2c889a9283f4df28
BLAKE2b-256 ab60ced7f218aca8ec88e05056dbd20108023d5ee72b8d3d1261082985fdf9d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page