openev_mail_traige / generate_synth_data.py
mohammed1916's picture
Upload folder using huggingface_hub
3f3ebda verified
Raw
History Blame Contribute Delete
1.07 kB
import requests
import json
API_URL = "http://127.0.0.1:8000/api/triage"
vip_payload = {
"subject": "Discussion regarding Q4",
"sender": "vip-client@example.com",
"body": "Hello, let's chat about our strategy for Q4."
}
phish_payload = {
"subject": "ACTION REQUIRED",
"sender": "no-reply@security-alert.com",
"body": "Your account will be suspended. Urgent wire transfer needed."
}
def test_payload(name, payload):
print(f"--- Testing {name} Payload ---")
try:
response = requests.post(API_URL, json=payload)
response.raise_for_status()
res = response.json()
print(f"Category: {res['category']}")
print(f"Urgency: {res['urgency']}")
print(f"Actions: {res['suggested_actions']}")
print(f"Reasoning: {res['reasoning']}\n")
except Exception as e:
print(f"Failed to test {name}. Ensure the server is running on localhost:8000. Error: {e}")
if __name__ == "__main__":
test_payload("VIP Sender", vip_payload)
test_payload("Phishing Detection", phish_payload)