Pgvector Handshake
Export Chonkie’s Chunks into a PostgreSQL database with pgvector.
The PgvectorHandshake
class provides seamless integration between Chonkie’s chunking system and PostgreSQL with pgvector. It uses the vecs client library from Supabase underneath to provide a higher-level API with automatic indexing, metadata filtering, and simplified connection management.
Store your Chonkie chunks in PostgreSQL with vector embeddings and perform semantic search without ever leaving the Chonkie SDK.
Installation
Before using the Pgvector handshake, make sure to install the required dependencies:
You’ll also need PostgreSQL with the pgvector extension installed:
Initialization
Usage
Parameters
An existing vecs.Client instance. If provided, other connection parameters are ignored.
PostgreSQL host address.
PostgreSQL port number.
PostgreSQL database name.
PostgreSQL username.
PostgreSQL password.
Full PostgreSQL connection string. If provided, individual connection parameters are ignored.
Name of the collection to store chunks in.
Embedding model to use. Can be a model name or a BaseEmbeddings instance.
Number of dimensions for the vector embeddings. If not provided, will be inferred from the embedding model.