Documentation
¶
Index ¶
- Variables
- func NewPGVectorStore(opts ...Options) (store.VectorStore, error)
- type EmbeddingModel
- type Options
- func WithClient(sqlClient *sql.DB) Options
- func WithCollection(name string) Options
- func WithCreateExtension() Options
- func WithCreds(user, pwd string) Options
- func WithDBName(dbname string) Options
- func WithEmbedder(e embeddings.Embedder) Options
- func WithEmbeddingMode(e EmbeddingModel) Options
- func WithEndpoint(host string, port int) Options
- func WithSSLMode(mode string) Options
- type Store
- func (p *Store) AddDocuments(ctx context.Context, documents []schema.Document, ...) error
- func (p *Store) ClearCollection() error
- func (p *Store) CollectionName() string
- func (p *Store) CollectionSize() (int, error)
- func (p *Store) SimilaritySearch(ctx context.Context, query string, numDocuments int, ...) ([]schema.Document, error)
- type Vector
Constants ¶
This section is empty.
Variables ¶
var VectorDimensionsByEmbeddingModel = map[EmbeddingModel]int{ EmbeddingOpenAI: 1536, EmbeddingOpenAI_ada_002: 1536, }
Functions ¶
func NewPGVectorStore ¶
func NewPGVectorStore(opts ...Options) (store.VectorStore, error)
Types ¶
type EmbeddingModel ¶
type EmbeddingModel int
const ( EmbeddingOpenAI_ada_002 EmbeddingModel = iota EmbeddingOpenAI // default for openai )
type Options ¶
type Options func(o *pgvOptions)
func WithClient ¶
WithClient sets an existing sql client - useful for proxying or testing or supplying a pre-made sql client connection with customizations
func WithCollection ¶
WithCollection sets the name of the collection (table within the postgres database)
func WithCreateExtension ¶ added in v1.1.0
func WithCreateExtension() Options
WithCreateExtension If set, will attempt to enable the PGVECTOR extension in the database. The user should have the appropriate permissions. Otherwise, provision the database with pgvector pre-enabled
func WithDBName ¶
WithDBName sets the db name to use with postgres
func WithEmbedder ¶
func WithEmbedder(e embeddings.Embedder) Options
WithEmbedder sets the embeddings provider
func WithEmbeddingMode ¶
func WithEmbeddingMode(e EmbeddingModel) Options
WithEmbeddingMode sets the embeddings mode. Currently, only OpenAI ADA_002 is supported.
func WithEndpoint ¶
WithEndpoint sets the host and port for the postgres instance to connect with
func WithSSLMode ¶
WithSSLMode only "require" (default), "verify-full", "verify-ca", and "disable" supported
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a postgres based implementation of a vector store
func (*Store) AddDocuments ¶
func (*Store) ClearCollection ¶
func (*Store) CollectionName ¶
func (*Store) CollectionSize ¶
type Vector ¶
type Vector struct {
// contains filtered or unexported fields
}
Vector is a wrapper for []float32 to implement sql.Scanner and driver.Valuer.