UNPKG

contaigents

Version:

Modular AI Content Ecosystem with Audio Generation

75 lines (74 loc) • 3.03 kB
#!/usr/bin/env node import { ImageAnalysisTool } from '../services/tools/ImageAnalysisTool.js'; async function testImageAnalysis() { console.log('šŸ” Testing Image Analysis Tool...\n'); const tool = new ImageAnalysisTool(process.cwd()); // Test 1: Basic image analysis console.log('šŸ“‹ Test 1: Basic Image Analysis'); const result1 = await tool.execute({ image_path: '../demo/test_ref_image.jpeg', question: 'What do you see in this image? Describe the main elements, colors, and overall composition.' }); if (result1.success) { console.log('āœ… Basic analysis successful!'); console.log('šŸ“Š Result data:', JSON.stringify(result1.data, null, 2)); console.log('šŸ’¬ Analysis:', result1.data.analysis); } else { console.log('āŒ Basic analysis failed:', result1.error); } // Test 2: Detailed style analysis console.log('\nšŸŽØ Test 2: Detailed Style Analysis'); const result2 = await tool.execute({ image_path: '../demo/test_ref_image.jpeg', question: 'Analyze the artistic style of this image in detail. What are the key visual characteristics, color techniques, and compositional elements? How would you describe the mood and atmosphere?', detail_level: 'high' }); if (result2.success) { console.log('āœ… Style analysis successful!'); console.log('šŸŽØ Style Analysis:', result2.data.analysis); } else { console.log('āŒ Style analysis failed:', result2.error); } // Test 3: Brief analysis console.log('\n⚔ Test 3: Brief Analysis'); const result3 = await tool.execute({ image_path: '../demo/test_ref_image.jpeg', question: 'What is the dominant color scheme in this image?', detail_level: 'low' }); if (result3.success) { console.log('āœ… Brief analysis successful!'); console.log('šŸŽÆ Brief Analysis:', result3.data.analysis); } else { console.log('āŒ Brief analysis failed:', result3.error); } // Test 4: Parameter validation console.log('\nšŸ” Test 4: Parameter Validation'); const invalidResult1 = await tool.execute({ image_path: '../demo/test_ref_image.jpeg' // Missing question }); if (!invalidResult1.success) { console.log('āœ… Missing question correctly handled:', invalidResult1.error); } else { console.log('āŒ Missing question should have been caught'); } // Test 5: File validation console.log('\nšŸ“ Test 5: File Validation'); const invalidResult2 = await tool.execute({ image_path: 'nonexistent-image.jpg', question: 'What do you see?' }); if (!invalidResult2.success) { console.log('āœ… Nonexistent file correctly handled:', invalidResult2.error); } else { console.log('āŒ Nonexistent file should have been caught'); } console.log('\nšŸŽ‰ Image Analysis Tool tests completed!'); } testImageAnalysis().catch(console.error);