CICD / test_live_endpoints.py
printf-sourav's picture
Fix float rounding output limit to prevent out of bounds exactly 1.0 rewards in logged inference metrics
36fffc4
Raw
History Blame Contribute Delete
961 Bytes
import requests
import json
BASE_URL = "https://printf-sourav-cicd.hf.space"
def print_res(name, res):
print(f"\n--- Testing HTTP {name} ---")
print(f"Status Code: {res.status_code}")
try:
print(json.dumps(res.json(), indent=2)[:300] + "...")
except:
print(res.text)
print("Starting live endpoint verification...\n")
# 1. Root Endpoint
print_res("GET /", requests.get(f"{BASE_URL}/"))
# 2. Health Endpoint
print_res("GET /health", requests.get(f"{BASE_URL}/health"))
# 3. Reset Endpoint (Initialize to a specific task)
reset_res = requests.post(f"{BASE_URL}/reset", json={"task_id": "easy-command-typo"})
print_res("POST /reset", reset_res)
# 4. State Endpoint (Checking internals after reset)
print_res("GET /state", requests.get(f"{BASE_URL}/state"))
# 5. Step Endpoint (Taking an action)
step_payload = {"action": "read_logs"}
print_res("POST /step (read_logs)", requests.post(f"{BASE_URL}/step", json=step_payload))