RyanCodrai/turbovec · error · ValueError

TurboQuantVectorStore requires a pre-computed query_embeddin

Error message

TurboQuantVectorStore requires a pre-computed query_embedding (is_embedding_query=True).

What it means

TurboQuantVectorStore (llama_index integration) only supports embedding-based queries. Because turbovec quantizes vectors to low precision, it cannot re-embed a raw query string itself, so query() demands a pre-computed query_embedding. Calling query() without one (i.e. is_embedding_query=False) is rejected with this ValueError.

Source

Thrown at turbovec-python/python/turbovec/llama_index.py:804

    def query(self, query: VectorStoreQuery, **_: Any) -> VectorStoreQueryResult:
        # MMR / SVM / LINEAR_REGRESSION / HYBRID etc. all need access to
        # full-precision vectors (for pairwise diversity, learned scoring,
        # or sparse-dense fusion). turbovec discards full precision after
        # quantization, so any non-DEFAULT mode is unsupportable here.
        # Raise loudly instead of silently treating it as DEFAULT, which
        # the previous impl did and which let callers think they were
        # getting e.g. MMR diversity when they were not.
        if query.mode != VectorStoreQueryMode.DEFAULT:
            raise NotImplementedError(
                f"TurboQuantVectorStore does not support query mode "
                f"{query.mode!r}. Only VectorStoreQueryMode.DEFAULT is "
                "supported — MMR / SVM / hybrid modes need access to "
                "full-precision vectors which turbovec discards after "
                "quantization. Maintain a parallel store with full vectors "
                "if you need a non-default scoring mode."
            )
        if query.query_embedding is None:
            raise ValueError(
                "TurboQuantVectorStore requires a pre-computed query_embedding "
                "(is_embedding_query=True)."
            )
        qvec = np.asarray(query.query_embedding, dtype=np.float32)
        if qvec.ndim == 1:
            qvec = qvec[None, :]
        # Cosine mode: normalize the query so the raw inner product
        # against unit node vectors is true cosine similarity.
        if self._similarity == COSINE:
            qvec = l2_normalize_rows(qvec)
        if not qvec.flags["C_CONTIGUOUS"]:
            qvec = np.ascontiguousarray(qvec)

        if len(self._index) == 0:
            return VectorStoreQueryResult(nodes=[], similarities=[], ids=[])

        # Truthiness is deliberate: node_ids=[] / doc_ids=[] mean "no
        # restriction", per the retriever calling convention — see the

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Embed the query text first and pass a QueryWithEmbedding with is_embedding_query=True and query_embedding set.
  2. Use llama_index's retriever (TurboQuantVectorStore as the store behind an index) so the embedding step happens automatically.
  3. If you need text-query support, maintain a parallel full-precision store; turbovec discards full vectors after quantization.

Example fix

// before
results = store.query(Query(query_str="hello"))
// after
qvec = embed_model.get_query_embedding("hello")
results = store.query(QueryWithEmbedding(
    query_str="hello",
    query_embedding=qvec,
    is_embedding_query=True,
))
Defensive patterns

Strategy: validation

Validate before calling

if getattr(query, 'query_embedding', None) is None:
    query = embed_and_wrap(query.query_str)  # produce QueryWithEmbedding(is_embedding_query=True)

Type guard

def has_embedding(q) -> bool:
    return getattr(q, 'query_embedding', None) is not None

Prevention

When it happens

Trigger: Calling store.query(query) where query.query_embedding is None — typically a QueryWithEmbedding built from a plain text query without is_embedding_query=True, or a Query object whose embedding was never populated.

Common situations: Migrating from llama_index's SimpleVectorStore (which embeds query text internally) to TurboQuantVectorStore; calling query() directly with a text-only Query instead of going through the embedding-retriever pipeline; custom retriever code that skips the embed step.

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/ec54e40c754ba3b0. Report an issue: GitHub.