



Perl client and examples for pgvector, exposing vector data types and similarity queries in PostgreSQL to Perl scripts and apps.
Loading more......
Perl client and examples for using the pgvector PostgreSQL extension, enabling vector data types and similarity queries from Perl applications.
pgvector-perl provides example code and patterns for integrating the pgvector PostgreSQL extension with Perl via DBD::Pg. It demonstrates how to store and query vector embeddings, perform similarity search, and implement hybrid and sparse retrieval workflows from Perl scripts.
pgvector integration for Perl
vector column type provided by the pgvector extension in PostgreSQL.vector(dim) columns.CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));DBD::Pg support
DBD::Pg Perl database driver.Extension setup
pgvector extension in a PostgreSQL database:
CREATE EXTENSION IF NOT EXISTS vector;Vector insertion examples
vector column.Similarity search and retrieval use cases
The repository contains end-to-end examples of embedding generation and querying for common retrieval tasks:
examples/openai/example.pl) that generates embeddings with OpenAI and stores/queries them in PostgreSQL using pgvector.examples/cohere/example.pl) for using Cohere’s binary embeddings with pgvector.examples/hybrid/example.pl) illustrating hybrid search using Reciprocal Rank Fusion (RRF) to combine vector and other signals.examples/sparse/example.pl) showing sparse retrieval workflows and how to integrate scores into PostgreSQL queries.Standalone example script
example.pl at the repository root demonstrates a minimal setup:
vector extension.vector column.Automation / CI configuration
.github/workflows (e.g., for tests or checks) to ensure examples remain functional.pgvector extension.DBD::Pg from Perl to connect to your PostgreSQL database.CREATE EXTENSION IF NOT EXISTS vector;).vector(dim) columns and use the provided examples as templates for inserting embeddings and performing similarity, hybrid, or sparse search queries.