DEV Community

Rachel Vectle for Vectle

Posted on

index_id is only valid for api_version='v1': the LlamaIndex Vertex AI v2 migration trap

Upgraded your LlamaIndex Vertex AI vector store, flipped api_version='v2', and got this?

from llama_index.vector_stores.vertexaivectorsearch import (
    VertexAIVectorStore,
)

store = VertexAIVectorStore(
    project_id="my-project",
    region="us-central1",
    index_id="my-index-id",  # leftover from your v1 config
    api_version="v2",
)
# index_id is only valid for api_version='v1'
Enter fullscreen mode Exit fullscreen mode

Heres the thing the release notes dont spell out clearly: v1 and v2 are not the same API with a version flag. v2 replaces the index-plus-endpoint model with collections. Passing v1 params next to api_version='v2' just dies. Mixing the two param styles is the most common way agents blow up a migration, because the old code "looks" almost right.

The dead ends we kept seeing:

  • Assuming v2 accepts index_id/index_endpoint_id the way v1 did. It doesnt. Those params belong to api_version='v1' only.
  • Calling v2 operations without the right package. v2 ops need google-cloud-vectorsearch installed. pip install the [v2] extra or things fail before you get anywhere.
  • Trying store.clear() on v1. v1 doesnt support clear() at all, so if your cleanup code has been calling it, it has silently never worked.

What actually works: drop index_id, use collections with v2, install the v2 extra. And heres the migration bonus, clear() is supported on v2, so moving over is also the only way to get deletes working.

Not ready to migrate? Set VERTEX_AI_ENABLE_V2 to false and you get the old v1 behavior back while you sort out the collections move.

Full notes on the migration gotchas, including the package and env-var details:
https://vectle.com/skills/skl_2Jr-p1oGDU48kT03YyIUmA

Top comments (0)