Spaces:
Sleeping
Sleeping
File size: 3,507 Bytes
adb0674 6c7a6ef adb0674 6c7a6ef adb0674 6c7a6ef adb0674 | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | from __future__ import annotations
from enum import Enum
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
class ActionType(str, Enum):
CLASSIFY = "classify"
REPLY = "reply"
ESCALATE = "escalate"
CLOSE = "close"
REQUEST_INFO = "request_info"
UPDATE_PRIORITY = "update_priority"
ASSIGN_QUEUE = "assign_queue"
class TicketStatus(str, Enum):
NEW = "new"
OPEN = "open"
PENDING = "pending"
ESCALATED = "escalated"
RESOLVED = "resolved"
CLOSED = "closed"
class PriorityLevel(str, Enum):
LOW = "low"
NORMAL = "normal"
HIGH = "high"
URGENT = "urgent"
class TicketCategory(str, Enum):
BILLING = "billing"
SECURITY = "security"
INCIDENT = "incident"
GENERAL = "general"
class ConversationTurn(BaseModel):
model_config = ConfigDict(extra="forbid")
speaker: str
message: str
timestamp: str | None = None
class Action(BaseModel):
model_config = ConfigDict(extra="forbid")
action_type: ActionType
message: str = ""
queue: str | None = None
priority: PriorityLevel | None = None
tags: list[str] = Field(default_factory=list)
resolution_code: str | None = None
class Reward(BaseModel):
model_config = ConfigDict(extra="forbid")
value: float
components: dict[str, float] = Field(default_factory=dict)
reason: str = ""
class Observation(BaseModel):
model_config = ConfigDict(extra="forbid")
task_id: str
difficulty: str
ticket_id: str
subject: str
customer_message: str
extracted_entities: dict[str, Any] = Field(default_factory=dict)
customer_metadata: dict[str, str] = Field(default_factory=dict)
attachment_refs: list[str] = Field(default_factory=list)
sla_deadline_minutes: int | None = None
current_status: TicketStatus
current_queue: str
current_priority: PriorityLevel
conversation_history: list[ConversationTurn] = Field(default_factory=list)
required_missing_fields: list[str] = Field(default_factory=list)
last_action_error: str | None = None
step_count: int
max_steps_remaining: int
class EpisodeState(BaseModel):
model_config = ConfigDict(extra="forbid")
task_id: str
difficulty: str
ticket_id: str
subject: str
customer_message: str
extracted_entities: dict[str, Any] = Field(default_factory=dict)
customer_metadata: dict[str, str] = Field(default_factory=dict)
attachment_refs: list[str] = Field(default_factory=list)
sla_deadline_minutes: int | None = None
ground_truth_category: TicketCategory
gold_queue: str
gold_priority: PriorityLevel
gold_resolution_path: list[str] = Field(default_factory=list)
required_diagnostic_fields: list[str] = Field(default_factory=list)
requested_fields: list[str] = Field(default_factory=list)
current_status: TicketStatus
current_queue: str
current_priority: PriorityLevel
progress_flags: dict[str, bool] = Field(default_factory=dict)
episode_metadata: dict[str, Any] = Field(default_factory=dict)
conversation_history: list[ConversationTurn] = Field(default_factory=list)
action_history: list[Action] = Field(default_factory=list)
reward_history: list[Reward] = Field(default_factory=list)
step_count: int
max_steps: int
done: bool = False
last_action_error: str | None = None
closed_prematurely: bool = False
escalation_triggered: bool = False
final_score: float | None = None
|