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:Initialization
Usage
Writing Chunks
Store your chunked text in PostgreSQL with vector embeddings
Writing Chunks
Store your chunked text in PostgreSQL with vector embeddings
Searching Chunks
Find similar chunks using vector similarity search
Searching Chunks
Find similar chunks using vector similarity search
Creating Indexes
Optimize search performance with vector indexes
Creating Indexes
Optimize search performance with vector indexes
Parameters
Optional[vecs.Client]
default:"None"
An existing vecs.Client instance. If provided, other connection parameters are ignored.
str
default:"localhost"
PostgreSQL host address.
int
default:"5432"
PostgreSQL port number.
str
default:"postgres"
PostgreSQL database name.
str
default:"postgres"
PostgreSQL username.
str
default:"postgres"
PostgreSQL password.
Optional[str]
default:"None"
Full PostgreSQL connection string. If provided, individual connection parameters are ignored.
str
default:"chonkie_chunks"
Name of the collection to store chunks in.
Union[str, BaseEmbeddings]
default:"minishlab/potion-retrieval-32M"
Embedding model to use. Can be a model name or a BaseEmbeddings instance.
Optional[int]
default:"None"
Number of dimensions for the vector embeddings. If not provided, will be inferred from the embedding model.
