RyanCodrai/turbovec · error · ValueError

`embedder` is required; turbovec needs the embedder's `dimen

Error message

`embedder` is required; turbovec needs the embedder's `dimensions` to size the underlying index.

What it means

TurboQuantVectorDb requires an agno Embedder at construction time because it reads embedder.dimensions to size the underlying quantized index. If embedder is None, __init__ raises a ValueError explaining the requirement.

Source

Thrown at turbovec-python/python/turbovec/agno.py:183

            would require an external BM25/lexical index.)
        :param distance: :class:`Distance.cosine` (default) or
            :class:`Distance.max_inner_product` — see the class
            docstring. :class:`Distance.l2` raises :class:`ValueError`.
            Fixed for the lifetime of the store.
        :param reranker: Optional Agno reranker applied to the result set
            after vector retrieval.
        :param path: Optional directory for save/load persistence. When
            given to the constructor, :meth:`create` loads existing data
            from this path if present.
        """
        super().__init__(
            id=id,
            name=name,
            description=description,
            similarity_threshold=similarity_threshold,
        )
        if embedder is None:
            raise ValueError(
                "`embedder` is required; turbovec needs the embedder's "
                "`dimensions` to size the underlying index."
            )
        if embedder.dimensions is None:
            raise ValueError("Embedder.dimensions must be set.")
        if bit_width not in (2, 3, 4):
            raise ValueError(f"bit_width must be 2, 3, or 4, got {bit_width}")
        if search_type != SearchType.vector:
            raise ValueError(
                f"TurboQuantVectorDb only supports search_type=SearchType.vector; "
                f"got {search_type}. Use LanceDb / Chroma / etc. for keyword "
                f"or hybrid search."
            )
        if distance not in (Distance.cosine, Distance.max_inner_product):
            raise ValueError(
                f"TurboQuantVectorDb supports distance=Distance.cosine or "
                f"distance=Distance.max_inner_product; got {distance}. "
                f"L2 distance is not supported by the underlying "

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Pass an Embedder instance (e.g. OpenAIEmbedder) to the constructor.
  2. Ensure your factory/config path always constructs and supplies the embedder.
  3. Read embedder.dimensions after construction to confirm it is set — it is required next.

Example fix

// before
TurboQuantVectorDb(name="kb")
// after
TurboQuantVectorDb(name="kb", embedder=OpenAIEmbedder())
Defensive patterns

Strategy: type-guard

Validate before calling

if embedder is None:
    raise ValueError("TurboQuantVectorDb requires an embedder")

Type guard

def has_embedder(db_kwargs: dict) -> bool:
    return isinstance(db_kwargs.get("embedder"), Embedder)

Try / catch

try:
    db = TurboQuantVectorDb(**kwargs)
except ValueError as e:
    if "embedder" in str(e):
        kwargs["embedder"] = default_embedder()
        db = TurboQuantVectorDb(**kwargs)

Prevention

When it happens

Trigger: Constructing TurboQuantVectorDb without passing embedder (None or omitted), e.g. TurboQuantVectorDb(name='db') or delegating to a factory that leaves embedder unset.

Common situations: Following examples from other agno vector DBs where embedder is optional; refactoring code that removed the embedder argument; a config object that conditionally supplies an embedder and yields None.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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