A comprehensive Python library for managing and versioning LLM prompts, with built-in A/B testing, metric tracking, and performance monitoring capabilities.
β¨ Features β’ π Quick Start β’ π Documentation β’ π― Examples
Prompt Versioner provides enterprise-grade prompt management with:
- π Version Control: Full versioning of prompts
- π Performance Tracking: Metrics and regression detection
- π§ͺ A/B Testing: Built-in statistical framework
- β‘ Real-time Monitoring: Alerts and dashboards
- π₯ Team Collaboration: Annotations and reviews
- π¨ Modern UI: Responsive web dashboard
|
|
|
|
- Python 3.11+
- Poetry (recommended) or pip
- Git (optional)
pip install prompt-versionerfrom prompt_versioner import PromptVersioner, VersionBump
pv = PromptVersioner(project_name="my-first-project", enable_git=False)
pv.save_version(
name="assistant-prompt",
system_prompt="You are a helpful assistant.",
user_prompt="Please answer the following question: {question}",
bump_type=VersionBump.MAJOR
)
print("β
Created first prompt version 1.0.0!")- Version history with visual diff
- Semantic search
- Bulk operations
- Live preview
- Token usage, latency, cost analysis
- Quality score tracking
- Multi-model performance comparison with automatic "best model" detection
Model Comparison: Test the same prompt across different models (GPT-4, Claude, Gemini, etc.) and see aggregated metrics with automatic identification of the fastest, cheapest, and highest-quality model.
- Split testing
- Real-time results
- Side-by-side visual diff
- Metadata & performance delta
- Smart annotations
- Automatic detection of regressions
- Cost and error monitoring
- Custom metrics & thresholds
# Initialization & Setup
pv init # Initialize prompt versioner
# Prompt Operations
pv list # List all tracked prompts
pv versions <prompt> # List versions of a prompt
pv show <prompt> <version> # Show version details
# Model Pricing & Cost Estimation
pv models # List all models with pricing
pv models --sort-by input # Sort by input price
pv models --filter gpt # Filter specific models
pv estimate-cost <model> <in> <out> # Estimate cost for usage
pv compare-costs <in> <out> # Compare costs across models
# Version Comparison
pv diff <prompt> <v1> <v2> # Show diff between versions
pv compare <prompt> <v1> <v2> # Compare with metrics
# Management
pv delete <prompt> <version> # Delete a version
pv rollback <prompt> <version> # Rollback to version
pv clear-db # Clear database
# Dashboard
pv dashboard --port 5000 # Launch web dashboardExamples in examples/ are fully functional:
| File | Description |
|---|---|
| basic_usage.py | Getting started |
| version_management.py | Advanced version control |
| metrics_tracking.py | Metrics logging |
| multi_models.py | Multi-model comparison |
| ab_testing.py | Statistical testing |
| performance_monitoring.py | Automated monitoring |
| summarization_example.py | Real-world summarization |
| run_dashboard.py | Launch dashboard |
| clear_db.py | Reset database |
See CONTRIBUTING.md for contribution guidelines.
MIT License - LICENSE
- Documentation: https://pepes97.github.io/prompt-versioner/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Build by Sveva Pepe, NLP Engineer
β Star this project if it helps you build better AI applications!





