indexers.hooks.default_hooks.postprocessing.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.