Spaces:
No application file
No application file
Download tmp/test_grader.py from Adi-19/SupportEnv: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/Adi-19/SupportEnv/resolve/main/tmp/test_grader.py
- Command line
-
hf download hf://spaces/Adi-19/SupportEnv/tmp/test_grader.py
-
curl -L -o test_grader.py https://huggingface.co/spaces/Adi-19/SupportEnv/resolve/main/tmp/test_grader.py
1.02 kB
| import requests | |
| def test_grader(): | |
| url = "http://localhost:8001/grader" | |
| payload = { | |
| "task_id": "task_easy_faq", | |
| "episode_data": { | |
| "trajectory": [ | |
| {"action": {"action_type": "classify", "content": "billing"}, "reward": 0.25}, | |
| {"action": {"action_type": "respond", "content": "I can help with that."}, "reward": 0.3}, | |
| {"action": {"action_type": "resolve", "content": "Closed."}, "reward": 0.4} | |
| ], | |
| "difficulty": "easy", | |
| "is_resolved": True, | |
| "classification_correct": True, | |
| "escalation_correct": True, | |
| "total_steps": 3, | |
| "max_steps": 5 | |
| } | |
| } | |
| print(f"Sending request to {url}...") | |
| response = requests.post(url, json=payload) | |
| print(f"Status Code: {response.status_code}") | |
| try: | |
| print(f"Response: {response.json()}") | |
| except: | |
| print(f"Response text: {response.text}") | |
| if __name__ == "__main__": | |
| test_grader() | |