Spaces:
No application file
No application file
File size: 1,323 Bytes
448e111 | 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 |
import os
import sys
from pathlib import Path
# Add project root to sys.path
sys.path.insert(0, str(Path(__file__).parent.parent))
from server.environment import SupportEnvironment
from baseline.policy import BaselinePolicy
def test_baseline():
print("Testing baseline policy...")
try:
env = SupportEnvironment()
policy = BaselinePolicy()
difficulty = "easy"
print(f"Testing difficulty: {difficulty}")
observation = env.reset(seed=42, difficulty=difficulty)
policy.reset()
steps = 0
while not observation.done and steps < 10:
action = policy.act(observation)
print(f"Step {steps+1}: Action={action.action_type}")
observation = env.step(action)
steps += 1
print("Grading episode...")
grade_result = env.grade_episode()
print(f"Score: {grade_result.score}")
print(f"Feedback: {grade_result.feedback}")
print("Test PASSED!")
except Exception as e:
print(f"Test FAILED with error: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
# Ensure env variables are loaded if needed
os.environ["USE_LLM_GENERATOR"] = "false" # Force template generator
test_baseline()
|