Spaces:
Running
Running
A newer version of the Streamlit SDK is available:
1.52.1
metadata
title: Prompt Groomer Demo
emoji: π§Ή
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.28.0
app_file: app.py
pinned: false
π§Ή Prompt Groomer - Interactive Demo
Live demonstration of prompt-groomer library capabilities.
Stop paying for invisible tokens. Optimize your LLM inputs to save costs, improve context usage, and enhance security.
β¨ Features
- π― Interactive Playground - Experiment with different optimization strategies
- π° Real-time Token Savings - See exactly how many tokens and dollars you save
- π§ Configurable Operations - Toggle between 7 different operations
- π Visual Metrics - Cost analysis and performance tracking
- π Preset Examples - 6 real-world scenarios (e-commerce, support, docs, RAG, etc.)
- β‘ Quick Presets - Minimal, Standard, Aggressive, or Custom strategies
π Quick Start
- Choose a preset example from the dropdown (or enter your own text)
- Select a strategy in the sidebar (Minimal, Standard, Aggressive, or Custom)
- Configure operations to match your use case
- See results with real-time token counting and cost savings
π¦ Installation
Try it live here, then install for your project:
pip install prompt-groomer
π» Example Usage
from prompt_groomer import (
StripHTML,
NormalizeWhitespace,
TruncateTokens
)
# Use pipe operator to chain operations
pipeline = (
StripHTML()
| NormalizeWhitespace()
| TruncateTokens(max_tokens=1000)
)
cleaned = pipeline.run(dirty_text)
π Links
- π Documentation
- π» GitHub Repository
- π¦ PyPI Package
π Proven Effectiveness
Benchmarked on 30 real-world test cases:
- 4-15% token reduction on average
- 96-99% quality maintained (verified)
- Up to ~$54/month saved at scale (1M tokens/month, GPT-4)
π οΈ Operations Available
π§Ό Cleaner
- Strip HTML tags
- Normalize whitespace
- Fix Unicode issues
ποΈ Compressor
- Deduplicate similar content
- Truncate to token limits
π Scrubber
- Redact PII (email, phone, IP, credit cards, SSN, URLs)
π Analyzer
- Count tokens
- Calculate cost savings
Made with β€οΈ by Jacob Huang