Skip to content

config ¤

SelectionMode ¤

Bases: Enum

Selection modes supported by the retriever.

TOP_K class-attribute instance-attribute ¤

TOP_K = 'top_k'

Selection using Top K.

THRESHOLD class-attribute instance-attribute ¤

THRESHOLD = 'threshold'

Selection using a threshold value on the distance.

ClusterTreeConfig dataclass ¤

ClusterTreeConfig(
    embedding_model: EmbeddingModelLike,
    summarization_model: SummarizationModelLike,
    document_splitter: DocumentSplitterLike,
    clustering_func: ClusteringFunctionLike = raptor_clustering,
    clustering_backend: ClusteringBackendLike | None = None,
    max_length_in_cluster: int = 3500,
    max_num_layers: int = 5,
)

Configuration for ClusterTreeBuilder.

Parameters:

embedding_tokenizer property ¤

embedding_tokenizer: TokenizerLike

Returns:

summarization_tokenizer property ¤

summarization_tokenizer: TokenizerLike

Returns:

TreeRetrieverConfig dataclass ¤

TreeRetrieverConfig(
    embedding_model: EmbeddingModelLike,
    threshold: float = 0.5,
    top_k: int = 5,
    selection_mode: SelectionMode = SelectionMode.TOP_K,
    max_tokens: int = 3500,
)

Configuration for TreeRetriever.

Parameters:

  • embedding_model (EmbeddingModelLike) –

    The embedding model to use.

  • threshold (float, default: 0.5 ) –

    The threshold value for selection when using threshold mode for selection.

  • top_k (int, default: 5 ) –

    The number of top results to return when using top k mode for selection.

  • selection_mode (SelectionMode, default: TOP_K ) –

    The selection mode to use.

  • max_tokens (int, default: 3500 ) –

    The maximum number of tokens to retrieve.

tokenizer property ¤

tokenizer: TokenizerLike

Returns: