vectors

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(prefixes []string, creator Creator)

Register a database creator.

Types

type Creator

type Creator func(path, tablePrefix string, opts ...storage.Option) (Database, error)

Creator creates a database instance.

type Database

type Database interface {
	Init() error
	Optimize() error
	Close() error
	ListCollections(ctx context.Context) ([]string, error)
	AddCollection(ctx context.Context, name string, dimensions int, distance Distance) error
	DeleteCollection(ctx context.Context, name string) error
	AddVectors(ctx context.Context, collection string, vectors []Vector) error
	DeleteVectors(ctx context.Context, collection string, timestamp time.Time) error
	QueryVectors(ctx context.Context, collection string, q []float32, categories []string, topK int) ([]Vector, error)
}

func Open

func Open(path, tablePrefix string, opts ...storage.Option) (Database, error)

Open a connection to a database.

type Distance

type Distance int
const (
	Cosine Distance = iota
	Euclidean
	Dot
)

type Milvus

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

func (*Milvus) AddCollection

func (db *Milvus) AddCollection(ctx context.Context, name string, dimensions int, distance Distance) error

func (*Milvus) AddVectors

func (db *Milvus) AddVectors(ctx context.Context, collection string, vectors []Vector) error

func (*Milvus) Close

func (db *Milvus) Close() error

func (*Milvus) DeleteCollection

func (db *Milvus) DeleteCollection(ctx context.Context, name string) error

func (*Milvus) DeleteVectors

func (db *Milvus) DeleteVectors(ctx context.Context, collection string, timestamp time.Time) error

func (*Milvus) Init

func (db *Milvus) Init() error

func (*Milvus) ListCollections

func (db *Milvus) ListCollections(ctx context.Context) ([]string, error)

func (*Milvus) Optimize

func (db *Milvus) Optimize() error

func (*Milvus) QueryVectors

func (db *Milvus) QueryVectors(ctx context.Context, collection string, q []float32, categories []string, topK int) ([]Vector, error)

type ProxyClient

type ProxyClient struct {
	protocol.VectorStoreClient
}

func NewProxyClient

func NewProxyClient(conn *grpc.ClientConn) *ProxyClient

func (ProxyClient) AddCollection

func (p ProxyClient) AddCollection(ctx context.Context, name string, dimensions int, distance Distance) error

func (ProxyClient) AddVectors

func (p ProxyClient) AddVectors(ctx context.Context, collection string, vectors []Vector) error

func (ProxyClient) Close

func (p ProxyClient) Close() error

func (ProxyClient) DeleteCollection

func (p ProxyClient) DeleteCollection(ctx context.Context, name string) error

func (ProxyClient) DeleteVectors

func (p ProxyClient) DeleteVectors(ctx context.Context, collection string, timestamp time.Time) error

func (ProxyClient) Init

func (p ProxyClient) Init() error

func (ProxyClient) ListCollections

func (p ProxyClient) ListCollections(ctx context.Context) ([]string, error)

func (ProxyClient) Optimize

func (p ProxyClient) Optimize() error

func (ProxyClient) QueryVectors

func (p ProxyClient) QueryVectors(ctx context.Context, collection string, q []float32, categories []string, topK int) ([]Vector, error)

type ProxyServer

type ProxyServer struct {
	protocol.UnimplementedVectorStoreServer
	// contains filtered or unexported fields
}

func NewProxyServer

func NewProxyServer(database Database) *ProxyServer

func (*ProxyServer) AddCollection

func (*ProxyServer) AddVectors

func (*ProxyServer) DeleteCollection

func (*ProxyServer) DeleteVectors

func (*ProxyServer) QueryVectors

func (*ProxyServer) Serve

func (p *ProxyServer) Serve(lis net.Listener) error

func (*ProxyServer) Stop

func (p *ProxyServer) Stop()

type Qdrant

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

func (*Qdrant) AddCollection

func (db *Qdrant) AddCollection(ctx context.Context, name string, dimensions int, distance Distance) error

func (*Qdrant) AddVectors

func (db *Qdrant) AddVectors(ctx context.Context, collection string, vectors []Vector) error

func (*Qdrant) Close

func (db *Qdrant) Close() error

func (*Qdrant) DeleteCollection

func (db *Qdrant) DeleteCollection(ctx context.Context, name string) error

func (*Qdrant) DeleteVectors

func (db *Qdrant) DeleteVectors(ctx context.Context, collection string, timestamp time.Time) error

func (*Qdrant) Init

func (db *Qdrant) Init() error

func (*Qdrant) ListCollections

func (db *Qdrant) ListCollections(ctx context.Context) ([]string, error)

func (*Qdrant) Optimize

func (db *Qdrant) Optimize() error

func (*Qdrant) QueryVectors

func (db *Qdrant) QueryVectors(ctx context.Context, collection string, q []float32, categories []string, topK int) ([]Vector, error)

type SQLite

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

func (*SQLite) AddCollection

func (db *SQLite) AddCollection(ctx context.Context, name string, dimensions int, distance Distance) error

func (*SQLite) AddVectors

func (db *SQLite) AddVectors(ctx context.Context, collection string, vectors []Vector) error

func (*SQLite) Close

func (db *SQLite) Close() error

func (*SQLite) DeleteCollection

func (db *SQLite) DeleteCollection(ctx context.Context, name string) error

func (*SQLite) DeleteVectors

func (db *SQLite) DeleteVectors(ctx context.Context, collection string, timestamp time.Time) error

func (*SQLite) Init

func (db *SQLite) Init() error

func (*SQLite) ListCollections

func (db *SQLite) ListCollections(ctx context.Context) ([]string, error)

func (*SQLite) Optimize

func (db *SQLite) Optimize() error

func (*SQLite) QueryVectors

func (db *SQLite) QueryVectors(ctx context.Context, collection string, q []float32, categories []string, topK int) ([]Vector, error)

type Vector

type Vector struct {
	Id         string
	Vector     []float32
	IsHidden   bool      `json:"-"`
	Categories []string  `json:"-" gorm:"type:text;serializer:json"`
	Timestamp  time.Time `json:"-"`
}

type Weaviate

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

func (*Weaviate) AddCollection

func (db *Weaviate) AddCollection(ctx context.Context, name string, dimensions int, distance Distance) error

func (*Weaviate) AddVectors

func (db *Weaviate) AddVectors(ctx context.Context, collection string, vectors []Vector) error

func (*Weaviate) Close

func (db *Weaviate) Close() error

func (*Weaviate) DeleteCollection

func (db *Weaviate) DeleteCollection(ctx context.Context, name string) error

func (*Weaviate) DeleteVectors

func (db *Weaviate) DeleteVectors(ctx context.Context, collection string, timestamp time.Time) error

func (*Weaviate) Init

func (db *Weaviate) Init() error

func (*Weaviate) ListCollections

func (db *Weaviate) ListCollections(ctx context.Context) ([]string, error)

func (*Weaviate) Optimize

func (db *Weaviate) Optimize() error

func (*Weaviate) QueryVectors

func (db *Weaviate) QueryVectors(ctx context.Context, collection string, q []float32, categories []string, topK int) ([]Vector, error)

Jump to

Keyboard shortcuts

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