Spaces:
No application file
No application file
Download tmp/test_baseline.py from Adi-19/SupportEnv: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/Adi-19/SupportEnv/resolve/main/tmp/test_baseline.py
- Command line
-
hf download hf://spaces/Adi-19/SupportEnv/tmp/test_baseline.py
-
curl -L -o test_baseline.py https://huggingface.co/spaces/Adi-19/SupportEnv/resolve/main/tmp/test_baseline.py
1.32 kB
| 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() | |