brainy/.recovery-workspace/dist-backup-20250910-141917/scripts/precomputePatternEmbeddings.d.ts

20 lines
706 B
TypeScript
Raw Normal View History

#!/usr/bin/env node
/**
* 🧠 Pre-compute Pattern Embeddings Script
*
* This script pre-computes embeddings for all patterns and saves them to disk.
* Run this once after adding new patterns to avoid runtime embedding costs.
*
* How it works:
* 1. Load all patterns from library.json
* 2. Use Brainy's embedding model to encode each pattern's examples
* 3. Average the example embeddings to get a robust pattern representation
* 4. Save embeddings to patterns/embeddings.bin for instant loading
*
* Benefits:
* - Pattern matching becomes pure math (cosine similarity)
* - No embedding model calls during query processing
* - Patterns load instantly with pre-computed vectors
*/
export {};