indexers.hooks.default_hooks.postprocessing

indexers.hooks.default_hooks.postprocessing

Classes

Name Description
DeduplicationHook A post-processing hook to remove duplicate knowledgebase entries.
RagHook A post-processing hook to perform Retrieval Augmented Generation.

DeduplicationHook

indexers.hooks.default_hooks.postprocessing.DeduplicationHook(
    score_aggregation_method='max',
)

A post-processing hook to remove duplicate knowledgebase entries.

Designed to operate on a VectorStoreSearchOutput, i.e. the output of the VectorStore.search() method. Deduplicates entries that share the same label within each query’s results, aggregating their scores using the specified method.

Attributes

Name Type Description
score_aggregation_method str The name of the score aggregation method in use. Either “max” or “mean”.
score_aggregator Callable The callable used to aggregate scores for deduplicated entries.

RagHook

indexers.hooks.default_hooks.postprocessing.RagHook(
    context_prompt='',
    response_template='',
    llm_response_parser=None,
    project_id=None,
    api_key=None,
    location='europe-west2',
    model_name='gemini-2.5-flash',
    **client_kwargs,
)

A post-processing hook to perform Retrieval Augmented Generation.

Designed to operate on a VectorStoreSearchOutput, i.e. the output of the VectorStore.search() method. Calls a generative LLM for each unique query in the search output, appending a RAG_response column to the result.

Attributes

Name Type Description
model_name str The name of the generative model to use.
context_prompt str The system prompt providing context to the LLM.
response_template str A template describing the expected output format for each row in the search results.
llm_response_parser Callable A callable for parsing the raw LLM response string into a list of per-row values.
client genai.Client The initialised GenAI client.
config_generator genai.types.GenerateContentConfig The GenerateContentConfig class used to configure LLM calls.
client_kwargs dict Keyword arguments used to initialise the GenAI client.