Skip to main content

CoolPrompt Logo

Release Notes PyPI - License PyPI Downloads GitHub star chart Open Issues Contributions welcome ITMO Telegram Channel

CoolPrompt is a framework for automatic prompt creation and optimization.

Join our telegram channel to be in touch.

Practical cases

  • Automatic prompt engineering for solving tasks using LLM
  • (Semi-)automatic generation of markup for fine-tuning
  • Formalization of response quality assessment using LLM
  • Prompt for AI Agentic Pipelines
  • Etc.

Core features

  • Optimize prompts with our APO methods:
    • HyPER / HyPER Light
    • RE-GPS
    • RIDER
    • BRAVE
    • PromptCompressor
    • (legacy/deprecated): ReflectivePrompt, DistillPrompt
  • LLM-Agnostic Choice: work with your custom llm (from open-sourced to proprietary) using supported Langchain LLMs
  • Develop own custom APO method in one library
  • Generate synthetic evaluation data when no input dataset is provided
  • Evaluate a quality of prompts incorporating multiple metrics for both classification and generation tasks
  • Evaluate costs of optimization processes by a number of tokens/calls and a price.
  • Automatic task detecting for scenarios without explicit user-defined task specifications

CoolPrompt Scheme

APO methods comparison

CoolPrompt provides several automatic prompt optimization methods with different trade-offs in data requirements, runtime, expected quality, and API cost. The levels below are qualitative and task-dependent: they are intended as a quick guide for choosing a method before running a benchmark.

Compared metrics:

  • Data - whether dataset is required for the method to run.
  • Runtime - relative wall-clock time of one optimization run.
  • Performance - expected ability to improve task quality compared with the initial prompt.
  • Cost - relative compute/API cost: LLM calls, evaluation calls, token usage, and extra scoring overhead.
Method Data Runtime ↓ Performance ↑ Cost ↓
hyper_light None Low Medium Low
hyper Required Medium High Medium
regps Required High Very High High
rider Required Very High Very High Very High
brave Required High Very High Budget-controlled
compress None Low Medium Low
reflective Required High High High
distill Required High High High

Quick install

  • Install with pip:
pip install coolprompt
  • Install with git:
git clone https://github.com/CTLab-ITMO/CoolPrompt.git
cd CoolPrompt

pip install -e .

Quick start

Set your OpenAI API key before running. The default model is gpt-4o-mini via the OpenAI API (OPENAI_API_KEY environment variable)

from coolprompt.assistant import PromptTuner

prompt_tuner = PromptTuner()

prompt_tuner.run('Write an essay about autumn')

print(prompt_tuner.final_prompt)

# You are an expert writer and seasonal observer tasked with composing a rich,
# well-structured, and vividly descriptive essay on the theme of autumn...

CoolPrompt full optimization demo

Run the data-driven BRAVE optimizer by selecting it as the method:

final_prompt = prompt_tuner.run(
    "Classify the sentiment of the text: {text}",
    task="classification",
    dataset=["Great product", "Very disappointing"],
    target=["positive", "negative"],
    method="brave",
    problem_description="Classify product-review sentiment.",
    max_steps=20,
    initial_budget_tokens=50_000,
)

Examples

See more examples in notebooks to familiarize yourself with our framework

About project

  • The framework is developed by Computer Technologies Lab (CT-Lab) of ITMO University.
  • API Reference

Contributing

  • We welcome and value any contributions and collaborations, so please contact us. For new code check out CONTRIBUTING.md.

Reference

For technical details and full experimental results, please check our papers + citations inside.

RIDER
@inproceedings{dragomirov2026rider,
  author = {Dragomirov, Daglar and Kulin, Nikita and Muravyov, Sergey and Makarov, Ilya and Sukhorukov, Daniil and Mozikov, Mikhail},
  title = {RIDER: Evolutionary Prompt Optimization with Adaptive Operator Selection for Software Engineering},
  booktitle = {Companion Proceedings of the 34th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering},
  series = {FSE Companion '26},
  year = {2026},
  doi = {10.1145/3803437.3807393}
}
RE-GPS
@inproceedings{kulin2026re,
  title={RE-GPS: Reflective Evolutionary Gradient Prompting System for Large Language Models},
  author={Kulin, Nikita and Zhuravlev, Viktor and Khairullin, Artur and Muravyov, Sergey},
  booktitle={2026 39th Conference of Open Innovations Association (FRUCT)},
  pages={157--163},
  year={2026},
  organization={IEEE}
}
CoolPrompt
@INPROCEEDINGS{11239071,
  author={Kulin, Nikita and Zhuravlev, Viktor and Khairullin, Artur and Sitkina, Alena and Muravyov, Sergey},
  booktitle={2025 38th Conference of Open Innovations Association (FRUCT)}, 
  title={CoolPrompt: Automatic Prompt Optimization Framework for Large Language Models}, 
  year={2025},
  volume={},
  number={},
  pages={158-166},
  keywords={Technological innovation;Systematics;Large language models;Pipelines;Manuals;Prediction algorithms;Libraries;Prompt engineering;Optimization;Synthetic data},
  doi={10.23919/FRUCT67853.2025.11239071}
}
ReflectivePrompt
@misc{zhuravlev2025reflectivepromptreflectiveevolutionautoprompting,
      title={ReflectivePrompt: Reflective evolution in autoprompting algorithms}, 
      author={Viktor N. Zhuravlev and Artur R. Khairullin and Ernest A. Dyagin and Alena N. Sitkina and Nikita I. Kulin},
      year={2025},
      eprint={2508.18870},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2508.18870}, 
}
DistillPrompt
@misc{dyagin2025automaticpromptoptimizationprompt,
      title={Automatic Prompt Optimization with Prompt Distillation},
      author={Ernest A. Dyagin and Nikita I. Kulin and Artur R. Khairullin and Viktor N. Zhuravlev and Alena N. Sitkina},
      year={2025},
      eprint={2508.18992},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2508.18992}, 
}

Metadata

Release files for coolprompt 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coolprompt 2.1.0
File Size Uploaded
coolprompt-2.1.0.tar.gz 209.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coolprompt 2.1.0
File Interpreter ABI Platform
coolprompt-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 455.3 kB

Release files / coolprompt-2.1.0.tar.gz

Download URL coolprompt-2.1.0.tar.gz
Size 209.1 kB
Tags Source
SHA-256 checksum
How to use checksums
97a9ba77f85348f6335d55a71f1fd877c19a1cf0e4504f686ed375bb9aca0fc0
BLAKE2b-256 checksum
How to use checksums
3550f008f44693aaca81f225b36ebaed9cd0dd552493daf6c9de4ed486878083
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / coolprompt-2.1.0-py3-none-any.whl

Download URL coolprompt-2.1.0-py3-none-any.whl
Size 246.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e24cdb1dae37ead681ced2f2bc7460de2965d7c5d81ae15ca4e5b1ce54514a12
BLAKE2b-256 checksum
How to use checksums
36424afa62ffa682061d5ef09782cccfff2c14b555332a420b31bccf04f4f6f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page