testutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestBucket

func NewTestBucket(role, text string) merkle.Bucket

NewTestBucket creates a simple bucket for testing

Types

type MockEmbedder

type MockEmbedder struct {
	Embeddings map[string][]float32

	// FailOn causes Embed to return an error when the input text matches
	FailOn string
}

MockEmbedder is a test embedder that returns predictable embeddings

func NewMockEmbedder

func NewMockEmbedder() *MockEmbedder

func (*MockEmbedder) Close

func (m *MockEmbedder) Close() error

func (*MockEmbedder) Embed

func (m *MockEmbedder) Embed(_ context.Context, text string) ([]float32, error)

type MockVectorDriver

type MockVectorDriver struct {
	Documents []vector.Document
	Results   []vector.QueryResult

	// FailQuery causes Query to return an error
	FailQuery bool
}

MockVectorDriver is a test vector driver

func NewMockVectorDriver

func NewMockVectorDriver() *MockVectorDriver

func (*MockVectorDriver) Add

func (*MockVectorDriver) Close

func (m *MockVectorDriver) Close() error

func (*MockVectorDriver) Delete

func (m *MockVectorDriver) Delete(_ context.Context, _ []string) error

func (*MockVectorDriver) Get

func (*MockVectorDriver) Query

func (m *MockVectorDriver) Query(_ context.Context, _ []float32, topK int) ([]vector.QueryResult, error)

Jump to

Keyboard shortcuts

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