brainy/tests/verify-model-loading.js
David Snelling 52a43d51d4 refactor: simplify build system and improve model loading flexibility
- Remove Rollup bundling in favor of direct TypeScript compilation
- Move from bundled models to dynamic model loading with configurable paths
- Add Docker deployment examples and documentation
- Implement robust model loader with fallback mechanisms
- Update storage adapters for better cross-environment compatibility
- Add comprehensive tests for model loading and package installation
- Simplify package.json scripts and remove complex build configurations
- Clean up deprecated demo files and old bundling scripts

BREAKING CHANGE: Models are no longer bundled with the package. They are now loaded dynamically from CDN or custom paths.
2025-08-05 16:09:30 -07:00

37 lines
No EOL
1 KiB
JavaScript

#!/usr/bin/env node
/**
* Simple script to verify model loading behavior
* Run with: node tests/verify-model-loading.js
*/
import { BrainyData } from '../dist/unified.js'
console.log('Testing Brainy model loading behavior...\n')
const db = new BrainyData({
forceMemoryStorage: true,
dimensions: 512
})
console.log('Initializing BrainyData...')
await db.init()
console.log('\nAttempting to embed text...')
const text = 'This is a test sentence for embedding'
const id = await db.add({ content: text })
console.log(`\n✅ Successfully added text with ID: ${id}`)
// Test search
const results = await db.search('test sentence', 1)
console.log(`\n✅ Search returned ${results.length} result(s)`)
console.log('\n---')
console.log('Model loading test complete!')
console.log('\nNOTE: Check the console output above to see:')
console.log('1. If @soulcraft/brainy-models was found and used (best performance)')
console.log('2. If fallback to URL loading occurred (with warning)')
console.log('3. Verification that the correct model was loaded')
process.exit(0)