File size: 3,001 Bytes
d3df8c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
93
94
95
96
"""

Setup script to create required directories for OpenEnv project.

Run: python setup_dirs.py

"""

import os
from pathlib import Path

def create_directories():
    """Create all required directories for the project."""
    
    # Get the project root (where this script is)
    project_root = Path(__file__).parent
    
    # Directories to create
    directories = [
        "outputs",
        "outputs/logs",
        "outputs/results", 
        "outputs/checkpoints",
        "outputs/visualizations",
        "logs",
        "data",
        "data/raw",
        "data/processed",
        "configs",
    ]
    
    print(f"Setting up directories in: {project_root}")
    print("-" * 50)
    
    for dir_path in directories:
        full_path = project_root / dir_path
        if not full_path.exists():
            full_path.mkdir(parents=True, exist_ok=True)
            print(f"✅ Created: {dir_path}")
        else:
            print(f"✓ Already exists: {dir_path}")
    
    print("-" * 50)
    print("✅ Directory setup complete!")
    
    # Also create a .gitkeep file to keep empty directories in git
    gitkeep_path = project_root / "outputs" / ".gitkeep"
    if not gitkeep_path.exists():
        with open(gitkeep_path, 'w') as f:
            f.write("# This directory is for outputs\n")
        print(f"✅ Created: outputs/.gitkeep")

def check_environment():
    """Check if environment is properly configured."""
    print("\n" + "="*50)
    print("Environment Check")
    print("="*50)
    
    # Check Python version
    import sys
    print(f"Python version: {sys.version}")
    
    # Check for .env file
    env_file = Path(__file__).parent / ".env"
    if env_file.exists():
        print("✅ .env file found")
    else:
        print("⚠️  .env file not found (optional)")
        print("   Create .env with: HF_TOKEN=your_token_here")
    
    # Check for required packages
    required_packages = ["openai", "requests", "fastapi", "uvicorn"]
    for package in required_packages:
        try:
            __import__(package)
            print(f"✅ {package} installed")
        except ImportError:
            print(f"❌ {package} not installed")
            print(f"   Install with: pip install {package}")
    
    # Check openenv
    try:
        import openenv
        print(f"✅ openenv installed (version: {openenv.__version__ if hasattr(openenv, '__version__') else 'unknown'})")
    except ImportError:
        print("❌ openenv not installed")
        print("   Install with: pip install openenv")

if __name__ == "__main__":
    create_directories()
    check_environment()
    
    print("\n" + "="*50)
    print("Next Steps:")
    print("="*50)
    print("1. Start the server:   python server/app.py")
    print("2. Run inference:      python inference.py --mode rule")
    print("3. Run LLM:           python inference.py --mode llm")
    print("="*50)