pgvector-perl
Perl client and examples for pgvector, exposing vector data types and similarity queries in PostgreSQL to Perl scripts and apps.
About this tool
pgvector-perl
Perl client and examples for using the pgvector PostgreSQL extension, enabling vector data types and similarity queries from Perl applications.
- Category: SDKs & Libraries
- Language: Perl
- Ecosystem: PostgreSQL, pgvector
- License: MIT
- Source: https://github.com/pgvector/pgvector-perl
Overview
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.
Features
-
pgvector integration for Perl
- Shows how to use the
vectorcolumn type provided by thepgvectorextension in PostgreSQL. - Demonstrates creating tables with
vector(dim)columns. - Example:
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
- Shows how to use the
-
DBD::Pg support
- Designed to work with the
DBD::PgPerl database driver. - Uses standard DBI/DBD::Pg patterns for connecting to PostgreSQL, preparing statements, and executing queries.
- Designed to work with the
-
Extension setup
- Example code for enabling the
pgvectorextension in a PostgreSQL database:CREATE EXTENSION IF NOT EXISTS vector;
- Example code for enabling the
-
Vector insertion examples
- Demonstrates how to construct vector literals and insert them as parameters via prepared statements.
- Example patterns for inserting multiple vector rows into a
vectorcolumn.
-
Similarity search and retrieval use cases
The repository contains end-to-end examples of embedding generation and querying for common retrieval tasks:- Embeddings search with OpenAI
- Example script (
examples/openai/example.pl) that generates embeddings with OpenAI and stores/queries them in PostgreSQL using pgvector.
- Example script (
- Binary embeddings with Cohere
- Example script (
examples/cohere/example.pl) for using Cohere’s binary embeddings with pgvector.
- Example script (
- Hybrid search with Ollama
- Example script (
examples/hybrid/example.pl) illustrating hybrid search using Reciprocal Rank Fusion (RRF) to combine vector and other signals.
- Example script (
- Sparse search with Text Embeddings Inference
- Example script (
examples/sparse/example.pl) showing sparse retrieval workflows and how to integrate scores into PostgreSQL queries.
- Example script (
- Embeddings search with OpenAI
-
Standalone example script
example.plat the repository root demonstrates a minimal setup:- Connecting to PostgreSQL.
- Enabling the
vectorextension. - Creating a table with a
vectorcolumn. - Inserting embeddings.
- Running basic similarity queries (via SQL using pgvector operators/functions).
-
Automation / CI configuration
- GitHub Actions workflow configuration under
.github/workflows(e.g., for tests or checks) to ensure examples remain functional.
- GitHub Actions workflow configuration under
Usage
- Install and configure PostgreSQL with the
pgvectorextension. - Use
DBD::Pgfrom Perl to connect to your PostgreSQL database. - Enable the extension in your database (
CREATE EXTENSION IF NOT EXISTS vector;). - Define tables with
vector(dim)columns and use the provided examples as templates for inserting embeddings and performing similarity, hybrid, or sparse search queries.
Pricing
- Open-source under the MIT license; no pricing or plans are specified in the repository.
Loading more......
Information
Categories
Tags
Similar Products
6 result(s)COBOL bindings and examples for pgvector, letting legacy COBOL systems interact with PostgreSQL as a vector database.
Crystal language client for pgvector, providing idiomatic Crystal access to vector operations in PostgreSQL.
.NET (C#, F#, Visual Basic) library for pgvector that exposes vector storage and similarity queries on PostgreSQL to .NET applications.
Elixir wrapper and examples for pgvector, integrating PostgreSQL-based vector search into Elixir ecosystems like Phoenix.
Erlang client and examples for pgvector, providing tools to run vector operations against PostgreSQL from Erlang systems.
Gleam language client and examples for pgvector, allowing Gleam applications to perform vector similarity search using PostgreSQL.