pgvector

package
v0.0.0-...-0dd2292 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Types

type Index

type Index struct {
	ID        string `gorm:"column:id;primaryKey"`
	Name      string `gorm:"column:name;type:varchar(256);index:index_name"`
	OID       int64  `gorm:"column:oid;index:index_oid"`
	Group     int    `gorm:"column:idx_group;index:index_group"`
	ParentID  int64  `gorm:"column:parent_entry_id;index:index_parent_id"`
	Content   string `gorm:"column:content"`
	Vector    string `gorm:"column:vector;type:vector(1536)"`
	Extra     string `gorm:"column:metadata"`
	CreatedAt int64  `gorm:"column:created_at"`
	ChangedAt int64  `gorm:"column:changed_at"`
}

func (*Index) From

func (v *Index) From(element *models.Element) *Index

func (*Index) TableName

func (v *Index) TableName() string

func (*Index) To

func (v *Index) To() *models.Doc

func (*Index) ToElement

func (v *Index) ToElement() *models.Element

func (*Index) Update

func (v *Index) Update(vector *Index)

type PgVectorClient

type PgVectorClient struct {
	// contains filtered or unexported fields
}

func NewPgVectorClient

func NewPgVectorClient(log logger.Logger, postgresUrl string) (*PgVectorClient, error)

func (*PgVectorClient) Get

func (p *PgVectorClient) Get(ctx context.Context, oid int64, name string, group int) (*models.Element, error)

func (*PgVectorClient) Search

func (p *PgVectorClient) Search(ctx context.Context, query models.DocQuery, vectors []float32, k int) ([]*models.Doc, error)

func (*PgVectorClient) Store

func (p *PgVectorClient) Store(ctx context.Context, element *models.Element, extra map[string]any) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL