mock

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mock is a deterministic, dependency-free Embedder used for integration tests, the dev-loop, and CI before the real ONNX adapter lands. It uses the classic **feature-hashing trick**: tokens are hashed into dim buckets, counted, then L2-normalized.

Properties:

  • same text → same vector (deterministic)
  • similar texts → similar vectors (shared tokens dominate)
  • no vocab, no model file, no download

Not appropriate for production retrieval — but it lets `ckv build → ckv query` work end-to-end so the rest of the pipeline can be wired and tested independently of the (heavyweight) ONNX path.

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 the in-process feature-hashing mock.

func Default

func Default() *Embedder

Default returns a mock with conventional name/dim.

func New

func New(dim int, name string) *Embedder

New constructs an Embedder with a custom dim/name. Pass dim ≤ 0 for the default. The name is what gets stamped in the manifest.

func (*Embedder) Dimension

func (e *Embedder) Dimension() int

func (*Embedder) Embed

func (e *Embedder) Embed(ctx context.Context, batch []string) ([][]float32, error)

Embed produces one vector per input string. Pure-Go and synchronous; the context is honored only via early-exit on Done.

func (*Embedder) Identity

func (e *Embedder) Identity() types.EmbeddingIdentity

Identity reports the mock embedding space. Vectors are L2-normalized feature hashes (see package doc); pooling is not applicable.

func (*Embedder) MaxInputTokens

func (e *Embedder) MaxInputTokens() int

func (*Embedder) Name

func (e *Embedder) Name() string

Jump to

Keyboard shortcuts

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