File size: 931 Bytes
9b0fda0
 
 
 
 
 
 
 
 
 
 
 
 
 
352ec10
9b0fda0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
from env.environment import CustomerSupportEnv
from env.models import Action

env = CustomerSupportEnv()

def reset():
    obs = env.reset()
    return {
        "observation": {
            "customer_query": obs.customer_query,
            "conversation_history": obs.conversation_history,
            "ticket_status": obs.ticket_status,
            "sentiment": obs.sentiment,
            "progress": float(obs.progress)
        }
    }

def step(action: dict):
    action_obj = Action(**action)

    obs, reward, done, info = env.step(action_obj)

    return {
        "observation": {
            "customer_query": obs.customer_query,
            "conversation_history": obs.conversation_history,
            "ticket_status": obs.ticket_status,
            "sentiment": obs.sentiment,
            "progress": float(obs.progress)
        },
        "reward": float(reward),
        "done": bool(done),
        "info": info
    }