embedtest

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package embedtest holds a deterministic embedder for tests. It makes no network call and counts how often it was asked to embed, so a test can prove a refused call never reached it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

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

Hash is a bag-of-words embedder: each word adds one to a hashed dimension. Texts that share words score higher, so ranking tests can reason about order. It is safe for concurrent use.

func New

func New(dims int) *Hash

New returns a Hash embedder producing vectors of dims numbers.

func (*Hash) Calls

func (h *Hash) Calls() int

Calls returns how many times Embed has run.

func (*Hash) Dimensions

func (h *Hash) Dimensions() int

Dimensions returns the vector length.

func (*Hash) Embed

func (h *Hash) Embed(_ context.Context, texts []string) ([]embedder.EmbedResult, error)

Embed returns one vector per text and counts the call.

Jump to

Keyboard shortcuts

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