milvus

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmbedderWrongNumberVectors = errors.New(
		"number of vectors from embedder does not match number of documents",
	)
	ErrColumnNotFound = errors.New("invalid field")
	ErrInvalidFilters = errors.New("invalid filters")
)
View Source
var ErrInvalidOptions = errors.New("invalid options")

ErrInvalidOptions is returned when the options given are invalid.

Functions

This section is empty.

Types

type Option

type Option func(p *Store)

Option is a function type that can be used to modify the client.

func WithCollectionName

func WithCollectionName(name string) Option

WithCollectionName sets the collection for the milvus store.

func WithConsistencyLevel

func WithConsistencyLevel(level entity.ConsistencyLevel) Option

WithConsistencyLevel sets the consistency level for seaarch.

func WithDropOld

func WithDropOld() Option

WithDropOld store will drop and recreate collection on initialization.

func WithEF

func WithEF(ef int) Option

WithEF sets ef.

func WithEmbedder

func WithEmbedder(embedder embeddings.Embedder) Option

WithEmbedder sets the embedder to use.

func WithIndex

func WithIndex(idx entity.Index) Option

WithIndex for vector search.

func WithMaxTextLength

func WithMaxTextLength(num int) Option

WithMaxTextLength sets the maximum length of the text field in the collection.

func WithMetaField

func WithMetaField(str string) Option

WithMetaField sets te name of the meta field in the collection schema. default is 'meta'.

func WithMetricType added in v0.1.13

func WithMetricType(metricType entity.MetricType) Option

WithMetricType sets the metric type for the collection.

func WithPartitionName

func WithPartitionName(name string) Option

WithPartitionName sets the milvus partition for the collection.

func WithPrimaryField

func WithPrimaryField(str string) Option

WithPrimaryField name of the primary field in the collection.

func WithSearchParameters

func WithSearchParameters(sp entity.SearchParam) Option

WithSearchParameters sets the search parameters.

func WithShards

func WithShards(num int32) Option

WithShards number of shards to create for a collection.

func WithSkipFlushOnWrite added in v0.1.19

func WithSkipFlushOnWrite() Option

WithSkipFlushOnWrite disables flushing on write.

func WithTextField

func WithTextField(str string) Option

WithTextField sets the name of the text field in the collection schema.

func WithVectorField

func WithVectorField(str string) Option

WithVectorField sets the name of the vector field in the collection.

type Store

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

Store is a wrapper around the milvus client.

func New

func New(ctx context.Context, config client.Config, opts ...Option) (Store, error)

New creates an active client connection to the (specified, or default) collection in the Milvus server and returns the `Store` object needed by the other accessors.

func (Store) AddDocuments

func (s Store) AddDocuments(ctx context.Context, docs []schema.Document,
	_ ...vectorstores.Option,
) ([]string, error)

AddDocuments adds the text and metadata from the documents to the Milvus collection associated with 'Store'. and returns the ids of the added documents.

func (Store) SimilaritySearch

func (s Store) SimilaritySearch(ctx context.Context, query string, numDocuments int,
	options ...vectorstores.Option,
) ([]schema.Document, error)

Jump to

Keyboard shortcuts

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