{"record":{"id":"fe08d90a0b30301e","repo":"RyanCodrai/turbovec","slug":"embedder-is-required-turbovec-needs-the-embedde","errorCode":null,"errorMessage":"`embedder` is required; turbovec needs the embedder's `dimensions` to size the underlying index.","messagePattern":"`embedder` is required; turbovec needs the embedder's `dimensions` to size the underlying index\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"turbovec-python/python/turbovec/agno.py","lineNumber":183,"sourceCode":"            would require an external BM25/lexical index.)\n        :param distance: :class:`Distance.cosine` (default) or\n            :class:`Distance.max_inner_product` — see the class\n            docstring. :class:`Distance.l2` raises :class:`ValueError`.\n            Fixed for the lifetime of the store.\n        :param reranker: Optional Agno reranker applied to the result set\n            after vector retrieval.\n        :param path: Optional directory for save/load persistence. When\n            given to the constructor, :meth:`create` loads existing data\n            from this path if present.\n        \"\"\"\n        super().__init__(\n            id=id,\n            name=name,\n            description=description,\n            similarity_threshold=similarity_threshold,\n        )\n        if embedder is None:\n            raise ValueError(\n                \"`embedder` is required; turbovec needs the embedder's \"\n                \"`dimensions` to size the underlying index.\"\n            )\n        if embedder.dimensions is None:\n            raise ValueError(\"Embedder.dimensions must be set.\")\n        if bit_width not in (2, 3, 4):\n            raise ValueError(f\"bit_width must be 2, 3, or 4, got {bit_width}\")\n        if search_type != SearchType.vector:\n            raise ValueError(\n                f\"TurboQuantVectorDb only supports search_type=SearchType.vector; \"\n                f\"got {search_type}. Use LanceDb / Chroma / etc. for keyword \"\n                f\"or hybrid search.\"\n            )\n        if distance not in (Distance.cosine, Distance.max_inner_product):\n            raise ValueError(\n                f\"TurboQuantVectorDb supports distance=Distance.cosine or \"\n                f\"distance=Distance.max_inner_product; got {distance}. \"\n                f\"L2 distance is not supported by the underlying \"","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/RyanCodrai/turbovec/blob/ccab9f325e6ce2a270a87daf01ae4e443bcf2d49/turbovec-python/python/turbovec/agno.py#L165-L201","documentation":"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.","triggerScenarios":"Constructing TurboQuantVectorDb without passing embedder (None or omitted), e.g. TurboQuantVectorDb(name='db') or delegating to a factory that leaves embedder unset.","commonSituations":"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.","solutions":["Pass an Embedder instance (e.g. OpenAIEmbedder) to the constructor.","Ensure your factory/config path always constructs and supplies the embedder.","Read embedder.dimensions after construction to confirm it is set — it is required next."],"exampleFix":"// before\nTurboQuantVectorDb(name=\"kb\")\n// after\nTurboQuantVectorDb(name=\"kb\", embedder=OpenAIEmbedder())","handlingStrategy":"type-guard","validationCode":"if embedder is None:\n    raise ValueError(\"TurboQuantVectorDb requires an embedder\")","typeGuard":"def has_embedder(db_kwargs: dict) -> bool:\n    return isinstance(db_kwargs.get(\"embedder\"), Embedder)","tryCatchPattern":"try:\n    db = TurboQuantVectorDb(**kwargs)\nexcept ValueError as e:\n    if \"embedder\" in str(e):\n        kwargs[\"embedder\"] = default_embedder()\n        db = TurboQuantVectorDb(**kwargs)","preventionTips":["Always construct the embedder in the same factory that builds the vector DB.","Use keyword arguments, never rely on defaults being sufficient.","Add a unit test asserting the DB constructs with your real embedder config."],"tags":["constructor","validation","agno"],"backgroundTag":"missing-required-argument","analyzedSha":"ccab9f325e6ce2a270a87daf01ae4e443bcf2d49","analyzedAt":"2026-09-06T08:39:18.516Z","contentChangedAt":"2026-09-06T08:39:18.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}