Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'
This commit is contained in:
64
vendor/ruvector/npm/packages/agentic-synth/training/test-dspy-integration.js
vendored
Normal file
64
vendor/ruvector/npm/packages/agentic-synth/training/test-dspy-integration.js
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Simple test to verify dspy.ts integration works at runtime
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const dspy_real_integration_js_1 = require("./dspy-real-integration.js");
|
||||
async function test() {
|
||||
console.log('🧪 Testing DSPy.ts Real Integration\n');
|
||||
// Simple schema
|
||||
const schema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
value: { type: 'number' }
|
||||
}
|
||||
};
|
||||
// Simple examples
|
||||
const examples = [
|
||||
{
|
||||
input: JSON.stringify(schema),
|
||||
output: JSON.stringify({ id: '1', name: 'Test', value: 42 }),
|
||||
quality: 0.9
|
||||
}
|
||||
];
|
||||
try {
|
||||
// Create trainer
|
||||
console.log('✓ Creating trainer...');
|
||||
const trainer = new dspy_real_integration_js_1.DSPyAgenticSynthTrainer({
|
||||
models: ['gpt-3.5-turbo'],
|
||||
optimizationRounds: 2,
|
||||
minQualityScore: 0.7,
|
||||
batchSize: 3
|
||||
});
|
||||
console.log('✓ Trainer created');
|
||||
// Check if API key is set
|
||||
if (!process.env.OPENAI_API_KEY) {
|
||||
console.log('\n⚠️ OPENAI_API_KEY not set. Skipping initialization test.');
|
||||
console.log(' Set OPENAI_API_KEY to test full functionality.\n');
|
||||
console.log('✅ Integration code structure is valid!');
|
||||
return;
|
||||
}
|
||||
// Initialize
|
||||
console.log('✓ Initializing DSPy.ts...');
|
||||
await trainer.initialize();
|
||||
console.log('✓ Initialization complete\n');
|
||||
// Get stats
|
||||
const stats = trainer.getStatistics();
|
||||
console.log('📊 Statistics:');
|
||||
console.log(` Total Iterations: ${stats.totalIterations}`);
|
||||
console.log(` Best Score: ${stats.bestScore}`);
|
||||
console.log(` Training Examples: ${stats.trainingExamples}`);
|
||||
console.log('\n✅ All tests passed!');
|
||||
}
|
||||
catch (error) {
|
||||
console.error('\n❌ Test failed:', error.message);
|
||||
if (error.details) {
|
||||
console.error('Details:', error.details);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
test().catch(console.error);
|
||||
//# sourceMappingURL=test-dspy-integration.js.map
|
||||
Reference in New Issue
Block a user