Files

64 lines
2.2 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"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