image.png

Mid-term Project

Your AI Email Secretary

Business Problem - Automating Email Prioritization & Responses¶

image.png

Alex Carter, a seasoned Senior Manager in Software Development at Orion Tech Solutions, plays a pivotal role in ensuring the smooth execution of multiple IT projects. Orion Tech Solutions, a mid-sized IT services company, prides itself on delivering cutting-edge software solutions to global clients, balancing innovation with operational efficiency.

With years of experience in software engineering and project management, Alex’s day is a mix of strategic planning, problem-solving, and stakeholder coordination. Managing a diverse portfolio of projects, Alex works closely with internal teams, vendors, and clients, ensuring deliverables meet expectations while navigating technical and organizational challenges.

The Challenge

A high-profile client has recently entrusted Orion Tech Solutions with the development of a next-generation cloud security platform. While the project holds immense potential for growth and recognition, it also brings complexity, tight deadlines, and high stakeholder expectations.

As the project nears critical milestones, Alex faces multiple challenges:

  • Ensuring timely delivery while balancing resource constraints.
  • Managing escalations related to security vulnerabilities discovered during testing.
  • Communicating with clients, vendors, and internal teams to align expectations.
  • Handling unexpected system downtimes due to scheduled IT maintenance.
  • Addressing compliance concerns raised by the legal team on certain third-party integrations.

With multiple stakeholders relying on Alex’s leadership, clear and effective communication is essential. Every email, meeting, and decision made plays a role in determining the project's success.

The Case Study¶

This case study explores the real-world challenges Alex encounters, highlighting how well-structured communication can help in:

  1. Crisis Management – Handling security breaches and system outages.
  2. Client Relations – Effectively communicating progress and addressing feedback.
  3. Team Coordination – Ensuring alignment between development, security, and operations teams.
  4. Strategic Decision-Making – Navigating legal, financial, and technical roadblocks.

Through realistic scenarios and email exchanges, we will examine how Alex can leverage professional communication strategies to tackle these challenges head-on, ensuring project success and business continuity.

diagram.png

Objective¶

The goal of this project is to create a Generative AI-powered system that:

  1. Summarize yesterday’s emails into actionable insights. [Yesterbox Approach]
  2. Prioritizes emails based on urgency, sender, and context.
  3. Drafts context-aware responses, reducing manual effort.

LLM Setup¶

In [ ]:
!pip install -q openai==1.61.1
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/463.1 kB ? eta -:--:--
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸ 460.8/463.1 kB 16.3 MB/s eta 0:00:01
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 463.1/463.1 kB 10.5 MB/s eta 0:00:00
  • The config.json file should contain API_KEY and API Base URL provided by OpenAI.
  • You need to insert your actual API keys and endpoint URL obtained from your Olympus account. Refer to the OpenAI Access Token documentation for more information on how to generate and manage your API keys.
  • This code reads the config.json file and extracts the API details.
    • The API_KEY is a unique secret key that authorizes your requests to OpenAI's API.
    • The OPENAI_API_BASE is the API Base URL where the model will process your requests.

What To Do?

  • Use the sample config.json file provided.

  • Add their OpenAI API Key and Base URL to the file.

  • The config.json should look like this:

    {
          "API_KEY": "your_openai_api_key_here",
          "OPENAI_API_BASE": "https://aibe.mygreatlearning.com/openai/v1"
        }
    
In [ ]:
from google.colab import drive
drive.mount('/content/drive')
Mounted at /content/drive
In [ ]:
import os
project_path = "./Mid_Term_Project"
os.listdir(project_path)
Out[ ]:
['JHU_AGAI_W9_Mid_Term_Project_Learners_Notebook.ipynb',
 'Alex_emails_march_04.csv',
 'config.json']
In [ ]:
os.chdir('./Mid_Term_Project')
os.listdir()
Out[ ]:
['JHU_AGAI_W9_Mid_Term_Project_Learners_Notebook.ipynb',
 'Alex_emails_march_04.csv',
 'config.json']
In [ ]:
# @title Loading the `config.json` file
import json, os

# Load the JSON file and extract values
file_name = 'config.json'
with open(file_name, 'r') as file:
    config = json.load(file)
    os.environ['OPENAI_API_KEY']  = config.get("API_KEY") # Loading the API Key
    os.environ["OPENAI_BASE_URL"] = config.get("OPENAI_API_BASE") # Loading the API Base Url
In [ ]:
model_name = "gpt-4o-mini"
  • The API key and base URL are stored in environment variables to avoid hardcoding sensitive information in the code.
  • The OpenAI() object helps us interact with the model for prompt generation.
In [ ]:
from openai import OpenAI

# Initialize OpenAI client
client = OpenAI()
  • This function helps interact with the AI model using two prompts:
    • System Prompt: Provides background instructions to the model on how to behave.
    • User Prompt: Contains the user's query or task.
  • The client.chat.completions.create() method sends the request to the GPT model.
  • The temperature=0 setting ensures the response is deterministic and consistent.
  • If any error occurs, the function will print the error message.
In [ ]:
# @title LLM function
# @markdown Once the API details are filled, the notebook will automatically load the configuration, and learners can generate model outputs using the llm() function.


def llm(system_prompt, user_prompt):
  try:
      # Craft the messages to pass to chat.completions.create
      prompt = [
          {'role':'system', 'content': system_prompt},
          {'role': 'user', 'content': user_prompt}
      ]

      response = client.chat.completions.create(
          model=model_name,
          messages=prompt,
          temperature=0
      )

      return response.choices[0].message.content.strip()

  except Exception as e:
      prediction = f'Sorry, I encountered the following error: \n {e}'
      print(prediction)

Data Setup¶

Background¶

Name: Alex Carter
Company: Orion Tech Solutions (A mid-sized IT services company)
Role: Senior Manager, Software Developement

About You¶

Alex oversees multiple projects related to software development and IT infrastructure. Your role involves coordinating with stakeholders, ensuring timely delivery, handling escalations, and approving critical project-related decisions. You work with internal teams, vendors, and clients, making communication a crucial part of your job.

Objective: Load the dataset containing email records and apply the Yesterbox approach to filter emails received on the previous day.

In [ ]:
# @title Step 1: Load the Dataset
# Data Loading

import pandas as pd
df = pd.read_csv("./emails.csv", index_col="email_id", encoding='latin-1')      #Add the data file location
df
In [ ]:
df.head()
Out[ ]:
date_received sender subject body main_recipient
email_id
1 3/3/2025 Julia Martin Approval Request: Budget Approval Needed by EOD Hi Alex,\n\nI hope you're doing well. As we ap... Alex
2 3/3/2025 Fiona White Are Your APIs Secure? Reddit & Discord Sound t... Hi Alex,\n\nA heated Discord discussion in the... Alex
3 3/3/2025 Samantha Lee Approval Needed: Project Scope Adjustment for ... Hi Alex,\n\nWe’ve encountered an unexpected AP... Alex
4 3/3/2025 James Patel Subject: Daily Update – Project Titan (March 3) Hey Alex,\n\nQuick update on Project Titan for... Alex
5 3/3/2025 David Whitmore [URGENT] Dashboard Syncing Issues – Production... Hey Alex,\n\nWe’ve got a big issue right now—l... Alex
In [ ]:
# @title Step 2: Apply Yesterbox Filtering
# @markdown The Yesterbox approach involves processing emails from the previous day first before tackling today's emails.

# @markdown For this dataset, consider today's date as 4th March 2025.

# @markdown We filter the dataset to only include emails received on 3rd March 2025 (yesterday)
# (Yesterbox Approach)(Today: 4 march)



from datetime import datetime, timedelta

yesterday_date = pd.to_datetime("3/3/2025").strftime('%m/%d/%Y')

df['date_received'] = pd.to_datetime(df['date_received']).dt.strftime('%m/%d/%Y')

yesterday_emails = df[df['date_received'] == yesterday_date].reset_index(drop=True)
print(f"Filtered Emails Count: {len(yesterday_emails)}")
Filtered Emails Count: 51
In [ ]:
df.shape
Out[ ]:
(60, 5)
In [ ]:
# Here we see only 51 emails, as in 10 email had the date of 4th March 2025
yesterday_emails.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 51 entries, 0 to 50
Data columns (total 5 columns):
 #   Column          Non-Null Count  Dtype 
---  ------          --------------  ----- 
 0   date_received   51 non-null     object
 1   sender          51 non-null     object
 2   subject         51 non-null     object
 3   body            51 non-null     object
 4   main_recipient  51 non-null     object
dtypes: object(5)
memory usage: 2.1+ KB

TASK - Categorization of emails¶

Your task is to write the system_prompt & user_prompt for classifying all the emails into one of the below pre-defined categories.

  1. Urgent & High-Priority Emails:
    • Emails that require immediate action and must be addressed today.
  2. Deadline-Driven Emails:
    • Time-sensitive emails or meeting requests that need attention today.
  3. Routine Updates & Check-ins:
    • Emails that require review and acknowledgment without immediate action.
  4. Non-Urgent Informational Emails:
    • Emails that can be deferred or delegated to another time or person.
  5. Personal & Social Emails:
    • Emails that can be reviewed optionally at a later time.
  6. Spam/Unimportant Emails:
    • Emails that are not relevant and should be filtered out.

Note: Your response should include only one of the above six specified categories and nothing else.

Example Email : 'You Won a Free iPhone 15 Pro! ?? Click to Claim'
Expected Response : 'Spam/Unimportant Emails'

image.png

In [ ]:
# @title Code to add categories to the dataset
categories = ['Urgent & High-Priority Emails',
              'Deadline-Driven Emails',
              'Routine Updates & Check-ins',
              'Non-Urgent Informational Emails',
              'Personal & Social Emails',
              'Spam/Unimportant Emails']
In [ ]:
system_prompt = """

You are an AI Email CLassifier. Your task is to read a given email and classify them according to the below fixed categories:
1. Urgent & High-Priority Emails
2. Deadline-Driven Emails
3. Routine Updates & Check-ins
4. Non-Urgent Informational Emails
5. Personal & Social Emails
6. Spam/Unimportant Emails
Rules - The response should include only the fixed category names as written above and no addtional explanation or punctuations. Do not invent any new categories or change the category names in any way. If the email is promotional or irrelevant classify it as "Spam/Unimportant Emails".
Example input and output -
  Example Email : 'You Won a Free iPhone 15 Pro! ?? Click to Claim'
  Expected Response : 'Spam/Unimportant Emails'

"""
In [ ]:
user_prompt = f"""

Classify the given email into exactly ONE of the predefined categories.


Respond with ONLY the category name from the list below:
- Urgent & High-Priority Emails
- Deadline-Driven Emails
- Routine Updates & Check-ins
- Non-Urgent Informational Emails
- Personal & Social Emails
- Spam/Unimportant Emails

"""
In [ ]:
# @title Categorizing the emails
from tqdm import tqdm  # Import the tqdm library for the progress bar

# Ensure the 'category' column exists in the DataFrame
if 'category' not in yesterday_emails.columns:
  yesterday_emails['category'] = None  # Create the column if it does not exist


for index, row in tqdm(yesterday_emails.iterrows(), total=df.shape[0], desc='Processing emails'):
  prompt = f"""{user_prompt}
    Please find the attached email below from yesterday that need to be analyzed:
    ```
    {row.to_string()}
    ```
  """

  category_by_llm = llm(system_prompt, prompt)

  # Append the category generated by the LLM to the 'category' column in the same row
  if category_by_llm in categories:
    yesterday_emails.at[index, 'category'] = category_by_llm
  else:
    yesterday_emails.at[index, 'category'] = ""
Processing emails:  85%|████████▌ | 51/60 [00:37<00:06,  1.35it/s]
In [ ]:
# Display the DataFrame which has categories
yesterday_emails.head()
Out[ ]:
date_received sender subject body main_recipient category
0 03/03/2025 Julia Martin Approval Request: Budget Approval Needed by EOD Hi Alex,\n\nI hope you're doing well. As we ap... Alex Deadline-Driven Emails
1 03/03/2025 Fiona White Are Your APIs Secure? Reddit & Discord Sound t... Hi Alex,\n\nA heated Discord discussion in the... Alex Non-Urgent Informational Emails
2 03/03/2025 Samantha Lee Approval Needed: Project Scope Adjustment for ... Hi Alex,\n\nWe’ve encountered an unexpected AP... Alex Urgent & High-Priority Emails
3 03/03/2025 James Patel Subject: Daily Update – Project Titan (March 3) Hey Alex,\n\nQuick update on Project Titan for... Alex Routine Updates & Check-ins
4 03/03/2025 David Whitmore [URGENT] Dashboard Syncing Issues – Production... Hey Alex,\n\nWe’ve got a big issue right now—l... Alex Urgent & High-Priority Emails
In [ ]:
yesterday_emails['category'].value_counts()
Out[ ]:
count
category
Urgent & High-Priority Emails 19
Routine Updates & Check-ins 19
Spam/Unimportant Emails 7
Deadline-Driven Emails 4
Non-Urgent Informational Emails 2

In [ ]:
total_yesterday = len(yesterday_emails)
category_counts = yesterday_emails['category'].value_counts().to_dict()

urgent_count = category_counts.get('Urgent & High-Priority Emails', 0)
deadline_count = category_counts.get('Deadline-Driven Emails', 0)

critical_count = urgent_count + deadline_count
non_critical_count = total_yesterday - critical_count

Task 1: Awareness of your email: Get to know the detailed summary of your email received¶

1A. Executive Dashboard (Top-Level Summary of Yesterday’s Inbox)¶

Note: Follow the instructions carefully and complete the missing sections.

image.png

Alex’s inbox is a delicate balance of urgent action items, strategic decisions, and routine updates. He must prioritize effectively—focusing on high-impact emails first, ensuring compliance with deadlines, and delegating less critical tasks to his team.

In this step, you will generate a high-level summary of the emails received using the AI Email Secretary. The AI will categorize emails into distinct categories and generate actionable insights.

TASK¶

Write the system_prompt & user_prompt that will guide the AI model to generate an executive summary based on the filtered data (yesterday_emails). The prompt should:

  1. Count the number of emails per category.

  2. Provide a final AI summary that highlights the number of critical emails requiring immediate action and the emails which can be handled later.

In [ ]:
# @title System Prompt
# Write your system prompt here
system_prompt = """

You are an Executive Email Assistant. Your task is to create an executive dashboard and give a top level summary of the emails in your inbox. The emails you are summarizing are only yesterday's emails and you need to provide a summary of those emails
where we know the count of the number of emails per category, highlight the number of critical emails that require immediate action and mention the emails that can be handled later.
Rules - Focus on being clear and concise, Highlight what needs attention today, Use a professional tone, do NOT invent data outside of the emails provided.

"""
In [ ]:
# @title User Prompt
# Write your user prompt here
user_prompt = f"""

Generate an Executive Summary of Emails using the Yesterbox approach.

Task:
1. Analyze the dataset of classified emails below.
2. Count the number of emails in each category.
3. Use these counts to generate the executive dashboard.

Rules:
1. Derive all numbers only from the dataset below.
2. Do noy assume or invent any values.
3. All totals and subtotals must be internally consistent.

See Emails from Yesterday:

```
{yesterday_emails.to_string()}
```
An example of how the output should look:
Executive Summary of Emails

1. Total Number of Emails Received: <number>
2. Total Number of Emails from Yesterday: <number>
3. Email Breakdown by Categories (Count Only):
   - Urgent & High-Priority Emails: <count>
   - Deadline-Driven Emails: <count>
   - Routine Updates (Review & Acknowledge): <count>
   - Non-Urgent Informational Emails: <count>
   - Personal & Social Emails: <count>
   - Spam/Unimportant Emails: <count>

4. AI Conclusion:
   - Critical Emails Requiring Immediate Attention:
      - Urgent & High-Priority Emails: <count>
      - Deadline-Driven Emails: <count>
      - Total Critical Emails: <sum>
   - Emails That Can Be Reviewed Later:
      - Routine Updates: <count>
      - Non-Urgent Informational Emails: <count>
      - Personal & Social Emails: <count>
      - Spam/Unimportant Emails: <count>
      - Total Non-Critical Emails: <sum>

Summary Insights:
- Provide a short executive insight (2–3 sentences) about workload, urgency, and prioritization.
- Use a professional leadership tone.

"""
In [ ]:
# @title  Calling the model and display the summary


response_1 = llm(system_prompt, user_prompt)        # llm is the model using gpt-4o-mini
response_1

from IPython.display import display, Markdown
display(Markdown(response_1))

Executive Summary of Emails

  1. Total Number of Emails Received: 50

  2. Total Number of Emails from Yesterday: 50

  3. Email Breakdown by Categories (Count Only):

    • Urgent & High-Priority Emails: 15
    • Deadline-Driven Emails: 6
    • Routine Updates (Review & Acknowledge): 15
    • Non-Urgent Informational Emails: 4
    • Personal & Social Emails: 0
    • Spam/Unimportant Emails: 10
  4. AI Conclusion:

    • Critical Emails Requiring Immediate Attention:
      • Urgent & High-Priority Emails: 15
      • Deadline-Driven Emails: 6
      • Total Critical Emails: 21
    • Emails That Can Be Reviewed Later:
      • Routine Updates: 15
      • Non-Urgent Informational Emails: 4
      • Personal & Social Emails: 0
      • Spam/Unimportant Emails: 10
      • Total Non-Critical Emails: 29

Summary Insights:
The current workload reflects a significant number of critical emails requiring immediate attention, particularly in the urgent and high-priority categories. It is essential to prioritize these communications to mitigate risks and ensure timely decision-making, while the remaining emails can be addressed subsequently.

Sample Output Example

A structured summary with the number of emails in each category and key action points.

image.png

1B. Urgent Emails from Yesterday (🛑 Must-Do First Today)¶

Note: Follow the instructions carefully and complete the missing sections.

image.png

Urgent & High-Priority Emails (Requires Immediate Action)

Examples of Expected Outputs

  • Subject: URGENT: Critical System Downtime – Immediate Attention Required

    Received: 03/03/2025

    Sender Name: David Whitmore

    Summary: David reports a major outage with the Orion Analytics Dashboard, impacting multiple manufacturing lines.

    Next Step: Provide an immediate resolution or workaround by 12 PM EST today and escalate to the engineering team if necessary.


  • Subject: URGENT: Medication Alerts Not Firing – This is Dangerous

    Received: 03/03/2025

    Sender Name: Rachel Thompson

    Summary: Rachel highlights a serious issue where automated medication alerts are not firing for ICU patients, posing a safety risk.

    Next Step: Join the emergency call and prioritize fixing the issue immediately.


  • Subject: Approval Request: Travel Budget for AWS Summit 2025

    Received: 03/03/2025

    Sender Name: Olivia Chen

    Summary: Olivia requests approval for travel expenses for two team members to attend the AWS Summit 2025.

    Next Step: Review the request and confirm if you can proceed with the budget approval.

TASK¶

Write the system_prompt & user_prompt that will guide the AI to write a Summary and the Next Step to be taken for the respective email, for all urgent and high-priority emails from the filtered data (urgent_emails)

Ensure each email summary follows this format:

  • Subject:
  • Received:
  • Sender Name:
  • Summary:
  • Next Step: (it should be particular to that email)

Note :- Apply instructions regarding Yesterbox Rule : Confirm that these emails were received yesterday and are part of today's to-do list.

In [ ]:
# @title System Prompt

# Write your system prompt here
system_prompt = """
You are an AI-powered Executive Email Assistant.Your role is to analyze the urgent and high-priority emails received yesterday and summarize them as part of today’s to-do list.

Rules to follow:
1. Assume all provided emails were received yesterday.
2. Treat all emails as requiring immediate action today.
3. For each email, generate a concise summary and a clear, specific next step.
4. Do not merge emails and do not invent details beyond the email content.
5. Use a professional, executive tone.
6. Follow the exact output format requested by the user.

"""

Question: Construct the user_prompt that will pass the filtered dataset to the AI model for identifying urgent emails.

In [ ]:
# Filtering out the emails that are urgent and high-priority
urgent_emails = yesterday_emails[yesterday_emails['category'] == 'Urgent & High-Priority Emails']
In [ ]:
# @title User Prompt

# Write your user prompt here
user_prompt = f"""

Below is a list of Urgent & High-Priority emails that were received yesterday and require immediate action today.

Your task is to:
1. Generate a concise summary for each email.
2. Clearly state the next step that should be taken today.
3. Ensure the next step is specific to that email.
4. Follow the exact format below for every email.

REQUIRED FORMAT (repeat for each email):

Subject:
Received:
Sender Name:
Summary:
Next Step:

IMPORTANT:
1. Add numbering for each new email..
2. Do not add headings or explanations.
3. Do not include any text outside the required format.
4. Ensure all emails are treated as part of today’s to-do list.

Below is the attached DataFrame, which contains all the emails that needs to be summarized:
```
{urgent_emails.to_string()}
```
"""
In [ ]:
# @title  Calling the model and display the summary

response_2 = llm(system_prompt, user_prompt)

from IPython.display import display, Markdown
display(Markdown(response_2))
  1. Subject: Approval Needed: Project Scope Adjustment for Acme Corp Integration
    Received: 03/03/2025
    Sender Name: Samantha Lee
    Summary: Samantha Lee requests approval for a project scope adjustment due to an unexpected API limitation with Acme Corp's system, proposing a message queue-based approach to maintain performance without delaying the timeline.
    Next Step: Confirm approval for the proposed adjustment or schedule a discussion if further clarification is needed.

  2. Subject: [URGENT] Dashboard Syncing Issues – Production Metrics Missing
    Received: 03/03/2025
    Sender Name: David Whitmore
    Summary: David Whitmore reports that live production metrics on the Orion Analytics Dashboard are not syncing properly, causing data gaps and verification issues. He requests confirmation of the issue and a resolution within 24 hours.
    Next Step: Investigate the syncing issue and provide an update to David within the next 24 hours.

  3. Subject: Approval Request: Additional AWS Resources for Project Orion
    Received: 03/03/2025
    Sender Name: Nathan Cole
    Summary: Nathan Cole requests approval for additional AWS resources as Project Orion's usage has reached 90% capacity, proposing a 20% increase in EC2 instances to avoid performance bottlenecks.
    Next Step: Approve the additional AWS resources by March 7 to prevent service degradation.

  4. Subject: Blocking Issue Alert – Client Data Sync Failing
    Received: 03/03/2025
    Sender Name: David Kurien
    Summary: David Kurien alerts that client transaction data is failing to sync for 20% of requests, likely due to a code or infrastructure change after the last deployment. He requests an action plan ASAP.
    Next Step: Determine whether to roll back the deployment or isolate the root cause, and communicate the decision to David.

  5. Subject: URGENT: Approval Needed for 2-Week Extension on Acme Corp Deployment
    Received: 03/03/2025
    Sender Name: Tanya Patel
    Summary: Tanya Patel requests a two-week extension on the Acme Corp deployment due to missed deadlines caused by internal team conflicts, emphasizing the need for quality delivery.
    Next Step: Decide on the extension request and communicate the decision to Tanya.

  6. Subject: System Crashing During Shift Changes – URGENT
    Received: 03/03/2025
    Sender Name: David Whitmore
    Summary: David Whitmore reports that the Orion Manufacturing System is crashing during shift changes, preventing operators from logging in and causing operational delays.
    Next Step: Assign a team member to investigate the issue and join the scheduled call at 3 PM EST.

  7. Subject: ?? Security Risk – Critical Patch Delayed
    Received: 03/03/2025
    Sender Name: Bob Smith
    Summary: Bob Smith informs that a critical security patch rollout is delayed due to dependency conflicts, exposing the system to vulnerabilities. He seeks guidance on whether to push the patch or delay further.
    Next Step: Decide on the patch rollout strategy and communicate the decision to Bob.

  8. Subject: URGENT: Production Halt – Machine Control System Unresponsive
    Received: 03/03/2025
    Sender Name: David Whitmore
    Summary: David Whitmore reports a critical issue where the Orion Machine Control System is unresponsive, halting production. He requests immediate attention and a call.
    Next Step: Call David immediately to address the production halt and discuss next steps.

  9. Subject: [High Priority] Authentication Failing for Multiple Users
    Received: 03/03/2025
    Sender Name: Mark Davidson
    Summary: Mark Davidson reports an authentication issue affecting multiple engineers who cannot log in to the security monitoring platform, requesting urgent access restoration.
    Next Step: Investigate the authentication issue and provide a status update to Mark as soon as possible.

  10. Subject: Approval Needed: Purchase of Design Tool for Engineering Team
    Received: 03/03/2025
    Sender Name: Liam Ross
    Summary: Liam Ross requests approval for 20 licenses of Adobe Creative Cloud for the engineering team, citing occasional use for internal mockups and concerns about existing Figma licenses.
    Next Step: Review the request and decide whether to approve the purchase or explore cost-effective alternatives.

  11. Subject: URGENT: Approval for Security Audit Vendor – Time-Sensitive
    Received: 03/03/2025
    Sender Name: Rachel Lim
    Summary: Rachel Lim seeks urgent approval for a security audit contract with CyberShield, emphasizing the compliance requirement and the risk of delay impacting certification renewal.
    Next Step: Confirm approval for the security audit contract by March 7.

  12. Subject: URGENT: Critical System Downtime – Immediate Attention Required
    Received: 03/03/2025
    Sender Name: David Whitmore
    Summary: David Whitmore reports a major outage with the Orion Analytics Dashboard, affecting real-time production data access and causing operational delays.
    Next Step: Provide an immediate resolution or workaround by 12 PM EST and update David within the hour.

  13. Subject: Follow-Up: Server Downtime - Critical Fix Required
    Received: 03/03/2025
    Sender Name: Bob Smith
    Summary: Bob Smith follows up on unexpected server downtime impacting critical services, requesting insights on recent configuration changes to expedite the fix.
    Next Step: Review the attached logs and provide insights to Bob as soon as possible.

  14. Subject: Approval Request: Dev Environment Upgrade for Faster Builds
    Received: 03/03/2025
    Sender Name: Kevin Tran
    Summary: Kevin Tran requests approval for an upgrade to high-performance AWS instances to reduce build times in the development environment.
    Next Step: Approve the upgrade request to facilitate faster builds by March 10.

  15. Subject: URGENT: Overdue Invoice Approval for Cloud Services
    Received: 03/03/2025
    Sender Name: Sarah Mitchell
    Summary: Sarah Mitchell reports that an invoice from CloudOps Solutions is overdue, risking late fees and service disruption, and requests immediate approval.
    Next Step: Approve the overdue invoice to avoid penalties.

  16. Subject: Firewall Logs Disappeared – What’s Going On?
    Received: 03/03/2025
    Sender Name: Mark Davidson
    Summary: Mark Davidson reports missing firewall logs from February 20-24, which are critical for audit compliance, and requests urgent investigation.
    Next Step: Investigate the missing logs and provide an update to Mark.

  17. Subject: URGENT: Medication Alerts Not Firing – This is Dangerous
    Received: 03/03/2025
    Sender Name: Rachel Thompson
    Summary: Rachel Thompson alerts that automated medication alerts for ICU patients are not firing, posing a patient safety risk, and requests immediate action.
    Next Step: Join the emergency call in 30 minutes to address the issue.

  18. Subject: Approval Request: Travel Budget for AWS Summit 2025
    Received: 03/03/2025
    Sender Name: Olivia Chen
    Summary: Olivia Chen requests approval for travel expenses for two team members to attend the AWS Summit 2025, highlighting the potential ROI from the training.
    Next Step: Review and approve the travel budget request.

  19. Subject: Urgent: Performance Degradation in Production System
    Received: 03/03/2025
    Sender Name: Nathan Ellis
    Summary: Nathan Ellis reports critical performance degradation in the production system, affecting client-side API calls, and requests emergency scale-up of the database instance.
    Next Step: Approve the emergency scale-up and decide on client communication regarding the issue.

Sample Output Example

A list of urgent emails with detailed summaries and next steps.

image.png

1C: Deadline-Driven Emails from Yesterday (⚡ Needs Attention Today)¶

Note: Follow the instructions carefully and complete the missing sections.

image.png

Deadline-Driven Emails (Needs to be Addressed Today)

Examples

  • Subject: Q2 Revenue Strategy - Immediate Action Required

    From: George Harris (Director of Strategy)

    Summary: Leadership expects a finalized strategy document by EOD to align with upcoming board discussions.

  • Subject: Client Presentation Review - Feedback Needed

    From: George Harris (Senior Sales Executive)

    Summary: Feedback is required on a key client pitch deck before the presentation scheduled for tomorrow.

  • Subject: Employee Engagement Survey Reminder

    From: Charlie Davis (HR Manager)

    Summary: Employees must complete the engagement survey before the end of the day to finalize workplace improvement initiatives.

TASK¶

Write the system_prompt and user_prompt that will guide the AI model to summarize and generate an appropriate next step for time-sensitive and deadline-driven emails. The response should include the following information:

  • Subject: (The email's subject line)
  • Received: (The time and date the email was received)
  • Sender Name: (Name of the person who sent the email)
  • Summary: (A concise summary of the email's content)
  • Next Step: (A specific action that needs to be taken based on the email, with a clear focus on meeting deadlines)

Each email must explicitly mention a specific deadline for today or require action to meet an impending delivery timeline.

The final count of Deadline-Driven emails with summary

Question: Construct the user_prompt to pass the filtered dataset and request deadline-driven emails with next steps.

Ensure that:

  • These emails are separate from the Urgent & High-Priority Emails already covered.
  • Exclude any emails already categorized under Urgent & High-Priority.
  • Each email must mention a specific deadline for today or require action to meet a delivery timeline.
  • The final count of Deadline-Driven emails + Urgent & High-Priority emails should equal the Critical Emails count in the Executive Summary.
In [ ]:
# @title System Prompt

# Write your system prompt here
system_prompt = """

You are an AI-powered Executive Email Assistant. Your role is to analyze the time-sensitive and deadline-driven emails
that were received yesterday and must be addressed today.

Guidelines to follow:
1. Each email must clearly involve a deadline occurring today or an impending delivery timeline.
2. For each email, generate a concise summary and a specific next step focused on meeting the deadline.
3. Do not include emails categorized as Urgent & High-Priority.
4. Do not invent deadlines or details not present in the email content.
5. Use a professional, executive tone.
6. Follow the exact output format requested by the user.

"""
In [ ]:
# Filtering out the emails that are Time Sensitive & Deadline-Driven
deadline_emails = yesterday_emails[yesterday_emails['category'] == 'Deadline-Driven Emails']
In [ ]:
# @title User Prompt


# Write your user prompt here
user_prompt = f"""

You are given a set of time sensitive and deadline-driven emails that were received yesterday
and must be addressed today.

Your task is to summarize only the deadline-driven emails and clearly outline
the required actions to meet deadlines.

Instructions to folloe:
1. The response should have the exact structure and headings shown below.
2. Do not include Urgent & High-Priority emails.
3. Each email must clearly involve a deadline that is today, overdue, or tied to an imminent meeting or delivery timeline.
4. Do not invent deadlines.
5. Do not add extra explanations outside the requested sections.

Required Output Format:
Subject: (The email's subject line)
Received: (The time and date the email was received)
Sender Name: (Name of the person who sent the email)
Summary: (A concise summary of the email's content)
Next Step: (A specific action that needs to be taken based on the email, with a clear focus on meeting deadlines)

Example Output:
Deadline-Driven Emails Summary

1. Email Exceeding Deadline (if applicable)
   - Subject:
   - Received:
   - Sender Name:
   - Summary:
   - Next Step:

2. Email Requiring Action Today
   - Subject:
   - Received:
   - Sender Name:
   - Summary:
   - Next Step:

(Repeat section 2 for each remaining deadline-driven email)

Final Count of Deadline-Driven Emails
 - Total Deadline-Driven Emails: <number> (mention if any have exceeded their deadline)

Summary of Actionable Items
 - List concise action items required today to meet deadlines.


Below is the attached DataFrame, which contains all the emails that needs to be summarized:
```
{deadline_emails.to_string()}
```
"""
In [ ]:
# @title  Calling the model and display the summary

response_3 = llm(system_prompt, user_prompt)

from IPython.display import display, Markdown
display(Markdown(response_3))

Deadline-Driven Emails Summary

  1. Email Exceeding Deadline

    • Subject: Pending Approval – Invoice Dispute (Microsoft Teams)
    • Received: 03/03/2025
    • Sender Name: Alice Johnson
    • Summary: This email discusses an unresolved invoice approval that has been pending for 14 days, with a meeting scheduled to address the issue.
    • Next Step: Attend the Microsoft Teams meeting today at 4:00 PM EST to resolve the invoice dispute.
  2. Email Requiring Action Today

    • Subject: Approval Request: Budget Approval Needed by EOD
    • Received: 03/03/2025
    • Sender Name: Julia Martin
    • Summary: Julia requests budget approval by the end of today to ensure the smooth execution of next quarter's projects.
    • Next Step: Review the attached budget breakdown and provide approval by the end of the day.

Final Count of Deadline-Driven Emails

  • Total Deadline-Driven Emails: 2 (1 has exceeded its deadline)

Summary of Actionable Items

  • Attend the Microsoft Teams meeting at 4:00 PM EST to resolve the invoice dispute.
  • Review and approve the budget breakdown by the end of the day.

Sample Output Example

A list of deadline-driven emails with summaries and next steps.

image.png

Task 2: AI-Generated "First Response" Drafts for Critical Email¶

Note: Follow the instructions carefully and complete the missing sections.

Critical Emails are combination of the Urgent & High-Priority Emails + Deadline-Driven Emails¶

Objective: Generate AI-drafted responses for critical emails received yesterday.

ChatGPT Image Apr 4, 2025, 06_55_53 PM.png

TASK¶

Write the system_prompt & user_prompt that will guide the AI model to generate a professional "First Response Draft" for the High Priority Emails.

The response should include:

  • Acknowledge the sender’s request and contextually relevant.
  • Address the key points, queries, or actions requested in the original email.
  • Provide a clear next step or decision.
  • Maintain a polite, formal, and professional tone, aligned with corporate communication standards.

The format of the Draft should have:

  • Subject: (Subject of the email)
  • Sender Name: (Name of the Sender)
  • AI Drafted Reply: (Your AI-generated response)
In [ ]:
# @title System Prompt
# Write your system prompt here
system_prompt = """

You are an AI-powered Executive Email Assistant. Your role is to draft a professional first response for critical business emails
(Urgent & High-Priority + Deadline-Driven) received yesterday.

Guidelines:
1. Acknowledge the sender’s request clearly and politely.
2. Address the key points, queries, or actions raised in the original email.
3. State a clear next step or decision.
4. Maintain a formal, professional corporate tone.
5. Do not introduce new commitments beyond what is implied in the email.
6. Follow the exact output format requested by the user.

"""
In [ ]:
# Filtering out the emails that are Critical Emails, i.e. ('Urgent & High-Priority Emails' + 'Deadline-Driven Emails')
critical_emails = yesterday_emails[yesterday_emails['category'].isin(['Urgent & High-Priority Emails', 'Deadline-Driven Emails'])]
In [ ]:
# @title User Prompt

# You may format the classifying method according to you


# Write your user prompt here
user_prompt = f"""

You are given a list of critical emails (cateogories - Urgent & High-Priority and Deadline-Driven)
that were received yesterday and require an initial response today.

Your task is to:
1. Draft a professional first-response email for each provided email.
2. The response should acknowledge the sender, address their request, and state the next step.
3. Keep responses concise, polite, and professional in tone.

Output format required (repeat for each email):

Subject: (Subject of the email)
Sender Name: (Name of the Sender)
AI Drafted Reply: (Your AI-generated response)

Important:
1. Do not add numbering, bullet points, or section headers.
2. Do not include explanations or commentary outside the draft.
3. Each draft should read like a real email reply.
4. Address each sender in the body of the email
5. Sign off each email with the sender name: Alex.

Below is the attached DataFrame, which contains all the critical emails that needs to be replied:
```
{critical_emails.to_string()}
```
"""
In [ ]:
# @title  Calling the model and display the summary

response_4 = llm(system_prompt, user_prompt)
from IPython.display import display, Markdown
display(Markdown(response_4))

Subject: Approval Request: Budget Approval Needed by EOD
Sender Name: Julia Martin
AI Drafted Reply: Dear Julia,
Thank you for your email regarding the budget approval. I appreciate your promptness in bringing this to my attention. I will review the attached budget breakdown and provide my approval by the end of today to ensure we stay on track for next quarter's projects.
Best regards,
Alex

Subject: Approval Needed: Project Scope Adjustment for Acme Corp Integration
Sender Name: Samantha Lee
AI Drafted Reply: Dear Samantha,
Thank you for outlining the proposed adjustment to the project scope for Acme Corp's integration. I understand the necessity of this change and the impact on our timeline. Please proceed with the implementation of the message queue-based approach as discussed.
Best regards,
Alex

Subject: [URGENT] Dashboard Syncing Issues – Production Metrics Missing
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
I appreciate your prompt notification regarding the dashboard syncing issues. I will have my team investigate the discrepancies immediately and provide you with an update within the next 24 hours. Thank you for your patience as we work to resolve this matter.
Best regards,
Alex

Subject: Approval Request: Additional AWS Resources for Project Orion
Sender Name: Nathan Cole
AI Drafted Reply: Dear Nathan,
Thank you for your request regarding additional AWS resources for Project Orion. I understand the urgency of this matter and will review the proposed increase in capacity. I will provide my approval by March 7 to ensure we avoid any service degradation.
Best regards,
Alex

Subject: Blocking Issue Alert – Client Data Sync Failing
Sender Name: David Kurien
AI Drafted Reply: Dear David,
Thank you for bringing this critical issue to my attention. I recommend that we schedule a war room call to discuss the next steps and determine whether to roll back or isolate the root cause. Please let me know your availability.
Best regards,
Alex

Subject: URGENT: Approval Needed for 2-Week Extension on Acme Corp Deployment
Sender Name: Tanya Patel
AI Drafted Reply: Dear Tanya,
Thank you for your email regarding the extension for the Acme Corp deployment. I understand the situation and the need for additional time to ensure quality delivery. I will review this request and provide my decision shortly.
Best regards,
Alex

Subject: System Crashing During Shift Changes – URGENT
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
I appreciate your urgent notification regarding the system crashes during shift changes. I will have my team investigate this issue immediately. I look forward to our call at 3 PM EST to discuss further.
Best regards,
Alex

Subject: ?? Security Risk – Critical Patch Delayed
Sender Name: Bob Smith
AI Drafted Reply: Dear Bob,
Thank you for informing me about the delay in the security patch rollout. I understand the risks involved and will discuss with the team to determine the best course of action. I will get back to you shortly with our decision.
Best regards,
Alex

Subject: URGENT: Production Halt – Machine Control System Unresponsive
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
Thank you for your urgent message regarding the unresponsive Machine Control System. I will have my team address this issue immediately. I will reach out shortly with an update.
Best regards,
Alex

Subject: EBR Meeting Invite – Sentinel Cyber Inc. (Microsoft Teams)
Sender Name: Lisa Taylor
AI Drafted Reply: Dear Lisa,
Thank you for the meeting invite regarding the EBR with Sentinel Cyber Inc. I have noted the details and will ensure my attendance. Looking forward to our discussion on the agenda items.
Best regards,
Alex

Subject: [High Priority] Authentication Failing for Multiple Users
Sender Name: Mark Davidson
AI Drafted Reply: Dear Mark,
Thank you for bringing the authentication issue to my attention. I will investigate this matter immediately and ensure that access is restored as soon as possible. I will keep you updated on our progress.
Best regards,
Alex

Subject: URGENT: Approval for Security Audit Vendor – Time-Sensitive
Sender Name: Rachel Lim
AI Drafted Reply: Dear Rachel,
Thank you for your email regarding the security audit contract with CyberShield. I understand the urgency and will provide my approval by March 7 to ensure compliance certification renewal is not impacted.
Best regards,
Alex

Subject: URGENT: Critical System Downtime – Immediate Attention Required
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
Thank you for your urgent notification regarding the critical system downtime. I will have my team investigate this issue immediately and will provide you with a status update as soon as possible.
Best regards,
Alex

Subject: Follow-Up: Server Downtime - Critical Fix Required
Sender Name: Bob Smith
AI Drafted Reply: Dear Bob,
Thank you for your follow-up regarding the server downtime. I will review the attached logs and provide any insights that may expedite the fix. I appreciate your patience as we work through this issue.
Best regards,
Alex

Subject: Escalation – Valve Healthcare (Zoom)
Sender Name: Julia Martin
AI Drafted Reply: Dear Julia,
Thank you for the escalation regarding the ERP system downtime affecting production. I have noted the meeting details and will ensure my attendance. Looking forward to resolving this issue collaboratively.
Best regards,
Alex

Subject: Approval Request: Dev Environment Upgrade for Faster Builds
Sender Name: Kevin Tran
AI Drafted Reply: Dear Kevin,
Thank you for your request regarding the upgrade of the development environment. I understand the need for improved build times and will review the proposal for approval by March 10.
Best regards,
Alex

Subject: URGENT: Overdue Invoice Approval for Cloud Services
Sender Name: Sarah Mitchell
AI Drafted Reply: Dear Sarah,
Thank you for your email regarding the overdue invoice from CloudOps Solutions. I will prioritize this approval to avoid any penalties and ensure continuity of service.
Best regards,
Alex

Subject: Firewall Logs Disappeared – What’s Going On?
Sender Name: Mark Davidson
AI Drafted Reply: Dear Mark,
Thank you for bringing the missing firewall logs to my attention. I will investigate whether this is a storage issue or data corruption and will update you as soon as I have more information.
Best regards,
Alex

Subject: URGENT: Medication Alerts Not Firing – This is Dangerous
Sender Name: Rachel Thompson
AI Drafted Reply: Dear Rachel,
Thank you for your urgent message regarding the medication alerts. I will prioritize this issue and join the emergency call shortly to discuss the necessary actions.
Best regards,
Alex

Subject: Approval Request: Travel Budget for AWS Summit 2025
Sender Name: Olivia Chen
AI Drafted Reply: Dear Olivia,
Thank you for your request regarding the travel budget for the AWS Summit 2025. I will review the estimated costs and provide my approval shortly.
Best regards,
Alex

Subject: Pending Approval – Invoice Dispute (Microsoft Teams)
Sender Name: Alice Johnson
AI Drafted Reply: Dear Alice,
Thank you for the meeting invite regarding the invoice approval discussion. I have noted the details and will ensure my attendance. Looking forward to resolving this matter.
Best regards,
Alex

Subject: Urgent: Performance Degradation in Production System
Sender Name: Nathan Ellis
AI Drafted Reply: Dear Nathan,
Thank you for your urgent notification regarding the performance degradation in the production system. I will review the situation and provide guidance on the emergency scale-up and client communication shortly.
Best regards,
Alex

Sample Output Example

A list of AI-drafted resoponses for the critical emails received yesterday with detailed summaries and next steps.

image.png

Task 3: Evaluation¶

Note: Follow the instructions carefully and complete the missing sections.

image.png

Evaluation of Prompt Outputs with LLM-as-a-Judge¶

1. Introduction

Evaluating the quality of prompts using LLM-as-a-Judge involves leveraging a more advanced Language Model (LLM) to assess the quality, correctness, and effectiveness of responses generated by another LLM or the same model. This method provides automated, consistent, and scalable qualitative and quantitative evaluations.

The evaluation process will:

  • Use LLM-as-a-Judge to rate prompt outputs on predefined criteria.

  • Automate scoring and feedback generation.

  • Provide insights for prompt refinement.

Large Language Models (LLMs) can be used not only to generate content but also to evaluate the quality of generated responses.

2. Evaluation Criteria¶

We will evaluate the prompt outputs based on the following key dimensions:

Rate the given summary on a scale of 1 to 5 for the following criteria:

  • Relevance: How well does the summary address the input query or task? Identify the key information that is captured or missed. Provide a score from 1 to 5 along with Justification
  • Clarity: How clear and understandable is the summary? Highlight any confusing or ambiguous phrases. Provide a score from 1 to 5 along with Justification
  • Actionability: Does the summary provide clear next steps or actionable information? Provide a score from 1 to 5 along with Justification

Additionally, the LLM will be asked to provide insights in the following areas:

  • Strengths: Highlight the key strengths of the summary.
  • Improvements: Suggest 1-2 areas for improvement.
  • Overall Justification: Provide a 2-3 line summary evaluation, including key observations.

TASK¶

Your task is to write the system_prompt & user_prompt for the above mentioned 6 criteria also note to extarct the response strictly in JSON format

Eg.Provide your evaluation strictly in JSON format:

{
  "Relevance": {"score": "", "justification": ""},
  "Clarity": {"score": "", "justification": ""},
  "Actionability": {"score": "", "justification": ""},
  "Strengths": "",
  "Improvements": "",
  "Overall_Justification": ""
}

In [ ]:
# @title Evaluation System Prompt

eval_system_prompt = """

You are an impartial LLM-as-a-Judge. You need to assess the quality,correctness,and effectiveness of responses generated by another LLM.
Your role is to evaluate AI-generated email summaries and responses based on predefined qualitative criteria.

The objective is to:+
1. Assess the provided email summary.
2. Assign numeric scores from 1 to 5 on criteria such as relevance, clarity and actionability.
3. Provide concise justifications for each score.
4. Highlight the key strengths of the summaries and suggest areas for improvement.
5. Output the evaluation in a valid JSON format as mentioned by the user.
6. Provide a overall justification for the evaluation and mention key observations.

Guidelines:
1. Do not include or generate any text outside the JSON object.
2. Do not include markdown, explanations, or headings.

"""
In [ ]:
# @title Evaluation User Prompt

eval_user_prompt = """

  Evaluate the following AI-generated summary using the criteria below.

  Evaluation Criteria:
  1. Relevance:
    -How well does the summary address the original task or content of the email?
    -Identify the key information that is captured or missing.
    -Provide a score from 1 to 5 with justification.

  2. Clarity:
    -How clear and easy to understand is the summary?
    -Highlight any ambiguity or confusing phrasing.
    -Provide a score from 1 to 5 with justification.

  3. Actionability:
    -Does the summary clearly specify next steps or actions?
    -Are the actions practical and next steps well-defined?
    -Provide a score from 1 to 5 with justification.

  Additionally, provide:
  -Strengths: Highlight the key strengths of the summary.
  -Improvements: Suggest 1-2 areas for improvement.
  -Overall Justification: Provide a 2-3 line summary evaluation, including key observations.

  Output Requirements:
  - Respond only in valid JSON.
  - Separate each drafted response using the delimiter: ---------
  - Use the following structure and keys:

  {
    "Relevance": {"score": "", "justification": ""},
    "Clarity": {"score": "", "justification": ""},
    "Actionability": {"score": "", "justification": ""},
    "Strengths": "",
    "Improvements": "",
    "Overall_Justification": ""
  }

"""
In [ ]:
# @title Evaluation Function & User Prompt

def evaluate_summary(eval_system_prompt, eval_user_prompt, summary, eval_model="gpt-4o-mini"):
    try:

        modified_prompt = f""" {eval_user_prompt}
                          Here is the summary:
                          ```
                          {summary}
                          ```
                          """

        eval_response = client.chat.completions.create(
            model=eval_model,
            messages=[
                {"role": "system", "content": eval_system_prompt},
                {"role": "user", "content": modified_prompt}
            ],
            temperature=0
        )
        return eval_response.choices[0].message.content.strip()

    except Exception as e:
        print(f"Error evaluating prompt: {e}")
        return "{}"  # Return empty JSON structure on error
In [ ]:
responses = response_4.split("Subject:")            # splitting response on the basis of delimiter, so we get each response for the email indivisually
for _ in responses[1:-1]:                      # Excluding First and Last Element as they are nothing but blanks .i.e. (' ')
  display(Markdown(_))
  print("+"*100)

Approval Request: Budget Approval Needed by EOD
Sender Name: Julia Martin
AI Drafted Reply: Dear Julia,
Thank you for your email regarding the budget approval. I appreciate your promptness in bringing this to my attention. I will review the attached budget breakdown and provide my approval by the end of today to ensure we stay on track for next quarter's projects.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Approval Needed: Project Scope Adjustment for Acme Corp Integration
Sender Name: Samantha Lee
AI Drafted Reply: Dear Samantha,
Thank you for outlining the proposed adjustment to the project scope for Acme Corp's integration. I understand the necessity of this change and the impact on our timeline. Please proceed with the implementation of the message queue-based approach as discussed.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[URGENT] Dashboard Syncing Issues – Production Metrics Missing
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
I appreciate your prompt notification regarding the dashboard syncing issues. I will have my team investigate the discrepancies immediately and provide you with an update within the next 24 hours. Thank you for your patience as we work to resolve this matter.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Approval Request: Additional AWS Resources for Project Orion
Sender Name: Nathan Cole
AI Drafted Reply: Dear Nathan,
Thank you for your request regarding additional AWS resources for Project Orion. I understand the urgency of this matter and will review the proposed increase in capacity. I will provide my approval by March 7 to ensure we avoid any service degradation.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Blocking Issue Alert – Client Data Sync Failing
Sender Name: David Kurien
AI Drafted Reply: Dear David,
Thank you for bringing this critical issue to my attention. I recommend that we schedule a war room call to discuss the next steps and determine whether to roll back or isolate the root cause. Please let me know your availability.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

URGENT: Approval Needed for 2-Week Extension on Acme Corp Deployment
Sender Name: Tanya Patel
AI Drafted Reply: Dear Tanya,
Thank you for your email regarding the extension for the Acme Corp deployment. I understand the situation and the need for additional time to ensure quality delivery. I will review this request and provide my decision shortly.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

System Crashing During Shift Changes – URGENT
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
I appreciate your urgent notification regarding the system crashes during shift changes. I will have my team investigate this issue immediately. I look forward to our call at 3 PM EST to discuss further.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

?? Security Risk – Critical Patch Delayed
Sender Name: Bob Smith
AI Drafted Reply: Dear Bob,
Thank you for informing me about the delay in the security patch rollout. I understand the risks involved and will discuss with the team to determine the best course of action. I will get back to you shortly with our decision.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

URGENT: Production Halt – Machine Control System Unresponsive
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
Thank you for your urgent message regarding the unresponsive Machine Control System. I will have my team address this issue immediately. I will reach out shortly with an update.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

EBR Meeting Invite – Sentinel Cyber Inc. (Microsoft Teams)
Sender Name: Lisa Taylor
AI Drafted Reply: Dear Lisa,
Thank you for the meeting invite regarding the EBR with Sentinel Cyber Inc. I have noted the details and will ensure my attendance. Looking forward to our discussion on the agenda items.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[High Priority] Authentication Failing for Multiple Users
Sender Name: Mark Davidson
AI Drafted Reply: Dear Mark,
Thank you for bringing the authentication issue to my attention. I will investigate this matter immediately and ensure that access is restored as soon as possible. I will keep you updated on our progress.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

URGENT: Approval for Security Audit Vendor – Time-Sensitive
Sender Name: Rachel Lim
AI Drafted Reply: Dear Rachel,
Thank you for your email regarding the security audit contract with CyberShield. I understand the urgency and will provide my approval by March 7 to ensure compliance certification renewal is not impacted.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

URGENT: Critical System Downtime – Immediate Attention Required
Sender Name: David Whitmore
AI Drafted Reply: Dear David,
Thank you for your urgent notification regarding the critical system downtime. I will have my team investigate this issue immediately and will provide you with a status update as soon as possible.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Follow-Up: Server Downtime - Critical Fix Required
Sender Name: Bob Smith
AI Drafted Reply: Dear Bob,
Thank you for your follow-up regarding the server downtime. I will review the attached logs and provide any insights that may expedite the fix. I appreciate your patience as we work through this issue.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Escalation – Valve Healthcare (Zoom)
Sender Name: Julia Martin
AI Drafted Reply: Dear Julia,
Thank you for the escalation regarding the ERP system downtime affecting production. I have noted the meeting details and will ensure my attendance. Looking forward to resolving this issue collaboratively.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Approval Request: Dev Environment Upgrade for Faster Builds
Sender Name: Kevin Tran
AI Drafted Reply: Dear Kevin,
Thank you for your request regarding the upgrade of the development environment. I understand the need for improved build times and will review the proposal for approval by March 10.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

URGENT: Overdue Invoice Approval for Cloud Services
Sender Name: Sarah Mitchell
AI Drafted Reply: Dear Sarah,
Thank you for your email regarding the overdue invoice from CloudOps Solutions. I will prioritize this approval to avoid any penalties and ensure continuity of service.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Firewall Logs Disappeared – What’s Going On?
Sender Name: Mark Davidson
AI Drafted Reply: Dear Mark,
Thank you for bringing the missing firewall logs to my attention. I will investigate whether this is a storage issue or data corruption and will update you as soon as I have more information.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

URGENT: Medication Alerts Not Firing – This is Dangerous
Sender Name: Rachel Thompson
AI Drafted Reply: Dear Rachel,
Thank you for your urgent message regarding the medication alerts. I will prioritize this issue and join the emergency call shortly to discuss the necessary actions.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Approval Request: Travel Budget for AWS Summit 2025
Sender Name: Olivia Chen
AI Drafted Reply: Dear Olivia,
Thank you for your request regarding the travel budget for the AWS Summit 2025. I will review the estimated costs and provide my approval shortly.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Pending Approval – Invoice Dispute (Microsoft Teams)
Sender Name: Alice Johnson
AI Drafted Reply: Dear Alice,
Thank you for the meeting invite regarding the invoice approval discussion. I have noted the details and will ensure my attendance. Looking forward to resolving this matter.
Best regards,
Alex

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In [ ]:
print(response_4)
In [ ]:
# @title Evaluation for Each Generated Response
evaluation_results = [evaluate_summary(eval_system_prompt, eval_user_prompt, summary) for summary in responses[1:-1]]        # Excluding first and last elements as they are not the actual emails and some LLM generated support texts
In [ ]:
display(Markdown(evaluation_results[0]))

{ "Relevance": { "score": 5, "justification": "The summary effectively captures the main purpose of the email, which is the request for budget approval. It includes the sender's name and the urgency of the request, addressing the key information needed." }, "Clarity": { "score": 4, "justification": "The summary is mostly clear and easy to understand. However, the phrase 'to ensure we stay on track for next quarter's projects' could be slightly ambiguous regarding what specific projects are being referred to." }, "Actionability": { "score": 5, "justification": "The summary clearly specifies the next steps, indicating that the recipient will review the budget and provide approval by the end of the day, making the actions well-defined and practical." }, "Strengths": "The summary is concise and directly addresses the key points of the original email, including the urgency and the commitment to action.", "Improvements": "Clarify the reference to 'next quarter's projects' to avoid ambiguity and ensure all parties understand which projects are being discussed.", "Overall_Justification": "The summary is effective in conveying the essential information and next steps regarding the budget approval request. It is relevant and actionable, with minor clarity issues that could be improved." }

In [ ]:
# @title Converting JSON Scores into DataFrame
import pandas as pd
import json

scores = []
justifications = []
strengths = []
improvements = []


for result in evaluation_results:
    try:
        result_dict = json.loads(result)
        score_dict = {k: v.get("score", "NA") for k, v in result_dict.items() if isinstance(v, dict) and "score" in v}
        justification = result_dict.get("Overall_Justification", "NA")
        strength = result_dict.get("Strengths", "NA")
        improvement = result_dict.get("Improvements", "NA")

        # Append Results
        scores.append(score_dict)
        justifications.append(justification)
        strengths.append(strength)
        improvements.append(improvement)

    except (json.JSONDecodeError, KeyError, TypeError):
        scores.append({"Relevance": None, "Clarity": None, "Conciseness": None, "Coherence": None, "Actionability": None})
        justifications.append("")
        strengths.append("")
        improvements.append("")
In [ ]:
# @title Creating Final Evaluation DataFrame
pd.set_option('max_colwidth', 0)
df_scores = pd.DataFrame(scores)
df_scores["Strengths"] = strengths
df_scores["Improvements"] = improvements
df_scores["Justification"] = justifications
In [ ]:
# @title Display Final Evaluation Table
df_scores
Out[ ]:
Relevance Clarity Actionability Strengths Improvements Justification
0 5 4 5 The summary is concise and directly addresses the key points of the original email, including the urgency and the commitment to action. Clarify the reference to 'next quarter's projects' to avoid ambiguity and ensure all parties understand which projects are being discussed. The summary is effective in conveying the essential information and next steps regarding the budget approval request. It is relevant and actionable, with minor clarity issues that could be improved.
1 4 5 4 The summary effectively conveys the approval needed and the specific action to be taken, maintaining a professional tone throughout. It could include more context regarding the reasons for the project scope adjustment and provide a clearer timeline for the implementation steps. Overall, the summary is relevant, clear, and actionable, though it could enhance its effectiveness by providing additional context and detailed next steps.
2 4 5 4 The summary is clear and concise, effectively acknowledging the issue and committing to a timely response. Include more specific details about the discrepancies and suggest any immediate actions for the sender, if relevant. The summary effectively addresses the issue and is clear in its communication. However, it could enhance relevance and actionability by providing more details and immediate next steps.
3 4 5 4 The summary effectively conveys the urgency of the request and the timeline for approval, maintaining a professional tone throughout. It could include more specific details about the resources being requested and clarify any actions Nathan needs to take following the approval. The summary is generally effective, with strong clarity and relevance. However, it could benefit from additional details to enhance actionability and provide a more comprehensive overview.
4 4 5 4 The summary effectively captures the urgency of the issue and proposes a clear next step, maintaining a professional tone. 1. Include more context about the implications of the data sync failure. 2. Suggest a timeframe for the proposed call to enhance actionability. The summary is relevant and clear, effectively addressing the issue at hand. However, it could benefit from additional context and more defined next steps.
5 4 5 3 The summary effectively conveys the urgency of the request and acknowledges the need for additional time, demonstrating understanding and professionalism. The summary could include specific reasons for the extension request and a clearer timeline for when the decision will be communicated. The summary is relevant and clear, but it falls short in providing actionable next steps. Including more details about the request and a timeline would enhance its effectiveness.
6 4 5 4 The summary effectively acknowledges the urgency of the issue and maintains a professional tone. It also sets a clear expectation for a follow-up discussion. The summary could benefit from including more specific details about the investigation process and any immediate actions being taken. Additionally, mentioning the expected timeline for updates would enhance clarity. Overall, the summary is relevant and clear, with a good acknowledgment of the issue. However, it could improve in actionability by providing more specific next steps and details about the investigation.
7 4 5 3 The summary effectively acknowledges the issue and expresses a commitment to follow up, demonstrating responsiveness. It could benefit from including specific implications of the delay and a clearer timeline for the next steps. The summary is relevant and clear, but it falls short in providing actionable next steps. Overall, it effectively communicates the situation but could enhance its effectiveness with more detail.
8 5 4 4 The summary effectively conveys the urgency of the situation and the commitment to address the issue promptly. Clarify the expected timeframe for the update and specify any immediate actions being taken by the team. The summary is relevant and conveys urgency well, but it could improve in clarity and actionability by providing more specific details about next steps.
9 4 5 4 The summary effectively conveys gratitude for the meeting invite and confirms attendance, demonstrating professionalism and engagement. Including specific agenda items or topics for discussion would enhance relevance. Additionally, suggesting any preparatory actions could improve actionability. The summary is generally effective, with strong clarity and relevance. However, it could benefit from more detailed content regarding the meeting agenda and actionable steps.
10 4 5 4 The summary is clear and acknowledges the issue promptly, demonstrating a proactive approach to resolving the problem. Include more specific details about the authentication issue and outline a timeline or specific next steps for resolution. The summary effectively addresses the issue and is clear in its communication. However, it could benefit from additional details and a more defined action plan.
11 4 5 4 The summary effectively conveys urgency and clarity in the response, ensuring that the recipient understands the commitment to act promptly. 1. Include more context about the implications of the approval. 2. Mention any additional actions required from the sender or other stakeholders. The summary is strong in clarity and relevance but could enhance its actionability by providing more context and detailing further steps. Overall, it effectively communicates the urgency of the situation.
12 5 4 4 The summary effectively conveys the urgency of the situation and the commitment to address the issue promptly. 1. Clarify the timeline for the investigation and status update. 2. Specify any immediate actions that the recipient should take, if applicable. The summary is relevant and conveys urgency well, but it could improve in clarity and actionability by providing more specific details about next steps.
13 4 5 3 The summary is clear and acknowledges the sender's concerns, maintaining a professional tone. Include more specific details about the server issue and outline clear next steps or a timeline for resolution. The summary effectively addresses the follow-up on server downtime with clarity but lacks some details and actionable next steps that would enhance its effectiveness.
14 4 5 4 The summary effectively captures the main issue and expresses a willingness to collaborate, demonstrating a positive tone. It could benefit from including more specific details about the meeting agenda and outlining any preparatory actions that Alex might take before the meeting. The summary is generally effective, with strong clarity and relevance. However, enhancing the actionability by specifying next steps would improve its overall effectiveness.
15 4 5 4 The summary effectively communicates the main points of the email and maintains a professional tone. 1. Include more details about the expected benefits of the upgrade. 2. Specify any actions required from the sender or other parties involved in the approval process. The summary is relevant and clear, effectively conveying the request and next steps. However, it could benefit from additional details and clearer action items to enhance its effectiveness.
16 4 5 4 The summary effectively captures the urgency of the situation and provides a clear response from Alex, demonstrating a commitment to resolving the issue. The summary could include specific details about the invoice and outline a timeline for the approval process to enhance clarity and actionability. The summary is relevant and clear, effectively conveying the urgency of the overdue invoice. However, it could benefit from additional details and a clearer outline of next steps.
17 4 5 4 The summary effectively acknowledges the issue and expresses a commitment to investigate, demonstrating responsiveness and professionalism. 1. Include more context about the importance of the firewall logs. 2. Specify a timeline for when the sender can expect further updates. The summary is relevant, clear, and actionable, but it could benefit from additional context and a clearer timeline for follow-up. Overall, it effectively addresses the sender's concern.
18 4 5 4 The summary effectively conveys urgency and clarity in the response, ensuring the recipient understands the importance of the issue. The summary could benefit from including more specific details about the medication alerts and outlining the expected outcomes of the emergency call. The summary is relevant and clear, effectively addressing the urgency of the situation. However, it could be improved by providing more specific information and clearer next steps.
19 4 5 4 The summary effectively conveys the main points of the email and maintains a professional tone. 1. Include specific details about the budget or context of the AWS Summit 2025. 2. Specify a timeline for when the approval will be provided. The summary is relevant and clear, effectively communicating the request and response. However, it could be improved by adding more context and a timeline for action.
20 4 5 3 The summary is clear and concise, effectively acknowledging the meeting invite and expressing a willingness to resolve the issue. Include more specific details about the invoice dispute to enhance relevance and suggest concrete next steps or actions to improve actionability. The summary is generally effective, with strong clarity and relevance, but it could benefit from additional details and actionable steps to enhance its overall utility.

Sample Output Example

Scores and explanation for the response_4 which is the AI generated responses.

image.png

Task 4: Summary and Recommendation¶

Note: Follow the instructions carefully and complete the missing sections.

In this task, you will write a Summary and Recommendation for the generated customer review response based on your understanding.

Instructions:

In this section, summarize the overall performance of the generated email summary across all tasks.

1. Summary of Observations:

  • Briefly describe how the AI Email Secretary performed in summarizing emails.
  • Highlight any patterns observed in the summaries (e.g., accuracy, level of detail, or any common errors).

2. Evaluation Highlights:

  • Mention how the generated summaries performed on key dimensions:
    • Relevance: Did the summary capture the important points of the email?
    • Clarity: Was the summary easy to understand?
    • Actionability: Did the summary convey any next steps or actions required?

3. Strengths:

  • List 2-3 strengths of the generated summaries (e.g., good at capturing action points, concise representation).

4. Improvement Areas:

  • Suggest 1-2 areas where the AI Email Secretary can improve (e.g., missing certain details, inconsistent language).

5. Final Recommendation:

  • Conclude with a recommendation on whether the current performance meets user needs or if further improvements are needed.

<Enter your summary here>

  1. Summary of Observations

The AI Email Secretary showed good overall performance in summarizing emails and generating first draft responses. It classified emails into appropriate categories, produced concise summaries for urgent and deadline-driven emails, and generated professional first-response drafts. The model was able to prioritize critical information (urgency, deadlines, sender intent) and also avoided unnecessary details. Minor inconsistencies were observed in the category distribution and in following the required output guidelines.

  1. Evaluation Highlights

Relevance: The generated summaries captured the key points of the email and highlighted important information like timelines, percentages, detailing specific requests etc. Critical emails were accurately identified and the information of the task and urgency level was properly mentioned.

Clarity: The summaries were to the point, conveyed relevant information clearly and the language and tone was professional as requested. The consistent formatting (Subject, Summary, Next Step) improved readability and quick scanning, however the formatting was a little off for task 1B and there was an extra new line after the number for each email.

Actionability: The summaries clearly conveyed next steps or required actions and suggested actions in a way that made sense, especially for Urgent & High-Priority and Deadline-Driven category emails. This made it easier to translate summaries into actionable to-do items for the day.

  1. Strengths

The strengths of this AI Assisant are that it highlights action items and deadlines in critical emails and produces accurate next steps. The summaries help to reduce work load by bringing relevant information to the users attention effectively. The first draft response feature is very helpful as it drafts emails quickly with correct information and maintains the requested professional tone.

  1. Improvement Areas

The division of emails into particular categories couild be improved. The model in some cases pushed social emails into spam and categorized all non work related emails to spam. It also struggled to maintain the requested output format in some cases.

  1. Final Recommendation

Overall, the current performance of the AI Email Secretary meets user needs for immediate categorization of emails and highlighting critical information in emails. The summarization of critical emails and suggesting next steps is fairly accuracte and definitely reduces work load for the user. The first response draft feature is also functioning well and accuractely drafts emails with relevant information. With some fine tuning on different types of emails the email categorization and dashboard could be further improved. The prompts could further be improved so that the LLM outputs are consistent with the requested output format.

Sample Output Example

image.png

Final Summary of Your AI Email Secretary’s Morning Report

Every morning, you should see:

✔️ A structured breakdown of yesterday’s emails

✔️ Prioritized urgent & deadline-driven emails

✔️ Summarized updates & informational emails

✔️ AI-drafted responses to high-priority emails
In [ ]: