Spaces:
No application file
No application file
| import requests | |
| BASE = "http://localhost:8000" | |
| # Step 1: Reset | |
| print("=== Resetting environment ===") | |
| r = requests.post(f"{BASE}/reset", json={}) | |
| print(r.json()) | |
| # Step 2: Read email | |
| print("\n=== Reading email ===") | |
| r = requests.post(f"{BASE}/step", json={ | |
| "action": {"type": "call_tool", "tool_name": "read_email", "arguments": {}} | |
| }) | |
| data = r.json() | |
| print(data) | |
| email_content = data["observation"]["result"]["structured_content"] | |
| print("\nEmail subject:", email_content.get("subject")) | |
| print("Email body:", email_content.get("body")) | |
| print("Categories:", email_content.get("categories")) | |
| # Step 3: Classify | |
| print("\n=== Classifying as 'billing' ===") | |
| r = requests.post(f"{BASE}/step", json={ | |
| "action": {"type": "call_tool", "tool_name": "classify_email", "arguments": {"category": "billing"}} | |
| }) | |
| result = r.json() | |
| print(result) | |
| print("\nReward:", result["reward"]) | |
| print("Done:", result["done"]) | |