promptimizer  by hinthornw

CLI tool for automated prompt optimization

created 9 months ago
781 stars

Top 45.6% on sourcepulse

GitHubView on GitHub
Project Summary

Promptimizer is an experimental library for systematically improving AI prompts. It automates prompt refinement by running an optimization loop, taking an initial prompt, a dataset, and custom evaluators as input to produce a more effective prompt. This tool is designed for developers and researchers looking to enhance the performance of their AI systems on specific tasks.

How It Works

Promptimizer employs an iterative optimization loop. It starts by evaluating an initial prompt against a dataset using user-defined evaluators to establish baseline metrics. Then, it processes the data in minibatches, using a metaprompt to suggest prompt modifications based on evaluation results. The updated prompt is applied to subsequent data, and improvements are retained only if they demonstrably enhance performance on a validation set. This process repeats for a specified number of epochs, allowing for gradual prompt refinement.

Quick Start & Requirements

  • Install: pip install -U promptim
  • Prerequisites: Requires LANGSMITH_API_KEY and ANTHROPIC_API_KEY environment variables.
  • Setup: The quick start involves creating a task configuration, defining evaluators in task.py, and then running promptim train --task ./my-tweet-task/config.json.
  • Links: LangSmith for datasets and prompt hub.

Highlighted Details

  • Automated prompt optimization loop for AI tasks.
  • Supports custom evaluators for quantifying prompt performance.
  • Includes an option for human-in-the-loop feedback via annotation queues.
  • Integrates with LangSmith for dataset management and prompt versioning.

Maintenance & Community

The project appears to be experimental, with CLI arguments noted as subject to change. Further community and maintenance details are not explicitly provided in the README.

Licensing & Compatibility

The README does not specify a license. Compatibility for commercial use or closed-source linking is not detailed.

Limitations & Caveats

The library is explicitly labeled as experimental, indicating potential instability and API changes. The reliance on LangSmith and specific API keys (Anthropic) may present integration hurdles. The effectiveness of the optimization is heavily dependent on the quality and relevance of the provided dataset and custom evaluators.

Health Check
Last commit

3 months ago

Responsiveness

1 week

Pull Requests (30d)
1
Issues (30d)
1
Star History
62 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.