feat: migrate embeddings to Candle WASM + remove semantic type inference
Major architectural changes: 1. EMBEDDINGS ENGINE (ONNX → Candle WASM): - Replace ONNX Runtime with Rust Candle compiled to WASM - Embedded model in WASM binary (no external downloads) - Quantized Q8 precision with <50MB memory footprint - Zero-download, offline-first operation - Same embedding quality (all-MiniLM-L6-v2) 2. REMOVE SEMANTIC TYPE INFERENCE: - Delete embeddedKeywordEmbeddings.ts (14MB of pre-computed embeddings) - Remove typeAwareQueryPlanner.ts and semanticTypeInference.ts - Remove VerbExactMatchSignal (uses keyword embeddings) - Update SmartRelationshipExtractor to 3 signals (55%/30%/15% weights) API CHANGES (requires v7.0.0): - Removed: inferTypes(), inferNouns(), inferVerbs(), inferIntent() - Removed: getSemanticTypeInference(), SemanticTypeInference class - Removed: TypeInference, SemanticTypeInferenceOptions types Users can still use natural language queries in find() - they just need to specify type explicitly for type-optimized searches. PACKAGE SIZE IMPACT: - Compressed: 90.1 MB → 86.2 MB (-4.3%) - Uncompressed: 114.4 MB → 100.3 MB (-12%) - ~448K lines of code removed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
81cd16e41b
commit
da7d2ed29d
60 changed files with 3887 additions and 448557 deletions
|
|
@ -25,7 +25,9 @@ Built-in authentication and rate limiting when needed.
|
|||
|
||||
The APIServerAugmentation is included in Brainy core. No additional installation required.
|
||||
|
||||
For Node.js environments, you may want to install optional dependencies:
|
||||
**Bun** (recommended): No additional dependencies needed - use `Bun.serve()` directly.
|
||||
|
||||
**Node.js**: Install optional Express dependencies:
|
||||
```bash
|
||||
npm install express cors ws
|
||||
```
|
||||
|
|
@ -259,6 +261,30 @@ Authorization: Bearer your-token
|
|||
|
||||
## Environment Support
|
||||
|
||||
### Bun ✅ (Recommended)
|
||||
Native performance with Bun.serve() - no Express required. Works with `bun --compile` for single-binary deployment.
|
||||
|
||||
```typescript
|
||||
// Simple Bun server with Brainy
|
||||
import { Brainy } from '@soulcraft/brainy'
|
||||
|
||||
const brain = new Brainy()
|
||||
await brain.init()
|
||||
|
||||
Bun.serve({
|
||||
port: 3000,
|
||||
async fetch(req) {
|
||||
const url = new URL(req.url)
|
||||
if (url.pathname === '/api/search') {
|
||||
const { query } = await req.json()
|
||||
const results = await brain.search(query)
|
||||
return Response.json(results)
|
||||
}
|
||||
return new Response('Not Found', { status: 404 })
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Node.js ✅
|
||||
Full support with Express, WebSocket, and all features.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue