Documentation
¶
Overview ¶
Package similarity provides vector distance functions for semantic search.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineDistance ¶
CosineDistance computes the cosine distance between two vectors. Returns a value in [0, 2] where 0 means identical direction and 2 means opposite direction. Lower values indicate more similar vectors.
func CosineSimilarity ¶
CosineSimilarity computes the cosine similarity between two vectors. Returns a value in [-1, 1] where 1 means identical direction, 0 means orthogonal, and -1 means opposite direction. Both vectors must have the same length.
func NewEmbeddingClient ¶ added in v0.10.1
func NewEmbeddingClient(cfg *types.OptimizerConfig) (types.EmbeddingClient, error)
NewEmbeddingClient creates an EmbeddingClient from the given optimizer configuration. It returns (nil, nil) if cfg is nil or no embedding service URL is configured, meaning semantic search will be disabled.
Types ¶
This section is empty.