kevanthonyP commited on
Commit
8922623
Β·
verified Β·
1 Parent(s): 7c90c1e

Create env_models.py

Browse files
Files changed (1) hide show
  1. env_models.py +101 -0
env_models.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ models.py β€” Typed Pydantic models for IT Support Triage OpenEnv environment.
3
+ All inputs/outputs are strongly typed for OpenEnv spec compliance.
4
+ """
5
+
6
+ from enum import Enum
7
+ from typing import Optional, List
8
+ from pydantic import BaseModel, Field
9
+
10
+
11
+ # ─── Enumerations ────────────────────────────────────────────────────────────
12
+
13
+ class TicketCategory(str, Enum):
14
+ HARDWARE = "hardware"
15
+ SOFTWARE = "software"
16
+ NETWORK = "network"
17
+ SECURITY = "security"
18
+ ACCESS = "access"
19
+ EMAIL = "email"
20
+ PRINTER = "printer"
21
+ OTHER = "other"
22
+
23
+
24
+ class TicketPriority(str, Enum):
25
+ CRITICAL = "critical" # P1 β€” system down, security breach, data loss
26
+ HIGH = "high" # P2 β€” major function impaired
27
+ MEDIUM = "medium" # P3 β€” degraded but workaround exists
28
+ LOW = "low" # P4 β€” cosmetic / minor inconvenience
29
+
30
+
31
+ class EscalationDecision(str, Enum):
32
+ ESCALATE = "escalate"
33
+ SELF_RESOLVE = "self_resolve"
34
+ MONITOR = "monitor"
35
+
36
+
37
+ class Department(str, Enum):
38
+ TIER1_HELPDESK = "tier1_helpdesk"
39
+ TIER2_SUPPORT = "tier2_support"
40
+ SECURITY_TEAM = "security_team"
41
+ NETWORK_OPS = "network_ops"
42
+ SYSADMIN = "sysadmin"
43
+ VENDOR_SUPPORT = "vendor_support"
44
+
45
+
46
+ # ─── Observation (what the agent sees) ───────────────────────────────────────
47
+
48
+ class TicketObservation(BaseModel):
49
+ """The full context provided to the agent for each ticket."""
50
+ ticket_id: str = Field(..., description="Unique ticket identifier")
51
+ subject: str = Field(..., description="Ticket subject line")
52
+ body: str = Field(..., description="Full ticket description from user")
53
+ reporter_name: str = Field(..., description="Name of the person filing the ticket")
54
+ reporter_role: str = Field(..., description="Job role of the reporter")
55
+ system_info: Optional[str] = Field(None, description="OS/software version if provided")
56
+ timestamp: str = Field(..., description="ISO 8601 submission timestamp")
57
+ previous_tickets: int = Field(0, description="Number of prior tickets from this user")
58
+ task_instruction: str = Field(..., description="What the agent must do for this task")
59
+ valid_categories: List[str] = Field(..., description="Allowed category values")
60
+ valid_priorities: List[str] = Field(..., description="Allowed priority values")
61
+ valid_departments: List[str] = Field(..., description="Allowed department routing values")
62
+
63
+
64
+ # ─── Action (what the agent does) ────────────────────────────────────────────
65
+
66
+ class TriageAction(BaseModel):
67
+ """The agent's triage decision for a ticket."""
68
+ category: TicketCategory = Field(..., description="Ticket category classification")
69
+ priority: TicketPriority = Field(..., description="Assigned priority level")
70
+ department: Department = Field(..., description="Routing destination")
71
+ escalate: EscalationDecision = Field(..., description="Escalation decision")
72
+ response: str = Field(..., description="Response message to send to the user (max 500 chars)")
73
+ reasoning: str = Field(..., description="Internal reasoning for the triage decision")
74
+
75
+ class Config:
76
+ use_enum_values = True
77
+
78
+
79
+ # ─── Step result ─────────────────────────────────────────────────────────────
80
+
81
+ class StepResult(BaseModel):
82
+ """Returned after each step() call."""
83
+ observation: Optional[TicketObservation] = Field(None, description="Next observation (None if episode done)")
84
+ reward: float = Field(..., description="Reward for this step (0.0–1.0)")
85
+ done: bool = Field(..., description="Whether the episode has ended")
86
+ info: dict = Field(default_factory=dict, description="Grader breakdown and metadata")
87
+
88
+
89
+ # ─── Environment state ────────────────────────────────────────────────────────
90
+
91
+ class EnvState(BaseModel):
92
+ """Full environment state snapshot."""
93
+ task_id: str
94
+ task_name: str
95
+ task_description: str
96
+ current_step: int
97
+ max_steps: int
98
+ total_reward: float
99
+ done: bool
100
+ current_ticket: Optional[TicketObservation]
101
+ history: List[dict]