vectorstore

package
v0.0.0-...-aba7d2c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const TypeVectorStoreDelete = "vectorstore_delete"
View Source
const TypeVectorStoreQuery = "vectorstore_query"
View Source
const TypeVectorStoreUpsert = "vectorstore_upsert"

Variables

This section is empty.

Functions

func MustRegisterVectorStoreDelete

func MustRegisterVectorStoreDelete(r *orchestrator.Registry)

func MustRegisterVectorStoreQuery

func MustRegisterVectorStoreQuery(r *orchestrator.Registry)

func MustRegisterVectorStoreUpsert

func MustRegisterVectorStoreUpsert(r *orchestrator.Registry)

Types

type Config

type Config struct {
	// Addr is the address of the vector store server.
	Addr string `json:"addr"`

	// CollectionName is the collection name.
	CollectionName string `json:"collection_name"`

	// Dim is the vector/embedding dimension.
	Dim int `json:"dim"`
}

type VectorStore

type VectorStore interface {
	Upsert(ctx context.Context, documents []*llmflow.Document) error
	Query(ctx context.Context, vector llmflow.Vector, topK int, minScore float64) (similarities []*llmflow.Similarity, err error)

	// Delete deletes the chunks belonging to the given sourceIDs.
	// As a special case, empty documentIDs means deleting all chunks.
	Delete(ctx context.Context, sourceIDs ...string) error
}

func New

func New(vendor string, cfg *Config) (VectorStore, error)

type VectorStoreDelete

type VectorStoreDelete struct {
	orchestrator.TaskHeader

	Input struct {
		Vendor string  `json:"vendor"`
		Config *Config `json:"config"`
	} `json:"input"`
	// contains filtered or unexported fields
}

func (*VectorStoreDelete) Execute

func (*VectorStoreDelete) Init

func (*VectorStoreDelete) String

func (vs *VectorStoreDelete) String() string

type VectorStoreDeleteBuilder

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

func NewVectorStoreDelete

func NewVectorStoreDelete(name string) *VectorStoreDeleteBuilder

func (*VectorStoreDeleteBuilder) Build

type VectorStoreQuery

type VectorStoreQuery struct {
	orchestrator.TaskHeader

	Input struct {
		Vendor string  `json:"vendor"`
		Config *Config `json:"config"`

		Vector   orchestrator.Expr[llmflow.Vector] `json:"vector"`
		TopK     int                               `json:"top_k"`
		MinScore float64                           `json:"min_score"`
	} `json:"input"`
	// contains filtered or unexported fields
}

func (*VectorStoreQuery) Execute

func (*VectorStoreQuery) Init

func (*VectorStoreQuery) String

func (vs *VectorStoreQuery) String() string

type VectorStoreQueryBuilder

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

func NewVectorStoreQuery

func NewVectorStoreQuery(name string) *VectorStoreQueryBuilder

func (*VectorStoreQueryBuilder) Build

type VectorStoreUpsert

type VectorStoreUpsert struct {
	orchestrator.TaskHeader

	Input struct {
		Vendor string  `json:"vendor"`
		Config *Config `json:"config"`

		Vectors   orchestrator.Expr[[]llmflow.Vector]    `json:"vectors"`
		Documents orchestrator.Expr[[]*llmflow.Document] `json:"documents"`
	} `json:"input"`
	// contains filtered or unexported fields
}

func (*VectorStoreUpsert) Execute

func (*VectorStoreUpsert) Init

func (*VectorStoreUpsert) String

func (vs *VectorStoreUpsert) String() string

type VectorStoreUpsertBuilder

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

func NewVectorStoreUpsert

func NewVectorStoreUpsert(name string) *VectorStoreUpsertBuilder

func (*VectorStoreUpsertBuilder) Build

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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