milvus

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: 8 Imported by: 0

README

Milvus

Using Milvus as the vector store.

Installation

For how to install Milvus in different scenarios, see Official Documents.

For testing purpose, here we choose to Install Milvus Standalone with Docker Compose.

$ wget https://github.com/milvus-io/milvus/releases/download/v2.3.3/milvus-standalone-docker-compose.yml -O docker-compose.yml
$ sudo docker compose up -d

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Addr is the address of the Milvus server.
	// Defaults to "localhost:19530".
	Addr string `json:"addr"`

	// Timeout configures a timeout for dialing the Milvus server initially.
	// Defaults to 2s.
	Timeout time.Duration `json:"timeout"`

	// DBName is the database name.
	// Defaults to "default".
	DBName string `json:"db_name"`

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

	// Dim is the vector/embedding dimension.
	// Defaults to 1536 (the dimension generated by OpenAI's Embedding API).
	Dim int `json:"dim"`
}

type Milvus

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

func New

func New(cfg *Config) (*Milvus, error)

func (*Milvus) Delete

func (m *Milvus) Delete(ctx context.Context, sourceIDs ...string) error

Delete deletes the documents belonging to the given sourceIDs. As a special case, empty sourceIDs means deleting all documents.

func (*Milvus) Query

func (m *Milvus) Query(ctx context.Context, vector llmflow.Vector, topK int, minScore float64) ([]*llmflow.Similarity, error)

Query searches similarities of the given vector with default consistency level.

func (*Milvus) Upsert

func (m *Milvus) Upsert(ctx context.Context, documents []*llmflow.Document) error

Jump to

Keyboard shortcuts

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