index

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

func New

func New(path string) (*Index, error)

func (*Index) Delete

func (i *Index) Delete(ctx context.Context, ids ...string) error

func (*Index) Index

func (i *Index) Index(ctx context.Context, record ...Record) error

func (*Index) List

func (i *Index) List(ctx context.Context, options *ListOptions) (*Page[Record], error)

func (*Index) Search

func (i *Index) Search(ctx context.Context, vector []float32, topK int) ([]Record, error)

type ListOptions

type ListOptions struct {
	Limit  *int
	Cursor string
}

type Page

type Page[T any] struct {
	Items []T

	Cursor string
}

type Record

type Record struct {
	ID string

	Text   string
	Vector []float32

	Metadata map[string]string
}

type RecordModel

type RecordModel struct {
	gorm.Model

	Text   string
	Vector datatypes.JSONSlice[float32]

	Metadata datatypes.JSONMap
}

Jump to

Keyboard shortcuts

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