Metadata-Version: 2.4
Name: riderprompt
Version: 0.1.1
Summary: Python client for RIDER — autonomous prompt optimization engine. 17 WIN / 0 LOSE across 6 benchmarks.
Author-email: Daglar Dragomirov <daglar.dragomirov@gmail.com>
License: MIT
Project-URL: Homepage, https://riderprompt.com
Project-URL: Documentation, https://riderprompt.com/api-docs
Project-URL: Repository, https://github.com/daglar-dragomirov/rider-client
Project-URL: Issues, https://github.com/daglar-dragomirov/rider-client/issues
Keywords: prompt-optimization,llm,evolutionary-computation,metaheuristic,thompson-sampling,prompt-engineering,machine-learning,ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10; extra == "dev"
Requires-Dist: responses>=0.23; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"
Dynamic: license-file

# RIDER — Autonomous Prompt Optimization

[![PyPI](https://img.shields.io/pypi/v/riderprompt.svg)](https://pypi.org/project/riderprompt/)
[![Python](https://img.shields.io/pypi/pyversions/riderprompt.svg)](https://pypi.org/project/riderprompt/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

Python client for **RIDER** (Reflective Iterative Diversity-Enhanced Reasoning) — a metaheuristic prompt optimization engine that evolves prompts through evolutionary algorithms, multi-armed bandits, and error-directed refinement.

**17 WIN / 0 LOSE** across 6 benchmarks (GSM8K, AG_News, SQuAD 2.0, CommonGen, XSum, CodeSearchNet) on 3 LLM models (Claude Haiku 4.5, GPT-4.1, DeepSeek V3.2). Published at **FSE 2026 (CORE A\*)** and **FRUCT 39 (IEEE)**.

## Installation

```bash
pip install riderprompt
```

## Quick Start

Get your API key at [riderprompt.com](https://riderprompt.com), then:

```python
from rider import Rider

client = Rider(api_key="rider_sk_...")

result = client.optimize(
    prompt="Write a summary of this article",
    mode="standard",
)

print(result.optimized_prompt)
print(f"Improvement: {result.improvement:.1f}%")
```

## Optimization Modes

| Mode | Time | API Calls | Best For |
|------|------|-----------|----------|
| `light` | ~15 sec | 5 | Quick rewrite, 2 strategies compete |
| `blitz` | ~30 sec | 11 | 4 strategies + merge + error refinement |
| `standard` | ~1 min | 19 | Full 3-phase PHASE REACTOR (default) |
| `ultra` | ~2 min | 25 | 4 phases + adversarial review |

## Features

- 🧬 **Evolutionary algorithms** — 9 operators (EDA mutation, differential evolution, genetic crossover, semantic paraphrase, etc.)
- 🎰 **Adaptive operator selection** — Windowed Thompson Sampling with Bayesian elimination
- 🎯 **Error-directed evolution** — feeds misclassified examples back into generation
- ⚡ **Evaluate-first (μ+λ) retention** — diversity tiebreaking
- 🔄 **8 exclusive protocols** — PRISM, NEXUS, PHASE REACTOR, OPERATOR FORGE, ECHO, CHIMERA, VORTEX, MARS CONFIG

## Examples

### Optimize a prompt with custom validation data

```python
result = client.optimize(
    prompt="Classify this text as positive or negative",
    mode="ultra",
    validation_examples=[
        {"input": "I love this!", "expected": "positive"},
        {"input": "This is terrible", "expected": "negative"},
    ],
)
```

### Async usage with multiple prompts

```python
import asyncio
from rider import AsyncRider

async def optimize_many(prompts):
    client = AsyncRider(api_key="rider_sk_...")
    tasks = [client.optimize(p, mode="light") for p in prompts]
    results = await asyncio.gather(*tasks)
    return results
```

## Pricing

- **Free** — 3 optimizations/day (Light + Blitz modes)
- **Pro** ($9.99/mo) — 50/day, all 4 modes, REST API
- **Ultra** ($29.99/mo) — Unlimited, priority queue

[See pricing](https://riderprompt.com/pricing)

## Citation

If you use RIDER in your research, please cite:

```bibtex
@inproceedings{dragomirov2026rider,
  title={{RIDER}: Evolutionary Prompt Optimization with Adaptive Operator Selection for Software Engineering},
  author={Dragomirov, Daglar and Kulin, Nikita and Muravyov, Sergey and Makarov, Ilya and Sukhorukov, Daniil and Mozikov, Mikhail},
  booktitle={Companion Proceedings of the 34th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (FSE Companion '26)},
  year={2026},
  doi={10.1145/3803437.3807393},
}
```

## Links

- **Website**: [riderprompt.com](https://riderprompt.com)
- **API Documentation**: [riderprompt.com/api-docs](https://riderprompt.com/api-docs)
- **Developer Portal**: [riderprompt.com/developer](https://riderprompt.com/developer)
- **Paper**: FSE 2026 Companion Proceedings

## License

MIT License — see [LICENSE](LICENSE) file.
