rubyCodes/customer-support-openenv
0
1import requests
2
3BASE_URL = "http://127.0.0.1:8000"
4
5def reset():
6 response = requests.post(f"{BASE_URL}/reset", json={})
7 return response.json()
8
9def step(action):
10 response = requests.post(f"{BASE_URL}/step", json={"action": action})
11 return response.json()
12
13def run_episode():
14 print("Resetting environment...")
15 state = reset()
16 print("Initial State:", state)
17
18 ticket = "I was charged twice for my order"
19
20 print("\nStep 1: Classify")
21 result = step({
22 "ticket_text": ticket,
23 "action_type": "classify"
24 })
25 print(result)
26
27 print("\nStep 2: Respond")
28 result = step({
29 "ticket_text": ticket,
30 "action_type": "respond"
31 })
32 print(result)
33
34 print("\nStep 3: Escalate")
35 result = step({
36 "ticket_text": ticket,
37 "action_type": "escalate"
38 })
39 print(result)
40
41
42if __name__ == "__main__":
43 run_episode()