Skip to main content

Retrieval Module

The Retrieval module provides concrete implementations of retrieval strategies for finding relevant documents from vector stores.

Import

Quick Example

For retriever registry lookups, call register_default_adapters() once at startup — importing retriever classes no longer auto-registers them (PraisonAI 4.6.156+). See Registering the built-in adapters.

Features

  • Multiple retrieval strategies (Basic, Fusion, Recursive, AutoMerge)
  • Reciprocal Rank Fusion for multi-query retrieval
  • LLM-powered query expansion
  • Recursive depth-limited retrieval
  • Adjacent chunk merging for context

Classes

BasicRetriever

Simple vector similarity retrieval.
Parameters:

FusionRetriever

Multi-query retrieval with Reciprocal Rank Fusion (RRF).
Parameters:

RecursiveRetriever

Depth-limited recursive retrieval with follow-up queries.
Parameters:

AutoMergeRetriever

Retrieves and merges adjacent chunks from the same document.
Parameters:

Methods

retrieve(query, top_k=None, filter=None)

Retrieve documents matching the query. Parameters:
  • query (str): Search query
  • top_k (int, optional): Override default result count
  • filter (dict, optional): Metadata filter
Returns: List[RetrievalResult] - Matching documents with scores

aretrieve(query, top_k=None, filter=None)

Async retrieval that offloads the blocking body via asyncio.to_thread(...), so calling it from an event loop no longer freezes it. Authors of custom retrievers on a natively-async provider should override aretrieve and await the native call directly — see Native async in custom retrievers / rerankers.

Example: Fusion Retrieval with LLM

Strategy Selection Guide

CLI Usage