Class ScaNNIndex (0.4.0)

ScaNNIndex(name: typing.Optional[str] = None, index_type: str = 'ScaNN', distance_strategy: llama_index_alloydb_pg.indexes.DistanceStrategy = <factory>, partial_indexes: typing.Optional[list[str]] = None, num_leaves: int = 5, *, mode: typing.Optional[str] = None)

ScaNN index configuration for AlloyDB.

See https://cloud.google.com/alloydb/docs/ai/create-scann-index.

Parameters

Name Description
num_leaves int

Number of partitions. Used by the default and "MANUAL" modes. Defaults to 5.

mode Optional[str]

Keyword-only. "AUTO" lets AlloyDB choose the index parameters, so num_leaves and quantizer are not sent. "MANUAL" sends num_leaves and quantizer explicitly. Case-insensitive. Defaults to None, which emits the same index options as previous releases. "AUTO" needs a table with at least 10,000 rows. On a smaller table it needs deferred index creation (Preview): turn on the scann.enable_index_maintenance flag and scann.enable_index_with_insufficient_data or scann.enable_preview_features. AlloyDB then builds the index when the table reaches 10,000 rows. See https://cloud.google.com/alloydb/docs/ai/create-scann-index. The set_maintenance_work_mem sizing is based on num_leaves, so it doesn't apply to "AUTO".

Methods

index_options

index_options() -> str

Set index query options for vector store initialization.