localvec

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 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 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