UNPKG

claude-flow

Version:

Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration

63 lines (54 loc) โ€ข 2.23 kB
#!/usr/bin/env tsx /** * Quick Integration Test * * Verifies @ruvector/attention integration is working correctly. * Run with: npx tsx v3/@claude-flow/performance/src/examples/quick-test.ts */ import { FlashAttention, createFlashAttentionOptimizer, quickBenchmark, } from '../attention-integration.js'; async function quickTest() { console.log('\n๐Ÿงช Quick Integration Test\n'); console.log('โ”'.repeat(60)); try { // Test 1: Direct @ruvector/attention usage console.log('\nโœ“ Test 1: Direct @ruvector/attention usage'); const flash = new FlashAttention(128, 64); // dim, blockSize const query = new Float32Array(128).fill(1.0); const keys = [new Float32Array(128).fill(1.0)]; const values = [new Float32Array(128).fill(1.0)]; const result = flash.compute(query, keys, values); console.log(` Result: Float32Array[${result.length}]`); // Test 2: V3 optimizer console.log('\nโœ“ Test 2: V3 FlashAttentionOptimizer'); const optimizer = createFlashAttentionOptimizer(128); const output = optimizer.optimize({ query: new Float32Array(128).fill(1.0), keys: Array.from({ length: 50 }, () => new Float32Array(128).fill(1.0)), values: Array.from({ length: 50 }, () => new Float32Array(128).fill(1.0)), }); console.log(` Execution time: ${output.executionTimeMs.toFixed(3)}ms`); console.log(` Runtime: ${output.runtime}`); // Test 3: Quick benchmark console.log('\nโœ“ Test 3: Quick benchmark'); const benchResult = quickBenchmark(256); console.log(` Flash: ${benchResult.flashAttention.averageTimeMs.toFixed(3)}ms`); console.log(` Baseline: ${benchResult.baseline.averageTimeMs.toFixed(3)}ms`); console.log(` Speedup: ${benchResult.speedup.toFixed(2)}x`); console.log(` Meets target: ${benchResult.meetsTarget ? 'YES โœ“' : 'NO โœ—'}`); console.log('\n' + 'โ”'.repeat(60)); console.log('\nโœ… All tests passed! Integration working correctly.\n'); return true; } catch (error) { console.error('\nโŒ Test failed:', error); console.log('\n' + 'โ”'.repeat(60) + '\n'); return false; } } // Run test quickTest().then(success => { process.exit(success ? 0 : 1); });