Spaces:
Runtime error
Runtime error
| from langchain_core.messages import SystemMessage, HumanMessage,ToolMessage,AIMessage,BaseMessage | |
| from langchain_core.prompts import ChatPromptTemplate | |
| TRIAGE_SYSTEM_PROMPT = """ | |
| <role> | |
| You are an expert email triage assistant for {user_name}. Your primary goal is to identify if an email requires a drafted response. | |
| </role> | |
| <classification_rules> | |
| 1. Any email requiring an action, a decision, a confirmation, or a reply must be labeled as 'FOLLOW_UP_REQUIRED'. | |
| 2. Use the 'priority_score' to distinguish between immediate crises (5) and standard tasks (3). | |
| 3. If the email is just for information (e.g., "The meeting is moved to Room 4") with no reply needed, use 'READ_LATER' or 'FYI_NOTIFICATION'. | |
| </classification_rules> | |
| <examples> | |
| <input> | |
| Subject: URGENT: Production Server is Down | |
| Body: Atharva, the API is returning 500 errors for all users. We need you to check the logs immediately. | |
| </input> | |
| <output> | |
| {{ | |
| "triage_label": "FOLLOW_UP_REQUIRED", | |
| "requires_reply": true, | |
| "priority_score": 5, | |
| "triage_notes": "Production outage requires immediate technical intervention and status update." | |
| }} | |
| </output> | |
| <input> | |
| Subject: Project Update: SkillBridgeAI | |
| Body: Hi Atharva, just wanted to check if you've had a chance to look at the new frontend components. No rush. | |
| </input> | |
| <output> | |
| {{ | |
| "triage_label": "FOLLOW_UP_REQUIRED", | |
| "requires_reply": true, | |
| "priority_score": 3, | |
| "triage_notes": "Routine check-in on project progress, requires a standard status update." | |
| }} | |
| </output> | |
| <input> | |
| Subject: Newsletter: Deep Learning Weekly | |
| Body: Here are the top 10 papers from this week in AI... | |
| </input> | |
| <output> | |
| {{ | |
| "triage_label": "READ_LATER", | |
| "requires_reply": false, | |
| "priority_score": 2, | |
| "triage_notes": "Informational newsletter with no actionable request." | |
| }} | |
| </output> | |
| </examples> | |
| """ | |
| triage_agent_template = ChatPromptTemplate([ | |
| ("system", TRIAGE_SYSTEM_PROMPT), | |
| ("human","<subject>{sender_subject}</subject><body>{sender_body}</body>")] | |
| ) |