Package Classes (0.4.0)

Summary of entries of Classes for llama-index-alloydb-pg.

Classes

AlloyDBChatStore

Chat Store Table stored in an AlloyDB for PostgreSQL database.

AlloyDBDocumentStore

Document Store Table stored in an AlloyDB for PostgreSQL database.

AlloyDBEmbedding

Embedding model that generates embeddings inside AlloyDB.

Texts are embedded with the AlloyDB AI embedding(model_id, content) function, so model_id must be a model registered with model endpoint management, for example text-embedding-005. Each batch of embed_batch_size texts is one SQL statement, and embedding() runs once per row, so a larger batch saves round trips but not model calls. An empty string raises ValueError. The batch methods check their whole input, because LlamaIndex passes the hooks one batch at a time, so a hook could not name the text's position.

The async batch methods embed num_workers batches at a time, each on its own pool connection. DEFAULT_NUM_WORKERS (4) fits the engine's default pool. More workers than the pool allows, or None, 0 or 1 (no limit in llama-index-core), can fail with sqlalchemy.exc.TimeoutError. The sync methods need an engine with a background event loop, such as one from AlloyDBEngine.from_instance or AlloyDBEngine.afrom_instance.

AlloyDBEngine

A class for managing connections to a AlloyDB database.

Column

Column(name: 'str', data_type: 'str', nullable: 'bool' = True)

AlloyDBIndexStore

Index Store Table stored in an AlloyDB for PostgreSQL database.

BaseIndex

BaseIndex(name: Optional[str] = None, index_type: str = 'base', distance_strategy: llama_index_alloydb_pg.indexes.DistanceStrategy =

DistanceStrategy

Enumerator of the Distance strategies.

ExactNearestNeighbor

ExactNearestNeighbor(name: Optional[str] = None, index_type: str = 'exactnearestneighbor', distance_strategy: llama_index_alloydb_pg.indexes.DistanceStrategy =

HNSWIndex

HNSWIndex(name: Optional[str] = None, index_type: str = 'hnsw', distance_strategy: llama_index_alloydb_pg.indexes.DistanceStrategy =

HNSWQueryOptions

HNSWQueryOptions(ef_search: int = 40)

IVFFlatIndex

IVFFlatIndex(name: Optional[str] = None, index_type: str = 'ivfflat', distance_strategy: llama_index_alloydb_pg.indexes.DistanceStrategy =

IVFFlatQueryOptions

IVFFlatQueryOptions(probes: int = 1)

IVFIndex

IVFIndex(name: Optional[str] = None, index_type: str = 'ivf', distance_strategy: llama_index_alloydb_pg.indexes.DistanceStrategy =

IVFQueryOptions

IVFQueryOptions(probes: int = 1)

QueryOptions

API documentation for QueryOptions class.

ScaNNIndex

ScaNN index configuration for AlloyDB.

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

ScaNNQueryOptions

Query options for a ScaNN index.

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

StrategyMixin

API documentation for StrategyMixin class.

AlloyDBModel

A model endpoint registered in AlloyDB AI model endpoint management.

Fields use the create_model argument names, so asdict(model) without model_id can be passed back to it. model_in_transform_fn, model_out_transform_fn and generate_headers_fn are read from the input_transform_fn, output_transform_fn and header_gen_fn view columns.

AlloyDBModelManager

Register, inspect and drop AlloyDB AI model endpoints.

See https://cloud.google.com/alloydb/docs/ai/register-model-endpoint.

AlloyDBRerank

Reranks nodes with AlloyDB AI's google_ml.rank() function.

The ranking runs inside the database through AlloyDB's Vertex AI integration. As listed in https://cloud.google.com/alloydb/docs/ai/rank-rerank-search-results-rag, it needs the google_ml_integration extension 1.5.2 or later, the google_ml_integration.enable_model_support and google_ml_integration.enable_ai_query_engine flags on, the Discovery Engine API enabled and roles/discoveryengine.viewer for the AlloyDB service agent. Nodes with no text (an ImageNode) or only whitespace or format characters are left out. Database errors are raised unchanged. Async apostprocess_nodes needs llama-index-core 0.12.32 or later.

AlloyDBReader

Chat Store Table stored in an AlloyDB for PostgreSQL database.

AlloyDBToolSpec

Tools that run AlloyDB AI functions in the database.

AlloyDBToolSpec(engine).to_tool_list() returns one FunctionTool per function, each with a native async path, ready for an agent such as FunctionAgent. Requires AlloyDB for PostgreSQL 17 or later with the google_ml_integration extension 1.5.7 or later and the google_ml_integration.enable_ai_query_engine and google_ml_integration.enable_preview_ai_functions flags on. See https://cloud.google.com/alloydb/docs/ai/analyze-sentiment.

AlloyDBVectorStore

Google AlloyDB Vector Store class

Modules

chat_store

API documentation for chat_store module.

document_store

API documentation for document_store module.

embeddings

API documentation for embeddings module.

engine

API documentation for engine module.

index_store

API documentation for index_store module.

indexes

API documentation for indexes module.

model_manager

API documentation for model_manager module.

postprocessor

API documentation for postprocessor module.

reader

API documentation for reader module.

tools

API documentation for tools module.

vector_store

API documentation for vector_store module.