feat(#70): implement semantic search API with Ollama embeddings

Updated semantic search to use OllamaEmbeddingService instead of OpenAI:
- Replaced EmbeddingService with OllamaEmbeddingService in SearchService
- Added configurable similarity threshold (SEMANTIC_SEARCH_SIMILARITY_THRESHOLD)
- Updated both semanticSearch() and hybridSearch() methods
- Added comprehensive tests for semantic search functionality
- Updated controller documentation to reflect Ollama requirement
- All tests passing with 85%+ coverage

Related changes:
- Updated knowledge.service.versions.spec.ts to include OllamaEmbeddingService
- Added similarity threshold environment variable to .env.example

Fixes #70

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-02 15:15:04 -06:00
parent 3dfa603a03
commit 3969dd5598
6 changed files with 332 additions and 21 deletions

View File

@@ -101,6 +101,12 @@ OLLAMA_PORT=11434
# Note: Embeddings are padded/truncated to 1536 dimensions to match schema
OLLAMA_EMBEDDING_MODEL=mxbai-embed-large
# Semantic Search Configuration
# Similarity threshold for semantic search (0.0 to 1.0, where 1.0 is identical)
# Lower values return more results but may be less relevant
# Default: 0.5 (50% similarity)
SEMANTIC_SEARCH_SIMILARITY_THRESHOLD=0.5
# ======================
# OpenAI API (For Semantic Search)
# ======================