/promptopt

Enterprise prompt optimization framework combining DSPy and GRPO approaches

Primary LanguagePythonMIT LicenseMIT

PromptOpt: Enterprise Prompt Optimization Framework

Python 3.8+ License: MIT

A unified framework for testing, comparing, and hybridizing DSPy and GRPO approaches to prompt optimization, with special focus on enterprise deployment via synthetic data and Colab accessibility.

๐ŸŒŸ Key Features

  • ๐Ÿค– Multiple Optimization Strategies: DSPy, GRPO, and hybrid approaches
  • ๐Ÿ’ฐ Cost-Aware Optimization: Built-in budget management and tracking
  • ๐Ÿข Enterprise-Ready: Compliance support, ROI analysis, deployment tools
  • โ˜๏ธ Colab-Optimized: Works perfectly in Google Colab (no GPU needed)
  • ๐Ÿ“Š Tournament Evaluation: Head-to-head prompt comparison system
  • ๐ŸŽฏ Synthetic Data: Generate realistic business scenarios
  • ๐Ÿ”ง API-Based: Works with OpenAI and Anthropic APIs

Installation

Using Conda (Recommended)

# Create a new conda environment
conda create -n promptopt python=3.9
conda activate promptopt

# Install the package
pip install -e .

# For development
pip install -r requirements-dev.txt

Using pip only

pip install promptopt

For development:

pip install -e ".[dev]"

For Colab environments:

pip install promptopt[colab]

Quick Start

from promptopt import EnterprisePOC
from promptopt.colab import ColabManager

# Set up environment
manager = ColabManager()
manager.setup_enterprise_environment()

# Run a complete POC
poc = EnterprisePOC()
results = poc.run_complete_poc(
    business_scenario="customer_support",
    company_context={"industry": "tech", "size": "enterprise"},
    budget_limit=500.0
)

# View results
print(f"Optimization improvements: {results.optimization_improvements}")
print(f"Projected ROI: {results.roi_projections}")

๐Ÿ“š Documentation

See DOCUMENTATION.md for comprehensive guides and API reference.

๐Ÿš€ Quick Start in Google Colab

Open In Colab

๐Ÿงช Running Tests

conda activate promptopt
pytest tests/

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • DSPy framework for few-shot optimization techniques
  • GRPO methodology for tournament-based optimization
  • OpenAI and Anthropic for LLM APIs

๐Ÿ“Š Example Results

Using PromptOpt, teams typically see:

  • 30-40% improvement in response quality
  • 85%+ consistency across team members
  • $2000+/month savings from optimized prompts
  • 2-week ROI for enterprise deployments