fix: update all imports and references from BrainyData to Brainy
- Fixed imports in examples/tests/ to use correct Brainy import - Fixed imports in tests/benchmarks/ to use correct paths - Updated bin/brainy-interactive.js to use Brainy instead of BrainyData - Corrected documentation references throughout codebase - Removed duplicate imports in benchmark files - All files now consistently use 'Brainy' class from dist/index.js
This commit is contained in:
parent
791fac54cd
commit
196690863d
77 changed files with 328 additions and 331 deletions
|
|
@ -5,9 +5,8 @@
|
|||
* This is the TRUE comparison - with real transformers models
|
||||
*/
|
||||
|
||||
import { Brainy } from '../dist/brainy.js'
|
||||
import { BrainyData } from '../dist/brainyData.js'
|
||||
import { NounType, VerbType } from '../dist/types/graphTypes.js'
|
||||
import { Brainy } from '../../dist/index.js'
|
||||
import { NounType, VerbType } from '../../dist/types/graphTypes.js'
|
||||
|
||||
// Real text samples for embedding
|
||||
const REAL_DOCUMENTS = [
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@
|
|||
* Compares Brainy v3 vs v2 vs Competition benchmarks
|
||||
*/
|
||||
|
||||
import { Brainy } from '../dist/brainy.js'
|
||||
import { BrainyData } from '../dist/brainyData.js'
|
||||
import { NounType, VerbType } from '../dist/types/graphTypes.js'
|
||||
import { Brainy } from '../../dist/index.js'
|
||||
import { NounType, VerbType } from '../../dist/types/graphTypes.js'
|
||||
|
||||
// Mock embedder for consistent benchmarking (no model overhead)
|
||||
const mockEmbedder = async () => new Array(384).fill(0).map(() => Math.random())
|
||||
|
|
@ -17,10 +16,10 @@ async function formatOps(ops) {
|
|||
}
|
||||
|
||||
async function runV2Benchmark() {
|
||||
console.log('\n📊 BrainyData v2 Performance')
|
||||
console.log('\n📊 Brainy v2 Performance')
|
||||
console.log('═'.repeat(50))
|
||||
|
||||
const brain = new BrainyData({
|
||||
const brain = new Brainy({
|
||||
storage: { type: 'memory' },
|
||||
embeddingFunction: mockEmbedder,
|
||||
augmentations: false // Disable for raw performance
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
* This will help us identify where we lost the claimed 500,000 ops/sec
|
||||
*/
|
||||
|
||||
import { BrainyData } from '../dist/index.js'
|
||||
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js'
|
||||
import { Brainy } from '../../dist/index.js'
|
||||
import { MemoryStorage } from '../../dist/storage/adapters/memoryStorage.js'
|
||||
|
||||
// Performance tracking
|
||||
class PerformanceProfiler {
|
||||
|
|
@ -78,20 +78,20 @@ async function profilePerformance() {
|
|||
console.log('Initializing Brainy configurations...')
|
||||
|
||||
// 1. Minimal config (no augmentations)
|
||||
const minimalBrain = new BrainyData({
|
||||
const minimalBrain = new Brainy({
|
||||
storage: new MemoryStorage(),
|
||||
augmentations: false // Disable all augmentations
|
||||
})
|
||||
await minimalBrain.init()
|
||||
|
||||
// 2. Default config (with augmentations)
|
||||
const defaultBrain = new BrainyData({
|
||||
const defaultBrain = new Brainy({
|
||||
storage: new MemoryStorage()
|
||||
})
|
||||
await defaultBrain.init()
|
||||
|
||||
// 3. Full augmentations config
|
||||
const fullBrain = new BrainyData({
|
||||
const fullBrain = new Brainy({
|
||||
storage: new MemoryStorage(),
|
||||
augmentations: {
|
||||
batchProcessing: { enabled: true, maxBatchSize: 1000 },
|
||||
|
|
|
|||
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
/**
|
||||
* Brainy 3.0 Performance Benchmark
|
||||
* Compare v2 (BrainyData) vs v3 (Brainy) performance
|
||||
* Compare v2 (Brainy) vs v3 (Brainy) performance
|
||||
*/
|
||||
|
||||
import { BrainyData } from '../dist/brainyData.js'
|
||||
import { Brainy } from '../dist/brainy.js'
|
||||
import { NounType, VerbType } from '../dist/types/graphTypes.js'
|
||||
import { Brainy } from '../../dist/index.js'
|
||||
import { NounType, VerbType } from '../../dist/types/graphTypes.js'
|
||||
|
||||
const ITERATIONS = 1000
|
||||
const BATCH_SIZE = 100
|
||||
|
||||
async function benchmarkV2() {
|
||||
console.log('\n📊 BrainyData v2 Performance')
|
||||
console.log('\n📊 Brainy v2 Performance')
|
||||
console.log('═'.repeat(50))
|
||||
|
||||
const brain = new BrainyData({
|
||||
const brain = new Brainy({
|
||||
storage: { type: 'memory' },
|
||||
augmentations: false,
|
||||
embeddingFunction: async () => new Array(384).fill(0).map(() => Math.random())
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* Quick Performance Test - Find the bottlenecks
|
||||
*/
|
||||
|
||||
import { BrainyData } from '../dist/index.js'
|
||||
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js'
|
||||
import { Brainy } from '../../dist/index.js'
|
||||
import { MemoryStorage } from '../../dist/storage/adapters/memoryStorage.js'
|
||||
|
||||
async function quickPerf() {
|
||||
console.log('🚀 Quick Performance Test\n')
|
||||
|
|
@ -34,7 +34,7 @@ async function quickPerf() {
|
|||
// Mock embedding function that returns instantly
|
||||
const mockEmbed = async () => new Array(384).fill(0)
|
||||
|
||||
const brain = new BrainyData({
|
||||
const brain = new Brainy({
|
||||
storage: new MemoryStorage(),
|
||||
embeddingFunction: mockEmbed,
|
||||
augmentations: false // Disable augmentations
|
||||
|
|
@ -57,7 +57,7 @@ async function quickPerf() {
|
|||
|
||||
// Test 3: With augmentations
|
||||
console.log('3️⃣ Brainy with Augmentations')
|
||||
const brain2 = new BrainyData({
|
||||
const brain2 = new Brainy({
|
||||
storage: new MemoryStorage(),
|
||||
embeddingFunction: mockEmbed
|
||||
// Default augmentations enabled
|
||||
|
|
@ -78,7 +78,7 @@ async function quickPerf() {
|
|||
|
||||
// Test 4: Real embeddings (the killer)
|
||||
console.log('4️⃣ With Real Embeddings (10 samples)')
|
||||
const brain3 = new BrainyData({
|
||||
const brain3 = new Brainy({
|
||||
storage: new MemoryStorage(),
|
||||
augmentations: false
|
||||
// Uses real embedding function
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
* Quick Verification Test - Verify real implementations work
|
||||
*/
|
||||
|
||||
import { BrainyData } from '../dist/index.js'
|
||||
import { Brainy } from '../dist/index.js'
|
||||
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js'
|
||||
|
||||
async function quickVerify() {
|
||||
console.log('🔍 Quick Verification Test\n')
|
||||
|
||||
// Initialize
|
||||
const brain = new BrainyData({
|
||||
const brain = new Brainy({
|
||||
storage: new MemoryStorage()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* 4. No fake/stub code in production path
|
||||
*/
|
||||
|
||||
import { BrainyData } from '../dist/index.js'
|
||||
import { Brainy } from '../dist/index.js'
|
||||
import { MemoryStorage } from '../dist/storage/adapters/memoryStorage.js'
|
||||
|
||||
// Test configuration
|
||||
|
|
@ -34,7 +34,7 @@ async function runScaleTest() {
|
|||
const startTime = Date.now()
|
||||
|
||||
// Initialize Brainy with real augmentations
|
||||
const brain = new BrainyData({
|
||||
const brain = new Brainy({
|
||||
storage: new MemoryStorage(),
|
||||
augmentations: {
|
||||
// These should all be REAL implementations now
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue