2025-11-16 13:35:41 -05:00
|
|
|
"""
|
|
|
|
|
Test Interactive Research Session
|
|
|
|
|
|
|
|
|
|
This test demonstrates the interactive CLI working end-to-end.
|
|
|
|
|
|
|
|
|
|
Author: Atomizer Development Team
|
|
|
|
|
Version: 0.1.0 (Phase 3)
|
|
|
|
|
Last Updated: 2025-01-16
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
# Set UTF-8 encoding for Windows console
|
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
|
import codecs
|
|
|
|
|
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer, errors='replace')
|
|
|
|
|
sys.stderr = codecs.getwriter('utf-8')(sys.stderr.buffer, errors='replace')
|
|
|
|
|
|
|
|
|
|
# Add project root to path
|
|
|
|
|
project_root = Path(__file__).parent.parent
|
|
|
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
|
|
|
|
|
|
# Add examples to path
|
|
|
|
|
examples_path = project_root / "examples"
|
|
|
|
|
sys.path.insert(0, str(examples_path))
|
|
|
|
|
|
|
|
|
|
from interactive_research_session import InteractiveResearchSession
|
refactor: Major reorganization of optimization_engine module structure
BREAKING CHANGE: Module paths have been reorganized for better maintainability.
Backwards compatibility aliases with deprecation warnings are provided.
New Structure:
- core/ - Optimization runners (runner, intelligent_optimizer, etc.)
- processors/ - Data processing
- surrogates/ - Neural network surrogates
- nx/ - NX/Nastran integration (solver, updater, session_manager)
- study/ - Study management (creator, wizard, state, reset)
- reporting/ - Reports and analysis (visualizer, report_generator)
- config/ - Configuration management (manager, builder)
- utils/ - Utilities (logger, auto_doc, etc.)
- future/ - Research/experimental code
Migration:
- ~200 import changes across 125 files
- All __init__.py files use lazy loading to avoid circular imports
- Backwards compatibility layer supports old import paths with warnings
- All existing functionality preserved
To migrate existing code:
OLD: from optimization_engine.nx_solver import NXSolver
NEW: from optimization_engine.nx.solver import NXSolver
OLD: from optimization_engine.runner import OptimizationRunner
NEW: from optimization_engine.core.runner import OptimizationRunner
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:30:59 -05:00
|
|
|
from optimization_engine.future.research_agent import CONFIDENCE_LEVELS
|
2025-11-16 13:35:41 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_interactive_demo():
|
|
|
|
|
"""Test the interactive session's demo mode."""
|
|
|
|
|
print("\n" + "="*80)
|
|
|
|
|
print("INTERACTIVE RESEARCH SESSION TEST")
|
|
|
|
|
print("="*80)
|
|
|
|
|
|
|
|
|
|
session = InteractiveResearchSession(auto_mode=True)
|
|
|
|
|
|
|
|
|
|
print("\n" + "-"*80)
|
|
|
|
|
print("[Test] Running Demo Mode (Automated)")
|
|
|
|
|
print("-"*80)
|
|
|
|
|
|
|
|
|
|
# Run the automated demo
|
|
|
|
|
session.run_demo()
|
|
|
|
|
|
|
|
|
|
print("\n" + "="*80)
|
|
|
|
|
print("Interactive Session Test: SUCCESS")
|
|
|
|
|
print("="*80)
|
|
|
|
|
|
|
|
|
|
print("\n What This Demonstrates:")
|
|
|
|
|
print(" - Interactive CLI interface created")
|
|
|
|
|
print(" - User-friendly prompts and responses")
|
|
|
|
|
print(" - Real-time knowledge gap analysis")
|
|
|
|
|
print(" - Learning from examples visually displayed")
|
|
|
|
|
print(" - Code generation shown step-by-step")
|
|
|
|
|
print(" - Knowledge reuse demonstrated")
|
|
|
|
|
print(" - Session documentation automated")
|
|
|
|
|
|
|
|
|
|
print("\n Next Steps:")
|
|
|
|
|
print(" 1. Run: python examples/interactive_research_session.py")
|
|
|
|
|
print(" 2. Try the 'demo' command to see automated workflow")
|
|
|
|
|
print(" 3. Make your own requests in natural language")
|
|
|
|
|
print(" 4. Provide examples when asked")
|
|
|
|
|
print(" 5. See the agent learn and generate code in real-time!")
|
|
|
|
|
|
|
|
|
|
print("\n" + "="*80 + "\n")
|
|
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
try:
|
|
|
|
|
success = test_interactive_demo()
|
|
|
|
|
sys.exit(0 if success else 1)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f"\n[ERROR] {e}")
|
|
|
|
|
import traceback
|
|
|
|
|
traceback.print_exc()
|
|
|
|
|
sys.exit(1)
|