test_goals_inclusion.pyโข4.16 kB
#!/usr/bin/env python3
"""
๐งช Test Script: Verify Goals/Project Plans Inclusion
"""
def test_goals_inclusion():
"""Test if project plans/goals are now included"""
print("๐งช TESTING GOALS INCLUSION IN OPTIMIZED PROMPTS")
print("=" * 60)
try:
# Test 1: Import optimized prompt generator
print("1๏ธโฃ Testing optimized prompt generator import...")
from optimized_prompt_generator import OptimizedPromptGenerator
generator = OptimizedPromptGenerator()
print("โ
OptimizedPromptGenerator imported successfully")
# Test 2: Create test context with project plans
print("\n2๏ธโฃ Testing context with project plans...")
from prompt_generator import PromptContext
# Create test context with project plans
test_context = PromptContext(
conversation_summary="Test conversation summary",
action_history="Test action history",
tech_stack="Test tech stack",
project_plans="๐ฏ PROJECT PLANS & OBJECTIVES:\n1. Build powerful conversation tracking system โ
\n2. Implement context-aware prompt processing โ
\n3. Create intelligent memory management system โ
\n4. Develop user preference learning โ
\n5. Build agent metadata system โ
\n6. Integrate with external AI assistants โ
\n7. Create seamless prompt enhancement pipeline โ
\n8. Implement real-time context injection โ
\n9. Build dynamic instruction processing system โ
\n10. Create adaptive, learning AI assistant โ
",
user_preferences="Test user preferences",
agent_metadata="Test agent metadata",
recent_interactions=[],
project_patterns=[],
best_practices=[],
common_issues=[],
development_workflow=[],
confidence_score=0.9,
context_type="test"
)
print("โ
Test context created with project plans")
# Test 3: Test context conversion
print("\n3๏ธโฃ Testing context conversion...")
context_dict = generator._context_to_dict(test_context)
print(f"โ
Context converted to dict")
print(f"๐ Available keys: {list(context_dict.keys())}")
print(f"๐ฏ Project plans available: {'project_plans' in context_dict}")
# Test 4: Test intent classification
print("\n4๏ธโฃ Testing intent classification...")
if generator.intent_selector:
relevant_context, intent_analysis = generator.intent_selector.select_relevant_context(
"test to see if we now have the goals section with project plans",
context_dict
)
print(f"โ
Intent classified successfully")
print(f"๐ฏ Intent: {intent_analysis.primary_intent.value}")
print(f"๐ Context requirements: {intent_analysis.context_requirements}")
print(f"๐ง Selected context: {list(relevant_context.keys())}")
print(f"๐ฏ Project plans in selected: {'project_plans' in relevant_context}")
else:
print("โ ๏ธ Intent selector not available")
# Test 5: Test conversation context formatting
print("\n5๏ธโฃ Testing conversation context formatting...")
conversation_context = generator._format_phase1_conversation_context(context_dict)
print(f"โ
Conversation context formatted")
print(f"๐ Result length: {len(conversation_context)}")
print(f"๐ฏ Contains goals: {'๐ฏ GOALS:' in conversation_context}")
print(f"๐ Formatted result:\n{conversation_context}")
print("\n" + "=" * 60)
print("๐งช TEST COMPLETE")
# Final assessment
if '๐ฏ GOALS:' in conversation_context:
print("๐ SUCCESS: Goals section is now included!")
else:
print("โ FAILURE: Goals section is still missing!")
except Exception as e:
print(f"โ Error during testing: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_goals_inclusion()