Postprocessor_builders

This module contains functionality related to the the postprocessor_builders module for common.builders.

Postprocessor_builders

ColbertRerankBuilder

Builder for creating ColBERT reranking postprocessor.

Provides factory method to create configured ColbertRerank instance.

Source code in src/common/builders/postprocessor_builders.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class ColbertRerankBuilder:
    """Builder for creating ColBERT reranking postprocessor.

    Provides factory method to create configured ColbertRerank instance.
    """

    @staticmethod
    @inject
    def build(configuration: ColbertRerankConfiguration) -> ColbertRerank:
        """Creates a configured ColBERT reranking postprocessor.

        Args:
            configuration: Settings for ColBERT reranking including model and scoring.

        Returns:
            ColbertRerank: Configured reranking postprocessor instance.
        """
        return ColbertRerank(
            top_n=configuration.top_n,
            model=configuration.model.value,
            tokenizer=configuration.tokenizer.value,
            keep_retrieval_score=configuration.keep_retrieval_score,
        )

build(configuration) staticmethod

Creates a configured ColBERT reranking postprocessor.

Parameters:
  • configuration (ColbertRerankConfiguration) –

    Settings for ColBERT reranking including model and scoring.

Returns:
  • ColbertRerank( ColbertRerank ) –

    Configured reranking postprocessor instance.

Source code in src/common/builders/postprocessor_builders.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@staticmethod
@inject
def build(configuration: ColbertRerankConfiguration) -> ColbertRerank:
    """Creates a configured ColBERT reranking postprocessor.

    Args:
        configuration: Settings for ColBERT reranking including model and scoring.

    Returns:
        ColbertRerank: Configured reranking postprocessor instance.
    """
    return ColbertRerank(
        top_n=configuration.top_n,
        model=configuration.model.value,
        tokenizer=configuration.tokenizer.value,
        keep_retrieval_score=configuration.keep_retrieval_score,
    )