File size: 3,014 Bytes
d0fdbcd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/env python3
"""
Quick start script for the AI Code Generation System.
Runs the complete pipeline on sample prompts.
"""
import sys
import json
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from pipeline import Pipeline
from runtime_simulator import validate_config_executable
def main():
"""Run quick start demo."""
print("\n" + "="*70)
print("π€ AI PLATFORM ENGINEER - CODE GENERATION SYSTEM")
print("="*70)
print("\n")
# Initialize pipeline
pipeline = Pipeline(use_llm=False) # Using rule-based for demo
# Example prompts
examples = [
{
"title": "CRM System",
"prompt": "Build a CRM with login, contacts, dashboard, role-based access, and premium plan with payments. Admins can see analytics."
},
{
"title": "E-commerce Platform",
"prompt": "Create an e-commerce platform with product listing, shopping cart, checkout, payment processing, order tracking, and admin inventory management."
},
{
"title": "Edge Case - Vague Prompt",
"prompt": "Build something useful"
}
]
# Process each example
for i, example in enumerate(examples, 1):
print(f"\nπ Example {i}: {example['title']}")
print(f"Prompt: {example['prompt'][:80]}...")
print("-" * 70)
# Generate
config, exec_log = pipeline.generate(example['prompt'])
# Validate
is_executable, exec_report = validate_config_executable(config)
# Display results
print(f"\nβ Generation Status: {exec_log.get('final_status', 'unknown')}")
print(f"β Executable: {'YES β' if is_executable else 'NO (with warnings)'}")
print(f"β Database Tables: {len(config.get('database_schema', []))}")
print(f"β API Endpoints: {len(config.get('api_schema', []))}")
print(f"β UI Pages: {len(config.get('ui_schema', []))}")
# Show first 500 chars of config
config_json = json.dumps(config, indent=2)
print(f"\nπ Generated Config (first 500 chars):")
print(config_json[:500] + "...\n")
# Show validation report
if exec_report.get("errors"):
print("β οΈ Validation Errors:")
for error in exec_report["errors"][:3]:
print(f" - {error}")
if exec_report.get("warnings"):
print("β οΈ Warnings:")
for warning in exec_report["warnings"][:3]:
print(f" - {warning}")
print("\n" + "="*70)
print("β
QUICK START DEMO COMPLETE")
print("="*70)
print("\nπ Next Steps:")
print(" 1. Run web interface: python web/app.py")
print(" 2. Run evaluation: python evaluation/evaluator.py")
print(" 3. Check README.md for full documentation")
print("\n")
if __name__ == "__main__":
main()
|