🧠 LLM-Powered Email Extraction App

This Streamlit web app lets you upload `.eml` email files and use Anthropic Claude (via AWS Bedrock) to:

Views1
PublishedJan 14, 2026

Loading actions...

5 minBeginnerpromptSingle file

Skill content

Main instructions and any bundled files for this skill.

markdown

🧠 LLM-Powered Email Extraction App

This Streamlit web app lets you upload .eml email files and use Anthropic Claude (via AWS Bedrock) to:

  • Extract structured JSON data from emails
  • Automatically generate cleaner, reusable prompts
  • Compare prompt quality side-by-side in a 4-column interface

πŸš€ Features

  • βœ… .eml File Upload & Parsing β€” Extracts text, html, sender, subject, attachments (PDFs included)
  • πŸ€– Claude-Powered Extraction β€” Uses user_prompt to pull out JSON info from emails
  • ✨ Improved Prompt Generator β€” Claude rewrites your prompt in scalable, few-shot natural language
  • πŸ“Š Prompt Comparison Tool β€” See a side-by-side markdown table comparing your prompt vs Claude’s
  • πŸ–Ό Fixed 4-Column UI β€” Horizontal layout: Email Preview | JSON | Improved Prompt | Comparison
  • πŸŒ™ Dark Panel Layout β€” Panels styled for readability in dark mode, no HTML clutter

πŸ› οΈ Technologies Used

ToolPurpose
StreamlitFrontend Web App
AWS BedrockClaude 3 Haiku (LLM prompt processing)
boto3Python SDK for AWS
PyPDF2PDF Attachment Parsing
BeautifulSoupHTML to Text Conversion
BleachHTML Sanitization (optional)

πŸ“¦ Installation

🐍 Python Environment

git clone https://github.com/rsonic17/llm-prompt-testing-utility.git
cd llm-prompt-testing-utility
python -m venv venv
source venv/bin/activate   # or venv\Scripts\activate on Windows
pip install -r requirements.txt

πŸ” Setup AWS Credentials

Ensure you have:

  • AWS credentials in ~/.aws/credentials
  • AWS region and model ID set via environment:
export AWS_REGION=us-east-1
export BEDROCK_MODEL_ID=anthropic.claude-3-haiku-20240307-v1:0

You can also use a .env file and python-dotenv.


πŸ§ͺ Usage

streamlit run app.py
  1. Upload a .eml file
  2. Paste a Claude-compatible prompt (use {email_data} as placeholder)
  3. Click:
    • 🧠 Extract with LLM
    • ✨ Suggest Better Prompt
    • πŸ“ Compare Prompts
  4. View results in 4 scrollable panels

πŸ”€ Prompt Format (Example)

Paste this in the "User Prompt" box:

Extract the following fields from this email:
- Buyer Name
- Sender Email
- Date
- Payment Amount

Output JSON like:

{
  "buyer": "...",
  "sender": "...",
  "amount": "...",
  "date": "..."
}

Email:
{email_data}

πŸ–Ό UI Overview

πŸ“Έ You can add screenshots here later.

PanelPurpose
πŸ“„ Email PreviewRaw email text
πŸ“¦ LLM Extracted DataClaude’s structured JSON
🌟 Improved PromptClaude's few-shot rewrite
πŸ“‘ Prompt ComparisonMarkdown table comparison

πŸ‘₯ Contributing

Pull requests are welcome. Please open an issue to discuss any major changes.


πŸ“„ License

MIT License Β© 2025 [Your Name / Org]

Share: