Ireranker¶
Classes¶
- class arshai.core.interfaces.ireranker.IRerankInput(**data)[source]¶
Bases:
IDTORepresents the input for reranking.
- query¶
The search query
- documents¶
List of documents to rerank
- config¶
Optional configuration for the reranking process
- model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class arshai.core.interfaces.ireranker.IReranker(*args, **kwargs)[source]¶
Bases:
ProtocolInterface defining the contract for rerankers. Any reranker implementation must conform to this interface.
- rerank(input)[source]¶
Rerank the documents based on their relevance to the query.
- Parameters:
input (
IRerankInput) – IRerankInput containing query, documents and optional config- Return type:
- Returns:
List of reranked Document objects
- async arerank(input)[source]¶
Asynchronously rerank the documents based on their relevance to the query.
- Parameters:
input (
IRerankInput) – IRerankInput containing query, documents and optional config- Return type:
- Returns:
List of reranked Document objects
- __init__(*args, **kwargs)¶