Member Junction
    Preparing search index...

    Cohere implementation of the BaseReranker class, on Cohere's /v2/rerank. A request's CancellationToken is handed to the SDK as its abortSignal, so cancelling it tears the HTTP request down. The query is sent as written: Rerank 5 is a calibrated cross-encoder and does not take instructions that change how relevance is judged.

    Supported models:

    • rerank-v5.0-pro: Flagship cross-encoder reranker (~2B params, 32K context, 100+ languages, Context Focus)
    • rerank-v5.0-fast: High-throughput cross-encoder reranker (~500M params, 32K context, 100+ languages, Context Focus)
    • rerank-v4.0-pro: Previous-generation flagship reranker (32K context, 100+ languages)
    • rerank-v4.0-fast: Previous-generation fast reranker (32K context, 100+ languages)
    • rerank-v3.5: Legacy English reranker (4K context, deprecated upstream)
    • rerank-multilingual-v3.0: Legacy multilingual reranker (4K context)

    Driver class: Registered as both CohereReranker (the name the Cohere reranker models' model-vendor rows carry, and so the one AIRerankerRunner, RerankerService and SearchEngine's CohereReRanker resolve) and CohereLLM.

    API Key: The legacy environment-variable fallback is named after the model-vendor row's driver class: AI_VENDOR_API_KEY__COHERERERANKER for the shipped Cohere reranker models. A Cohere credential binding takes precedence over it.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _modelName: string

    Accessors

    • get apiKey(): string

      Only sub-classes can access the API key

      Returns string

    • get ModelName(): string

      Get the model name used for this reranker

      Returns string

    Methods

    • The response for a call its signal ended, before or during the driver's work. A caller cancellation is classified Cancelled, so it is never failed over; an abort caused by a timeout reads as a retriable network error.

      Parameters

      • signal: AbortSignal
      • error: unknown
      • startTime: number

      Returns RerankResponse

    • Create a standardized error response. Used internally when validation fails or an exception occurs.

      Parameters

      • message: string
      • startTime: number

      Returns RerankResponse

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

      The method:

      1. Validates input parameters, and refuses a call whose CancellationToken is already aborted
      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