cache

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheMiss = fmt.Errorf("cache miss")

Functions

This section is empty.

Types

type Cache

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

func New

func New(index *index.Index) *Cache

func (*Cache) Clear added in v0.1.0

func (c *Cache) Clear(ctx context.Context) error

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, query string) (*Result, error)

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, embedding []float64, answer string) error

func (*Cache) WithScoreThreshold

func (c *Cache) WithScoreThreshold(scoreThreshold float64) *Cache

func (*Cache) WithTopK

func (c *Cache) WithTopK(topK int) *Cache

type Result

type Result struct {
	Answer    []string
	Embedding []float64
}

Jump to

Keyboard shortcuts

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