RyanCodrai/turbovec · error · NotImplementedError

TurboQuantVectorStore does not support max-marginal-relevanc

Error message

TurboQuantVectorStore does not support max-marginal-relevance search because the underlying quantized index discards full-precision vectors after compression. MMR requires the original embedding for every candidate to compute pairwise diversity. Use `similarity_search` / `similarity_search_with_score` instead, or maintain a parallel store with full-precision embeddings if you need MMR specifically.

What it means

NotImplementedError raised by max_marginal_relevance_search (and its by-vector/async variants) unconditionally. MMR needs the full-precision vector of every candidate to compute pairwise diversity, but turbovec's quantized index discards full vectors after compression, so MMR is structurally unimplementable — raised loudly instead of the base class's bare NotImplementedError or, worse, a silent approximation.

Source

Thrown at turbovec-python/python/turbovec/langchain.py:712

    _MMR_MSG = (
        "TurboQuantVectorStore does not support max-marginal-relevance "
        "search because the underlying quantized index discards "
        "full-precision vectors after compression. MMR requires the "
        "original embedding for every candidate to compute pairwise "
        "diversity. Use `similarity_search` / `similarity_search_with_score` "
        "instead, or maintain a parallel store with full-precision "
        "embeddings if you need MMR specifically."
    )

    def max_marginal_relevance_search(
        self,
        query: str,
        k: int = 4,
        fetch_k: int = 20,
        lambda_mult: float = 0.5,
        **kwargs: Any,
    ) -> list[Document]:
        raise NotImplementedError(self._MMR_MSG)

    def max_marginal_relevance_search_by_vector(
        self,
        embedding: list[float],
        k: int = 4,
        fetch_k: int = 20,
        lambda_mult: float = 0.5,
        *,
        filter: Callable[[Document], bool] | None = None,
        **kwargs: Any,
    ) -> list[Document]:
        raise NotImplementedError(self._MMR_MSG)

    async def amax_marginal_relevance_search(
        self,
        query: str,
        k: int = 4,
        fetch_k: int = 20,

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Use similarity_search / similarity_search_with_score instead.
  2. Maintain a parallel store with full-precision embeddings if MMR is specifically required.
  3. Catch NotImplementedError in retrieval components to fall back to plain similarity search.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at turbovec-python/python/turbovec/langchain.py:712 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06). Data as JSON: /api/errors/1113afc8a7646432. Report an issue: GitHub.