Skip to content

pgvector

Enterprise

Climate+Tech Open License for Good. This is not the open core. report_analyst_enterprise/ (PDF viewer, Postgres/pgvector) ships in the enterprise Docker image. report_analyst_api/, report_analyst_jobs/, and report_analyst_search_backend/ are separate integration modules under the same license.

This page is report_analyst_enterprise. These helpers check and install the Postgres vector extension used by the enterprise image. The core image uses its own local store and does not call them.

report_analyst_enterprise.database.pgvector_support.check_pgvector_available(connection)

Check if pgvector extension is available in the database.

Parameters:

Name Type Description Default
connection Any

SQLAlchemy connection object

required

Returns:

Type Description
bool

True if pgvector is available, False otherwise

report_analyst_enterprise.database.pgvector_support.setup_pgvector_extension(connection)

Attempt to create pgvector extension (requires superuser privileges).

Parameters:

Name Type Description Default
connection Any

SQLAlchemy connection object

required

Returns:

Type Description
bool

True if extension was created or already exists, False otherwise

report_analyst_enterprise.database.pgvector_support.get_vector_distance_func(embedding_column_name, query_vector, distance_type='cosine')

Get SQL expression for vector distance calculation.

Parameters:

Name Type Description Default
embedding_column_name str

Name of the embedding column

required
query_vector Any

Query vector (numpy array or list)

required
distance_type str

Type of distance ('cosine', 'l2', 'inner_product')

'cosine'

Returns:

Type Description
tuple[str, dict[str, str]]

Tuple of (SQL expression string, parameters dict) for use in ORDER BY clause