store

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderChroma   = "chroma"
	ProviderPostgres = "postgres"
	ProviderSqlite   = "sqlite"
	ProviderVecx     = "vecx"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chroma

type Chroma struct {
	Host string
	Port int

	Client     *chroma.Client
	Collection *chroma.Collection
	RecordSet  *types.RecordSet
}

func (*Chroma) Deinit

func (c *Chroma) Deinit(_ context.Context) error

func (*Chroma) Init

func (c *Chroma) Init(ctx context.Context, name string) error

func (*Chroma) Reset

func (c *Chroma) Reset(ctx context.Context) error

func (*Chroma) Save

func (c *Chroma) Save(ctx context.Context, text string, meta map[string]interface{}, _ string) error

func (*Chroma) Search

func (c *Chroma) Search(ctx context.Context, query string, limit int32, threshold float32) ([]interface{}, error)

type Collection

type Collection struct {
	Id      string
	Meta    map[string]interface{}
	Context string
	Score   float32
}

type Config

type Config struct {
	Provider string
	Host     string
	Port     int
	Path     string
	User     string
	Pass     string
}

func DefaultConfig

func DefaultConfig() *Config

type Postgres added in v0.17.0

type Postgres struct {
	Host string
	Port int
	User string
	Pass string
	// contains filtered or unexported fields
}

func (*Postgres) Deinit added in v0.17.0

func (p *Postgres) Deinit(_ context.Context) error

func (*Postgres) Init added in v0.17.0

func (p *Postgres) Init(_ context.Context, _ string) error

func (*Postgres) Reset added in v0.17.0

func (p *Postgres) Reset(_ context.Context) error

func (*Postgres) Save added in v0.17.0

func (p *Postgres) Save(_ context.Context, text string, meta map[string]interface{}, agent string) error

func (*Postgres) Search added in v0.17.0

func (p *Postgres) Search(_ context.Context, query string, limit int32, threshold float32) ([]interface{}, error)

type Sqlite added in v0.4.0

type Sqlite struct {
	Path string

	Client *sql.DB
}

func (*Sqlite) Deinit added in v0.4.0

func (s *Sqlite) Deinit(_ context.Context) error

func (*Sqlite) Init added in v0.4.0

func (s *Sqlite) Init(ctx context.Context, _ string) error

func (*Sqlite) Reset added in v0.4.0

func (s *Sqlite) Reset(_ context.Context) error

func (*Sqlite) Save added in v0.4.0

func (s *Sqlite) Save(_ context.Context, text string, meta map[string]interface{}, agent string) error

func (*Sqlite) Search added in v0.4.0

func (s *Sqlite) Search(_ context.Context, _ string, limit int32, _ float32) ([]interface{}, error)

type Store

type Store interface {
	Init(context.Context, string) error
	Deinit(context.Context) error
	Reset(context.Context) error
	Save(context.Context, string, map[string]interface{}, string) error
	Search(context.Context, string, int32, float32) ([]interface{}, error)
}

func New

func New(_ context.Context, cfg *Config) Store

type Vecx added in v0.17.0

type Vecx struct{}

func (*Vecx) Deinit added in v0.17.0

func (v *Vecx) Deinit(_ context.Context) error

func (*Vecx) Init added in v0.17.0

func (v *Vecx) Init(_ context.Context, name string) error

func (*Vecx) Reset added in v0.17.0

func (v *Vecx) Reset(_ context.Context) error

func (*Vecx) Save added in v0.17.0

func (v *Vecx) Save(_ context.Context, text string, meta map[string]interface{}, agent string) error

func (*Vecx) Search added in v0.17.0

func (v *Vecx) Search(_ context.Context, query string, limit int32, threshold float32) ([]interface{}, error)

Jump to

Keyboard shortcuts

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