Common utilities and models for Azure PostgreSQL AI integrations.
Check if the connection to Azure Database for PostgreSQL is valid and required extensions are installed.
:param conn: Async connection to the Azure Database for PostgreSQL. :type conn: AsyncConnection :param required_extensions: List of required extensions to check if they are installed. :type required_extensions: list[Extension] :raises RuntimeError: If the connection check fails or required extensions are not installed.
Check if the connection to Azure Database for PostgreSQL is valid and required extensions are installed.
:param conn: Connection to the Azure Database for PostgreSQL. :type conn: Connection :param required_extensions: List of required extensions to check if they are installed. :type required_extensions: list[Extension] :raises RuntimeError: If the connection check fails or required extensions are not installed.
Create required extensions in the Azure Database for PostgreSQL connection.
:param conn: Connection to the Azure Database for PostgreSQL. :type conn: Connection :param required_extensions: List of required extensions to create. :type required_extensions: list[Extension] :raises Exception: If the connection is not valid or if an error occurs during extension creation.
HNSW algorithm settings.
Provides build-time and (via :class:HNSWSearchParams) search-time
parameters for HNSW vector indexes.
:param m: The maximum number of connections per layer for HNSW index building. :type m: PositiveInt | None :param ef_construction: The size of the dynamic candidate list for constructing the HNSW graph. :type ef_construction: PositiveInt | None
If ef_construction is not at least twice the value of m, a
ValueError will be raised during validation.
Base class for vector index algorithms and their settings.
Subclasses provide index build-time settings via :meth:build_settings and
the default search-time settings via :meth:default_search_params.
The generic type parameter SP is a :class:SearchParams subtype that
models the search-time parameters for the algorithm.
:param op_class: The operator class to use for the vector index. :type op_class: VectorOpClass :param maintenance_work_mem: The amount of memory to use for maintenance operations. :type maintenance_work_mem: str | None :param max_parallel_maintenance_workers: The maximum number of parallel workers for maintenance operations. :type max_parallel_maintenance_workers: NonNegativeInt | None :param max_parallel_workers: The maximum number of parallel workers for query execution. :type max_parallel_workers: NonNegativeInt | None
Async connection pool for Azure Database for PostgreSQL connections.
Base connection information for Azure Database for PostgreSQL connections.
:param host: Hostname of the Azure Database for PostgreSQL server. :type host: str | None :param dbname: Name of the database to connect to. :type dbname: str :param port: Port number for the connection. :type port: int :param credentials: Credentials for authentication. :type credentials: BasicAuth | AsyncTokenCredential :param sslmode: SSL mode for the connection. :type sslmode: SSLMode
Connection pool for Azure Database for PostgreSQL connections.
Basic username/password authentication for Azure Database for PostgreSQL connections.
:param username: Username for the connection. :type username: str :param password: Password for the connection. :type password: str
Base connection information for Azure Database for PostgreSQL connections.
:param host: Hostname of the Azure Database for PostgreSQL server. :type host: str | None :param dbname: Name of the database to connect to. :type dbname: str :param port: Port number for the connection. :type port: int :param sslmode: SSL mode for the connection. :type sslmode: SSLMode :param credentials: Credentials for the connection. :type credentials: BasicAuth | TokenCredential
DiskANN algorithm settings.
Provides build-time and (via :class:DiskANNSearchParams) search-time
parameters for DiskANN vector indexes.
:param max_neighbors: The maximum number of edges per node in the graph. :type max_neighbors: PositiveInt | None :param l_value_ib: The value of the L parameter for DiskANN index building. :type l_value_ib: PositiveInt | None :param product_quantized: Whether to use product quantization (PQ) for the index. :type product_quantized: bool | None :param pq_param_num_chunks: Number of chunks for product quantization (PQ). :type pq_param_num_chunks: NonNegativeInt | None :param pq_param_training_samples: Number of training samples for product quantization (PQ). :type pq_param_training_samples: NonNegativeInt | None
If product_quantized is True, pq_param_num_chunks and
pq_param_training_samples can be provided. Otherwise, these parameters
are invalid and raise a ValueError during validation.
Enumeration for DiskANN iterative scan modes.
Search-time parameters for DiskANN indexes.
All settings are exported with the diskann. prefix when used in SQL.
:param l_value_is: The value of the L parameter for DiskANN index searching. :type l_value_is: PositiveInt | None :param iterative_search: The iterative search mode for DiskANN index searching. :type iterative_search: DiskANNIterativeScanMode | None
Model representing a PostgreSQL extension.
:param ext_name: Name of the extension to be created, checked or dropped. :type ext_name: str :param ext_version: Optional version of the extension to be created or checked. :type ext_version: str | None :param schema_name: Optional schema name where the extension should be created or checked. :type schema_name: str | None :param cascade: Whether to automatically install the extension dependencies or drop the objects that depend on the extension. :type cascade: bool
Enumeration for HNSW iterative scan modes.
Search-time parameters for HNSW indexes.
All settings are exported with the hnsw. prefix when used in SQL.
:param ef_search: Size of the dynamic candidate list for HNSW index searching.
:type ef_search: PositiveInt | None
:param iterative_scan: The iterative search mode for HNSW index searching.
:type iterative_scan: HNSWIterativeScanMode | None
:param max_scan_tuples: The maximum number of tuples to visit during HNSW index
searching.
:type max_scan_tuples: PositiveInt | None
:param scan_mem_multiplier: The maximum amount of memory to use, as a multiple
of work_mem, during HNSW index searching.
:type scan_mem_multiplier: PositiveFloat | None
IVF-Flat algorithm settings.
Provides build-time and (via :class:IVFFlatSearchParams) search-time
parameters for IVF-Flat vector indexes.
:param lists: The number of inverted lists to use for IVF-Flat indexing. :type lists: PositiveInt | None
Enumeration for IVFFlat iterative scan modes.
Search-time parameters for IVF-Flat indexes.
All settings are exported with the ivfflat. prefix when used in SQL.
:param probes: The number of probes to use during IVF-Flat index searching. :type probes: PositiveInt | None :param iterative_scan: The iterative search mode for IVF-Flat index searching. :type iterative_scan: IVFFlatIterativeScanMode | None :param max_probes: The maximum number of probes to use during IVF-Flat index searching. :type max_probes: PositiveInt | None
SSL mode for Azure Database for PostgreSQL connections.
Enumeration for operator classes used in vector indexes.
Enumeration for vector types used in vector similarity search.
LangChain VectorStore backed by Azure Database for PostgreSQL (async).
The store validates or creates the backing table on initialization, and optionally discovers an existing vector index configuration. It supports inserting, deleting, fetching by id, similarity search, and MMR search.
Fields such as schema_name, table_name, and column names control the
schema layout. embedding_type, embedding_dimension, and
embedding_index describe the vector column and its index behavior.
Metadata can be stored in a single JSONB column by passing a string (default
"metadata"), in multiple typed columns via a list of strings/tuples, or
disabled by setting metadata_columns=None.
:param embedding: The embedding model to use for embedding vector generation. :type embedding: Embeddings | None :param connection: The database connection or connection pool to use. :type connection: AsyncConnection | AsyncConnectionPool :param schema_name: The name of the database schema to use. :type schema_name: str :param table_name: The name of the database table to use. :type table_name: str :param id_column: The name of the column containing document IDs (UUIDs). :type id_column: str :param content_column: The name of the column containing document content. :type content_column: str :param embedding_column: The name of the column containing document embeddings. :type embedding_column: str :param embedding_type: The type of the embedding vectors. :type embedding_type: VectorType | None :param embedding_dimension: The dimensionality of the embedding vectors. :type embedding_dimension: PositiveInt | None :param embedding_index: The algorithm used for indexing the embedding vectors. :type embedding_index: Algorithm | None :param _embedding_index_name: (internal) The name of the discovered or created index. :type _embedding_index_name: str | None :param metadata_columns: The columns to use for storing metadata. :type metadata_columns: list[str] | list[tuple[str, str]] | str | None
LangChain VectorStore backed by Azure Database for PostgreSQL (sync).
The store validates or creates the backing table on initialization, and optionally discovers an existing vector index configuration. It supports inserting, deleting, fetching by id, similarity search, and MMR search.
Fields such as schema_name, table_name, and column names control the
schema layout. embedding_type, embedding_dimension, and
embedding_index describe the vector column and its index behavior.
Metadata can be stored in a single JSONB column by passing a string (default
"metadata"), in multiple typed columns via a list of strings/tuples, or
disabled by setting metadata_columns=None.
:param embedding: The embedding model to use for embedding vector generation. :type embedding: Embeddings | None :param connection: The database connection or connection pool to use. :type connection: Connection | ConnectionPool :param schema_name: The name of the database schema to use. :type schema_name: str :param table_name: The name of the database table to use. :type table_name: str :param id_column: The name of the column containing document IDs (UUIDs). :type id_column: str :param content_column: The name of the column containing document content. :type content_column: str :param embedding_column: The name of the column containing document embeddings. :type embedding_column: str :param embedding_type: The type of the embedding vectors. :type embedding_type: VectorType | None :param embedding_dimension: The dimensionality of the embedding vectors. :type embedding_dimension: PositiveInt | None :param embedding_index: The algorithm used for indexing the embedding vectors. :type embedding_index: Algorithm | None :param _embedding_index_name: (internal) The name of the discovered or created index. :type _embedding_index_name: str | None :param metadata_columns: The columns to use for storing metadata. :type metadata_columns: list[str] | list[tuple[str, str]] | str | None
Common utilities and models for LangChain integration.
Common utilities and models for Azure Database for PostgreSQL operations.