embedder

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Overview

Package embedder implements the SoulEmbedder port. Converts identity snapshots and traits into 13-dimensional float32 vectors using the IdentityDimensionVector representation, enabling vector similarity searches (e.g. integration with MIRA's HNSW index).

Index

Constants

View Source
const (
	// Dimension is the size of every identity embedding vector (13D).
	Dimension = 13

	// ModelHash identifies this embedding approach for cache / invalidation.
	ModelHash = "soul-13d-v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SoulEmbedderService

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

SoulEmbedderService implements ports.SoulEmbedder. It encodes identities using the deterministic IdentityDimensionVector mapping and, when a SoulStorage is provided, supports linear-scan similarity search.

func NewSoulEmbedderService

func NewSoulEmbedderService(storage ports.SoulStorage) *SoulEmbedderService

NewSoulEmbedderService creates a new embedder. storage may be nil; passing nil disables FindSimilarIdentities.

func (*SoulEmbedderService) Dimension

func (e *SoulEmbedderService) Dimension() int

Dimension returns the vector length.

func (*SoulEmbedderService) EncodeIdentity

func (e *SoulEmbedderService) EncodeIdentity(ctx context.Context, identity *entities.IdentitySnapshot) ([]float32, error)

EncodeIdentity encodes a snapshot as a normalised 13D float32 vector.

func (*SoulEmbedderService) EncodeTrait

func (e *SoulEmbedderService) EncodeTrait(ctx context.Context, trait *entities.PersonalityTrait) ([]float32, error)

EncodeTrait encodes a personality trait as a 13D float32 vector. Each trait category activates a subset of the identity dimensions.

func (*SoulEmbedderService) FindSimilarIdentities

func (e *SoulEmbedderService) FindSimilarIdentities(ctx context.Context, vector []float32, limit int) ([]*entities.IdentitySnapshot, error)

FindSimilarIdentities performs a linear-scan cosine similarity search over the latest snapshot of every known agent. Returns up to limit snapshots sorted by descending similarity.

func (*SoulEmbedderService) ModelHash

func (e *SoulEmbedderService) ModelHash() string

ModelHash returns the embedding model identifier.

Jump to

Keyboard shortcuts

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