Member Junction
    Preparing search index...

    Class BaseRerankerAbstract

    Abstract base class for all reranker implementations. Extends BaseModel to follow MJ conventions for AI model classes.

    Provides common functionality including:

    • Input validation
    • Response standardization
    • Utility methods for sorting and filtering results

    Example usage:

    @RegisterClass(BaseReranker, 'CohereReranker')
    export class CohereReranker extends BaseReranker {
    protected async doRerank(params: RerankParams): Promise<RerankResult[]> {
    // Call Cohere API and return results
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _modelName: string

    Accessors

    Methods

    • Provider-specific reranking implementation. Subclasses must implement this method to perform the actual reranking.

      Implementation requirements:

      • Call the provider's reranking API
      • Map results to RerankResult format
      • Sort results by relevance score (highest first)
      • Preserve document metadata for zero-copy retrieval

      Parameters

      Returns Promise<RerankResult[]>

      Promise resolving to array of RerankResult sorted by relevance

    • Rerank documents based on their relevance to a query. This is the main entry point for reranking operations.

      The method:

      1. Validates input parameters
      2. Calls the provider-specific doRerank() implementation
      3. Applies topK limit if specified
      4. Returns standardized RerankResponse

      Parameters

      • params: RerankParams

        Reranking parameters including query and documents

      Returns Promise<RerankResponse>

      Promise resolving to RerankResponse with reranked results