Documentation
¶
Overview ¶
Package pgvector provides a PostgreSQL-backed vector driver using the pgvector extension.
Index ¶
- Constants
- type Config
- type Driver
- func (d *Driver) Add(ctx context.Context, docs []vector.Document) error
- func (d *Driver) Close() error
- func (d *Driver) Delete(ctx context.Context, ids []string) error
- func (d *Driver) Get(ctx context.Context, ids []string) ([]vector.Document, error)
- func (d *Driver) Query(ctx context.Context, embedding []float32, topK int) ([]vector.QueryResult, error)
Constants ¶
View Source
const (
// DefaultTableName is the default table name for storing vector documents.
DefaultTableName = "tapes_embeddings"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ConnString is the PostgreSQL connection string (e.g. "postgres://user:pass@host:5432/db").
ConnString string
// TableName is the name of the table to store embeddings in.
// Defaults to DefaultTableName if empty.
TableName string
// Dimensions is the number of dimensions for the embedding vectors.
Dimensions uint
}
Config holds configuration for the pgvector driver.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements vector.Driver using PostgreSQL with the pgvector extension.
func (*Driver) Add ¶
Add stores documents with their embeddings. If a document with the same ID already exists, it is updated.
Click to show internal directories.
Click to hide internal directories.