contaigents
Version:
Modular AI Content Ecosystem with Audio Generation
139 lines (138 loc) โข 5.87 kB
JavaScript
/**
* Phase 1 Test: Generic Agent Identity & System Prompts
*
* This test verifies that:
* 1. Agent has generic identity (not story-focused)
* 2. System prompt includes multi-modal capabilities
* 3. State machine documentation is present
* 4. Intent detection examples are included
* 5. Multi-modal usage examples are present
*/
import { PromptTemplates } from '../services/prompts/PromptTemplates.js';
function testPhase1() {
console.log('๐งช Phase 1 Test: Generic Agent Identity & System Prompts\n');
const systemPrompt = PromptTemplates.getDefaultSystemPrompt();
// Test 1: Generic Identity (NOT story-focused)
console.log('Test 1: Generic Identity');
const hasGenericIdentity = systemPrompt.includes('generic content development platform');
const notStoryFocused = !systemPrompt.startsWith('You can create cinematic screenplays');
console.log(` โ Has generic identity: ${hasGenericIdentity ? 'โ
' : 'โ'}`);
console.log(` โ Not story-focused opening: ${notStoryFocused ? 'โ
' : 'โ'}`);
// Test 2: Multi-Modal Capabilities Listed
console.log('\nTest 2: Multi-Modal Capabilities');
const capabilities = [
'File Operations',
'Audio Tools',
'Video & Image Tools',
'ffmpeg',
'audio_generation',
'speech_to_text',
'image_generation',
'cinematic_workflow'
];
capabilities.forEach(cap => {
const hasCapability = systemPrompt.includes(cap);
console.log(` โ ${cap}: ${hasCapability ? 'โ
' : 'โ'}`);
});
// Test 3: State Machine Documentation
console.log('\nTest 3: State Machine Documentation');
const stateChecks = [
'Story Project State Machine',
'OUTLINE_DRAFT',
'OUTLINE_CONFIRMED',
'SCREENPLAY_WRITING',
'ITERATION',
'workflow_state',
'auto_generate_sketches'
];
stateChecks.forEach(check => {
const hasCheck = systemPrompt.includes(check);
console.log(` โ ${check}: ${hasCheck ? 'โ
' : 'โ'}`);
});
// Test 4: Intent Detection Examples
console.log('\nTest 4: Intent Detection Examples');
const intentChecks = [
'Intent Detection',
'Questions (No Workflow Trigger)',
'Content Analysis (Use Tools, No Story Workflow)',
'Story Project Work (Apply State Machine)',
'Explicit Requests (Always Honor)'
];
intentChecks.forEach(check => {
const hasCheck = systemPrompt.includes(check);
console.log(` โ ${check}: ${hasCheck ? 'โ
' : 'โ'}`);
});
// Test 5: Multi-Modal Usage Examples
console.log('\nTest 5: Multi-Modal Usage Examples');
const exampleChecks = [
'Video Analysis (No Story Workflow)',
'Audio Extraction (No Story Workflow)',
'Question About Story (No Workflow Trigger)',
'Story Project Creation (State Machine Activates)',
'Audio Generation (No Story Context)'
];
exampleChecks.forEach(check => {
const hasCheck = systemPrompt.includes(check);
console.log(` โ ${check}: ${hasCheck ? 'โ
' : 'โ'}`);
});
// Test 6: Critical Behavior Guidelines
console.log('\nTest 6: Critical Behavior Guidelines');
const behaviorChecks = [
'DO NOT assume every request is about story creation',
'Answer questions directly without triggering workflows',
'Use appropriate tools based on user intent',
'Only enter story creation mode when explicitly requested',
'Never automatically change user\'s auto-sketch preference'
];
behaviorChecks.forEach(check => {
const hasCheck = systemPrompt.includes(check);
console.log(` โ ${check}: ${hasCheck ? 'โ
' : 'โ'}`);
});
// Test 7: Tool Examples Present
console.log('\nTest 7: Tool Examples Present');
const toolExamples = [
'<tool_call name="ffmpeg"',
'<tool_call name="audio_generation"',
'<tool_call name="read_file"',
'<tool_call name="write_file"',
'<tool_call name="cinematic_workflow"'
];
toolExamples.forEach(example => {
const hasExample = systemPrompt.includes(example);
console.log(` โ ${example}: ${hasExample ? 'โ
' : 'โ'}`);
});
// Summary
console.log('\n' + '='.repeat(60));
console.log('๐ Phase 1 Test Summary');
console.log('='.repeat(60));
const allTests = [
hasGenericIdentity,
notStoryFocused,
...capabilities.map(c => systemPrompt.includes(c)),
...stateChecks.map(c => systemPrompt.includes(c)),
...intentChecks.map(c => systemPrompt.includes(c)),
...exampleChecks.map(c => systemPrompt.includes(c)),
...behaviorChecks.map(c => systemPrompt.includes(c)),
...toolExamples.map(e => systemPrompt.includes(e))
];
const passedTests = allTests.filter(t => t).length;
const totalTests = allTests.length;
const passRate = ((passedTests / totalTests) * 100).toFixed(1);
console.log(`\nTests Passed: ${passedTests}/${totalTests} (${passRate}%)`);
if (passedTests === totalTests) {
console.log('\nโ
All Phase 1 tests passed! The agent now has:');
console.log(' - Generic content development platform identity');
console.log(' - Multi-modal capabilities documentation');
console.log(' - Story project state machine support');
console.log(' - Intent detection guidelines');
console.log(' - Multi-modal usage examples');
}
else {
console.log('\nโ ๏ธ Some tests failed. Review the output above.');
}
// Optional: Print prompt length
console.log(`\n๐ System Prompt Length: ${systemPrompt.length} characters`);
console.log(` (${Math.ceil(systemPrompt.length / 4)} estimated tokens)`);
}
// Run the test
testPhase1();