File size: 2,135 Bytes
fc163a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import json
import yaml
import requests
import subprocess
import time

def check_structure():
    print("--- 1. Structure Check ---")
    files = ["openenv.yaml", "inference.py", "env.py", "main.py", "Dockerfile", "requirements.txt"]
    for f in files:
        if os.path.exists(f):
            print(f"βœ… Found {f}")
        else:
            print(f"❌ Missing {f} (MANDATORY)")

def check_yaml():
    print("\n--- 2. Spec Validation ---")
    try:
        with open("openenv.yaml", "r") as f:
            data = yaml.safe_load(f)
            if data.get("openenv_v") and data.get("tasks"):
                print("βœ… openenv.yaml is valid")
                print(f"βœ… Found {len(data['tasks'])} tasks (Minimum 3 required)")
            else:
                print("❌ openenv.yaml is missing required fields")
    except Exception as e:
        print(f"❌ YAML Error: {e}")

def check_logs():
    print("\n--- 3. Inference Log Check ---")
    # We will simulate a quick run of inference.py and check the first/last lines
    # This requires the server to be running. For this check, we'll verify the code pattern.
    with open("inference.py", "r") as f:
        content = f.read()
        if "[START]" in content and "[STEP]" in content and "[END]" in content:
            print("βœ… inference.py uses correct log tags")
            if "OpenAI(" in content:
                print("βœ… Found OpenAI Client usage")
            else:
                print("❌ Missing OpenAI Client usage (REQIURED)")

def check_reward_scaling():
    print("\n--- 4. Reward Scaling Check ---")
    with open("env.py", "r") as f:
        env_content = f.read()
        if "reward += 0." in env_content or "reward -= 0." in env_content:
            print("βœ… Logic appears to use 0.0-1.0 normalized rewards")
        else:
            print("⚠️ Warning: Could not confirm normalized rewards automatically. Double check env.py.")

if __name__ == "__main__":
    check_structure()
    check_yaml()
    check_logs()
    check_reward_scaling()
    print("\n🏁 Validation Simulation Complete. If all above are green, you are ready!")