semantic

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CosineSimilarity

func CosineSimilarity(a, b []float32) float64

CosineSimilarity calculates cosine similarity between two vectors

Types

type EmbeddingClient

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

EmbeddingClient handles communication with embedding services

func NewEmbeddingClient

func NewEmbeddingClient(cfg *config.Config) *EmbeddingClient

NewEmbeddingClient creates a new embedding client

func (*EmbeddingClient) GenerateEmbedding

func (c *EmbeddingClient) GenerateEmbedding(text string) ([]float32, error)

GenerateEmbedding generates embeddings for the given text

type EmbeddingRequest

type EmbeddingRequest struct {
	Model string   `json:"model"`
	Input []string `json:"input"`
}

EmbeddingRequest represents a request to generate embeddings

type EmbeddingResponse

type EmbeddingResponse struct {
	Data []struct {
		Embedding []float32 `json:"embedding"`
	} `json:"data"`
}

EmbeddingResponse represents the response from an embedding service

type SemanticEngine

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

SemanticEngine enhances recall with semantic similarity

func NewSemanticEngine

func NewSemanticEngine(
	db *storage.DB,
	memoryService *memory.Service,
	evidenceService *evidence.Service,
	cfg *config.Config,
	logger *zap.Logger,
) *SemanticEngine

NewSemanticEngine creates a new semantic recall engine

func (*SemanticEngine) Close

func (s *SemanticEngine) Close()

Close gracefully shuts down the semantic engine.

func (*SemanticEngine) Recall

func (s *SemanticEngine) Recall(options recall.RecallOptions) ([]recall.RecallResult, error)

Recall implements recall.Recaller using semantic recall when enabled.

func (*SemanticEngine) SemanticRecall

func (s *SemanticEngine) SemanticRecall(options recall.RecallOptions) ([]recall.RecallResult, error)

SemanticRecall performs semantic recall combined with lexical recall

Jump to

Keyboard shortcuts

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