Framework for automative prompting creation and optimization
Project description
English | Русский
CoolPrompt is a framework for automative prompting creation and optimization.
Quick install
- Install with pip:
pip install coolprompt
Quick start
Import and initialize PromptTuner
from coolprompt.assistant import PromptTuner
- with default LLM
prompt_tuner = PromptTuner(model=my_model)
- Or initialize your own LLM by Langchain and use it
my_model = VLLM(
model="Qwen/Qwen2.5-Coder-32B-Instruct",
trust_remote_code=True,
dtype='bfloat16',
)
prompt_tuner = PromptTuner(model=my_model)
- List of available LLMs: https://python.langchain.com/docs/integrations/llms/
Running PromptTuner
- Run PromptTuner instance with initial prompt
# Define an initial prompt
prompt = "Make a summarization of 2+2"
# Run a prompt optimisation
new_prompt = tuner.run(start_prompt=prompt)
# Get your new prompt
print(new_prompt)
- including a dataset for prompt optimization and evaluation. A provided dataset will be split by trainset and testset.
sst2 = load_dataset("sst2")
class_dataset = sst2['train']['sentence']
class_targets = sst2['train']['label']
tuner.run(
start_prompt=class_start_prompt,
task="classification",
dataset=class_dataset,
target=class_targets,
metric="accuracy"
)
- to get a final prompt and prompt metrics
print("Final prompt:", tuner.final_prompt)
print("Start prompt metric:", tuner.init_metric)
print("Final prompt metric:", tuner.final_metric)
- This also works for generation tasks
More about project
- Explore the variety of autoprompting methods with PromptTuner: CoolPrompt currently support HyPE, DistillPrompt, ReflectivePrompt. You can choose method via corresponding argument
methodintuner.run - See more examples in notebooks to familiarize yourself with our framework
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coolprompt-0.0.20.tar.gz.
File metadata
- Download URL: coolprompt-0.0.20.tar.gz
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e4918758c650738a174a981efc15d4308e08f087ab630ddea8adb4983bcb2c4
|
|
| MD5 |
3cdb225c6c5d9287708a4beeccc405a1
|
|
| BLAKE2b-256 |
48b1d6054939cdecbe1f08939741d5481d62d403cfb7241e937623528e10f226
|
Provenance
The following attestation bundles were made for coolprompt-0.0.20.tar.gz:
Publisher:
workflow.yml on CTLab-ITMO/CoolPrompt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coolprompt-0.0.20.tar.gz -
Subject digest:
2e4918758c650738a174a981efc15d4308e08f087ab630ddea8adb4983bcb2c4 - Sigstore transparency entry: 258307600
- Sigstore integration time:
-
Permalink:
CTLab-ITMO/CoolPrompt@ca97cdd3f5961c3620e4a1db732c3436902d5dbf -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/CTLab-ITMO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@ca97cdd3f5961c3620e4a1db732c3436902d5dbf -
Trigger Event:
release
-
Statement type:
File details
Details for the file coolprompt-0.0.20-py3-none-any.whl.
File metadata
- Download URL: coolprompt-0.0.20-py3-none-any.whl
- Upload date:
- Size: 39.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dea88537232eea2a0116491c9f9b0d3b6bcd3bd54ce09ffff5adf05be48238cb
|
|
| MD5 |
1433406ca0b346915664f0f45134825d
|
|
| BLAKE2b-256 |
37231ec64564335acf4d7dc3db857b6cfe8747f8eb10ad34bbcc460e57937679
|
Provenance
The following attestation bundles were made for coolprompt-0.0.20-py3-none-any.whl:
Publisher:
workflow.yml on CTLab-ITMO/CoolPrompt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coolprompt-0.0.20-py3-none-any.whl -
Subject digest:
dea88537232eea2a0116491c9f9b0d3b6bcd3bd54ce09ffff5adf05be48238cb - Sigstore transparency entry: 258307612
- Sigstore integration time:
-
Permalink:
CTLab-ITMO/CoolPrompt@ca97cdd3f5961c3620e4a1db732c3436902d5dbf -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/CTLab-ITMO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@ca97cdd3f5961c3620e4a1db732c3436902d5dbf -
Trigger Event:
release
-
Statement type: