ragtest

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ragtest checks rag.VectorStore implementations against the contract the built-in store follows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newStore func(t *testing.T) rag.VectorStore)

Run runs the conformance tests against a store made by newStore, which must return an empty store. The contract:

  • Replace stores copies of the chunks of each source, replacing all chunks the source had; it rejects an unnamed source, a chunk without an ID and duplicate chunk IDs within a source. Sources reports each source with its hash and chunk count, ordered by source.
  • List returns copies of the matching chunks ordered by source, document and index; filters select sources by name or prefix and chunks by metadata, comparing numbers by value.
  • Search returns the chunks most similar to a vector, best first, limited to limit when it is positive.
  • Delete removes sources; deleting an unknown source succeeds.
  • A store that implements rag.Revisioner changes its revision with every change.

Types

type Embedder

type Embedder struct{}

Embedder embeds texts as 64-dimension hashed bags of words, so texts sharing words are similar. It is deterministic and needs no model.

func (Embedder) Embed

func (Embedder) Embed(_ context.Context, texts []string) ([][]float32, error)

Embed implements memory.Embedder.

Jump to

Keyboard shortcuts

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