Add HNSW-based vector search with configurable embedding providers (OpenAI, Ollama) and automatic FTS5 fallback when no provider is configured. Background pipeline embeds messages asynchronously on ingest, stores vectors in a pure-Go HNSW index, and retries on failure with exponential backoff. The search_messages MCP tool now supports search_mode (auto/semantic/fulltext) and returns ranked results with similarity scores. All existing tests continue to pass, CGO_ENABLED=0 cross-compilation verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
620 B
Go
17 lines
620 B
Go
// Package embedding provides embedding provider implementations for semantic search.
|
|
package embedding
|
|
|
|
import "context"
|
|
|
|
// EmbeddingProvider generates vector embeddings from text.
|
|
type EmbeddingProvider interface {
|
|
// Embed generates an embedding vector for a single text.
|
|
Embed(ctx context.Context, text string) ([]float32, error)
|
|
// EmbedBatch generates embedding vectors for multiple texts.
|
|
EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)
|
|
// Dimensions returns the embedding dimensionality.
|
|
Dimensions() int
|
|
// Name returns the provider name (e.g. "openai", "ollama").
|
|
Name() string
|
|
}
|