File size: 2,162 Bytes
b6ade9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Example script showing manual interaction with the environment (no LLM)
"""
from environment import ScamDetectionEnv
from tasks import get_all_tasks


def run_manual_example():
    """Run example with hardcoded actions"""
    print("=== Manual Environment Example ===\n")

    # Get all tasks
    tasks = get_all_tasks()

    for task in tasks:
        print(f"\n{'='*60}")
        print(f"Task: {task['name']} ({task['difficulty']})")
        print(f"{'='*60}")
        print(f"\nContent:\n{task['content']}\n")

        # Create environment
        env = ScamDetectionEnv(task)

        # Reset
        obs = env.reset()
        print(f"Step 1 - {obs.message}")

        # Step 1: Classify
        action1 = f"classify('{task['expected_classification']}')"
        print(f"Action: {action1}")
        obs, reward, done, info = env.step(action1)
        print(f"Reward: {reward:.2f}\n")

        # Step 2: Decide
        print(f"Step 2 - {obs.message}")
        action2 = f"decide('{task['expected_decision']}')"
        print(f"Action: {action2}")
        obs, reward, done, info = env.step(action2)
        print(f"Reward: {reward:.2f}\n")

        # Step 3: Reason
        print(f"Step 3 - {obs.message}")
        reasoning = f"This appears to be a {task['expected_classification']} with indicators including {', '.join(task['expected_reasoning_keywords'][:3])}"
        action3 = f"reason('{reasoning}')"
        print(f"Action: {action3}")
        obs, reward, done, info = env.step(action3)
        print(f"Reward: {reward:.2f}\n")

        # Show final grade
        if 'final_grade' in info:
            grade = info['final_grade']
            print(f"{'='*60}")
            print("FINAL GRADE")
            print(f"{'='*60}")
            print(f"Total Score: {grade['total']:.2f}")
            print(f"  - Classification: {grade['classification']:.2f} (weight: {grade['classification_weight']})")
            print(f"  - Decision: {grade['decision']:.2f} (weight: {grade['decision_weight']})")
            print(f"  - Reasoning: {grade['reasoning']:.2f} (weight: {grade['reasoning_weight']})")


if __name__ == "__main__":
    run_manual_example()