localvec

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package localvec is a local vector database for development and testing. The database is stored in a file in the local file system. Production code should use a real vector database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineIndexerAndRetriever

func DefineIndexerAndRetriever(name string, cfg Config) (ai.Indexer, ai.Retriever, error)

DefineIndexerAndRetriever defines an Indexer and Retriever that share the same underlying storage. The name uniquely identifies the the Indexer and Retriever in the registry.

func Indexer

func Indexer(name string) ai.Indexer

Indexer returns the registered indexer with the given name.

func Init

func Init() error

Init initializes the plugin.

func IsDefinedIndexer added in v0.1.0

func IsDefinedIndexer(name string) bool

IsDefinedIndexer reports whether the named Indexer is defined by this plugin.

func IsDefinedRetriever added in v0.1.0

func IsDefinedRetriever(name string) bool

IsDefinedRetriever reports whether the named Retriever is defined by this plugin.

func Retriever

func Retriever(name string) ai.Retriever

Retriever returns the retriever with the given name. The name must match the [Config.Name] value passed to Init.

Types

type Config

type Config struct {
	// Where to store the data. Defaults to os.TempDir.
	Dir             string
	Embedder        ai.Embedder
	EmbedderOptions any
}

type RetrieverOptions

type RetrieverOptions struct {
	K int `json:"k,omitempty"` // number of entries to return
}

RetrieverOptions may be passed in the Options field of ai.RetrieverRequest to pass options to the retriever. The Options field should be either nil or a value of type *RetrieverOptions.

Jump to

Keyboard shortcuts

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