Retrieval

The current retrieval entry point is mandol.retrieval.MultiRetriever. Pre-refactor retrieval designs are retained only under docs/archive/.

Available methods

RetrievalMethod currently includes:

  • BM25 / "bm25"

  • COSINE_SIMILARITY / "cosine" or "cosine_similarity"

  • SPLADE / "splade"

  • GRAPH_TRAVERSAL / "graph"

  • HYBRID / "hybrid"

  • GRAPH_CONTEXT_EXPANSION / "graph_context_expansion"

Async reranking with vLLM

If RERANKER_BACKEND=vllm is set, local neural rerankers must use async retrieval paths:

results = await retriever.smart_search_async(
    "query",
    methods=["bm25", "cosine"],
    rerank_method="baai",
)

The sync APIs intentionally raise for this backend/method combination to avoid blocking a vLLM HTTP rerank path incorrectly.

Three-tower retrieval

mandol.triple_retrieval.TripleTowerRetriever orchestrates hierarchical, entity-relation and episodic retrieval over already-built memory spaces.

from mandol.triple_retrieval import TripleTowerConfig, TripleTowerRetriever

tower = TripleTowerRetriever(graph, config=TripleTowerConfig(final_top_k=10))
result = tower.search("What changed in the Q2 delivery plan?")

The three-tower package is retrieval-facing. Use mandol.auto_builder when memory spaces must be constructed before retrieval.