fake

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fake provides a deterministic Embedder for tests.

Every call with the same text returns the same vector. The mapping is SHA-256 → []float32 by interpreting consecutive 4-byte chunks as uint32 → float in [-1, 1]. With the hash-derived seed it covers the vector cleanly enough for similarity-based tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedder

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

Embedder is a deterministic test embedder.

func New

func New(dim int) *Embedder

New returns a fake embedder of the requested dimensionality (>= 1).

func (*Embedder) Dim

func (e *Embedder) Dim() int

func (*Embedder) Embed

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

Embed satisfies embed.Embedder. The fake intentionally ignores the task parameter — the deterministic hash mapping is task-invariant, which keeps service-level tests stable across the task-typed rollout. (Production-quality task differentiation lives in the gemini embedder.)

Jump to

Keyboard shortcuts

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