Spaces:
No application file
No application file
File size: 910 Bytes
520bc7a | 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 | 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"])
|