Repository: CTLab-ITMO/CoolPrompt
Pull request #20: naive prompttuner
Author: login: samiaFife
Created: 2025-05-05T13:07:15Z | Merged: 2025-05-18T16:14:11Z

https://coolprompt.kaiten.ru/space/496185/boards/card/49441886

Реализовал четыре класса (HF local, HF remote, Ollama, OpenAI compatible) + BaseLLM, в каждом два метода: __init__ от config и invoke от prompt. Как я понял, локальный - только HF local, остальные по сети подключаются. Добавил несколько проверок в каждый класс. Вверху константой есть дефолтные параметры, вроде названий моделей и параметров сэмплирования (пока max_new_tokens и температура, на счет значений пока сомневаюсь, был бы рад подсказке).


Diff:
diff --git a/coolprompt/utils/__init__.py b/coolprompt/__init__.py
similarity index 100%
rename from coolprompt/utils/__init__.py
rename to coolprompt/__init__.py
diff --git a/coolprompt/assistant.py b/coolprompt/assistant.py
index fbaa1a3..11ff1c3 100644
--- a/coolprompt/assistant.py
+++ b/coolprompt/assistant.py
@@ -1,27 +1,42 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.language_model.llm import DefaultLLM
+from coolprompt.optimizer.naive import naive_optimizer
+
+
+class PromptTuner:
+    """Prompt optimization tool supporting multiple methods."""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Initializes the tuner with a LangChain-compatible language model.
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: BaseLanguageModel - Any LangChain BaseLanguageModel instance
+                which supports invoke(str) -> str. Will use DefaultLLM if not provided.
+        """
+        self._model = model or DefaultLLM.init()
+        self._validate_model()
 
-    def invoke(self, ):
-        '''Docstring
+    def run(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None, method: str = None) -> str:
+        """Optimizes prompts using provided model.
 
         Args:
-            start_prompt: str
-            dataset: pd.DataFrame
-            target: str
+            start_prompt: str - Initial prompt text to optimize.
+            dataset: DataFrame - Optional Pandas DataFrame for dataset-based optimization.
+            target: str - Target column name for dataset-based optimization.
+            method: str - Optimization method to use.
         Returns:
-            final_prompt: str
-        '''
-        pass
+            final_prompt: str - The resulting optimized prompt after applying the selected method.
+        Note:
+            Uses naive optimization when dataset or method parameters are not provided.
+        """
+        final_prompt = ""
+        if dataset is None or method is None:
+            final_prompt = naive_optimizer(self._model, start_prompt)
+        return final_prompt
+
+    def _validate_model(self):
+        if not isinstance(self._model, BaseLanguageModel):
+            raise TypeError("Model should be instance of LangChain BaseLanguageModel")
+        if not hasattr(self._model, "invoke"):
+            raise AttributeError("Model should implement .invoke()")
diff --git a/coolprompt/language_model/__init__.py b/coolprompt/language_model/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/coolprompt/language_model/llm.py b/coolprompt/language_model/llm.py
index 198eea2..690d5bc 100644
--- a/coolprompt/language_model/llm.py
+++ b/coolprompt/language_model/llm.py
@@ -1,7 +1,46 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+from typing import Any
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.default import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine."""
+
+    @staticmethod
+    def init(
+        langchain_config: dict[str, Any] | None = None, vllm_engine_config: dict[str, Any] | None = None
+    ) -> BaseLanguageModel:
+        """Initialize the vLLM-powered LangChain LLM.
+
+        Args:
+            langchain_config (dict[str, Any], optional): Optional dictionary of LangChain VLLM parameters (temperature, top_p, etc). Overrides DEFAULT_MODEL_PARAMETERS.
+            vllm_engine_config (dict[str, ANy], optional): Optional dictionary of low-level vllm.LLM parameters (gpu_memory_utilization, max_model_len, etc). Passed directly to vllm.LLM via vllm_kwargs.
+        Returns:
+            BaseLanguageModel: Initialized LangChain-compatible language model instance.
+        """
+        generation_and_model_config = DEFAULT_MODEL_PARAMETERS.copy()
+        if langchain_config is not None:
+            generation_and_model_config.update(langchain_config)
+
+        tokenizer = AutoTokenizer.from_pretrained(DEFAULT_MODEL_NAME, padding_side="left")
+        terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("
")]
+        return VLLM(
+            model=DEFAULT_MODEL_NAME,
+            trust_remote_code=True,
+            stop_token_ids=terminators,
+            torch_dtype=torch.float16,
+            vllm_kwargs=vllm_engine_config,
+            **generation_and_model_config
+        )
diff --git a/coolprompt/optimizer/naive.py b/coolprompt/optimizer/naive.py
new file mode 100644
index 0000000..a8b1334
--- /dev/null
+++ b/coolprompt/optimizer/naive.py
@@ -0,0 +1,17 @@
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.prompt_template import NAIVE_PROMPT_TEMPLATE
+
+
+def naive_optimizer(model: BaseLanguageModel, prompt: str) -> str:
+    """Rewrites prompt by injecting it into predefined template and querying LLM.
+
+    Args:
+        model: Any LangChain BaseLanguageModel instance.
+        prompt: Input prompt to optimize.
+
+    Returns:
+        LLM-generated rewritten prompt.
+    """
+    template = NAIVE_PROMPT_TEMPLATE
+    answer = model.invoke(template.replace("<PROMPT>", prompt)).strip()
+    return answer[answer.find("Rewritten prompt:\n") + len("Rewritten prompt:\n") :]
diff --git a/coolprompt/utils/default.py b/coolprompt/utils/default.py
new file mode 100644
index 0000000..fb5a691
--- /dev/null
+++ b/coolprompt/utils/default.py
@@ -0,0 +1,7 @@
+DEFAULT_MODEL_NAME = "t-tech/T-lite-it-1.0"
+DEFAULT_MODEL_PARAMETERS = {
+    "max_new_tokens": 4000,
+    "temperature": 0.5,
+    "best_of": 1,
+    "n": 1
+}
diff --git a/coolprompt/utils/prompt_template.py b/coolprompt/utils/prompt_template.py
new file mode 100644
index 0000000..d5f94b3
--- /dev/null
+++ b/coolprompt/utils/prompt_template.py
@@ -0,0 +1,9 @@
+NAIVE_PROMPT_TEMPLATE = (
+    "Rewrite the following prompt to maximize its effectiveness for LLMs.\n"
+    "Apply transformations: structure, specifics, remove ambiguity, add example, keep intent.\n"
+    "Only output the rewritten prompt, with no explanation or formatting.\n"
+    "\n"
+    "Prompt:\n"
+    "<PROMPT>\n"
+    "Rewritten prompt:\n"
+)
diff --git a/notebooks/examples/naive_autoprompting.ipynb b/notebooks/examples/naive_autoprompting.ipynb
new file mode 100644
index 0000000..22d984d
--- /dev/null
+++ b/notebooks/examples/naive_autoprompting.ipynb
@@ -0,0 +1,1149 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "id": "f5c0b823",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import sys\n",
+    "import os\n",
+    "project_root = os.path.abspath(os.path.join(os.getcwd(), \"../../\"))\n",
+    "sys.path.append(project_root)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "id": "221f53d1",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "extracted prompts\n"
+     ]
+    }
+   ],
+   "source": [
+    "import json\n",
+    "\n",
+    "prompts = [\n",
+    "    \"What is common with the crow and writing table?\",\n",
+    "    \"А как сделать чтобы langchain создал локальную модель\",\n",
+    "    \"бро напиши пж решение задачи: доказать что моноид это категория\",\n",
+    "    \"привет я составляю сборку для майнкрафт 1.21 neoforge и мне нужна база. это моды типа wawla, dynamic lights, jei+nei, journey миникарта, показ восстановления еды, показ прочности предметов, еще какие то\",\n",
+    "    \"\"\">>> send_email(None)\n",
+    "Traceback (most recent call last):\n",
+    "  File \"<stdin>\", line 1, in <module>\n",
+    "  File \"/path/to/project/main.py\", line 8, in send_email\n",
+    "    raise InvalidEmailAddress(\"Invalid email address\")\n",
+    "InvalidEmailAddress: Invalid email address\n",
+    "а чо я неправильно пишу?\n",
+    "\"\"\",\n",
+    "]\n",
+    "with open(\"../../data/basic_prompts.json\", \"r\") as f:\n",
+    "    prompts_json = json.load(f)\n",
+    "    for _, prompt in prompts_json.items():\n",
+    "        if isinstance(prompt, str):\n",
+    "            prompts.append(prompt)\n",
+    "        else:\n",
+    "            for _, p in prompt.items():\n",
+    "                prompts.append(p)\n",
+    "\n",
+    "print(\"extracted prompts\")"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "id": "968dd629-4357-4929-9af9-ccf2a7023a75",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "['What is common with the crow and writing table?',\n",
+       " 'А как сделать чтобы langchain создал локальную модель',\n",
+       " 'бро напиши пж решение задачи: доказать что моноид это категория',\n",
+       " 'привет я составляю сборку для майнкрафт 1.21 neoforge и мне нужна база. это моды типа wawla, dynamic lights, jei+nei, journey миникарта, показ восстановления еды, показ прочности предметов, еще какие то',\n",
+       " '>>> send_email(None)\\nTraceback (most recent call last):\\n  File \"<stdin>\", line 1, in <module>\\n  File \"/path/to/project/main.py\", line 8, in send_email\\n    raise InvalidEmailAddress(\"Invalid email address\")\\nInvalidEmailAddress: Invalid email address\\nа чо я неправильно пишу?\\n',\n",
+       " 'Evaluate the result of a random Boolean expression.',\n",
+       " 'Order adjectives correctly in English sentences.',\n",
+       " 'Answer questions about which times certain events could have occurred.',\n",
+       " 'Questions that involve enumerating objects and asking the model to count them.',\n",
+       " 'Clarify the meaning of sentences with ambiguous pronouns.',\n",
+       " 'A logical deduction task which requires deducing the order of a sequence of objects.',\n",
+       " 'A logical deduction task which requires deducing the order of a sequence of objects.',\n",
+       " 'A logical deduction task which requires deducing the order of a sequence of objects.',\n",
+       " 'Answer questions about causal attribution.',\n",
+       " ' Infer the date from context.',\n",
+       " \"Select the humorous edit that 'ruins' the input movie or musical artist name.\",\n",
+       " 'Sort a list of words.',\n",
+       " 'Name geometric shapes from their SVG paths.',\n",
+       " 'Recommend movies similar to the given list of movies.',\n",
+       " 'Detect the type of error in an English translation of a German source sentence.',\n",
+       " 'Distinguish deductively valid arguments from formal fallacies.',\n",
+       " 'Answer questions about a table of penguins and their attributes.',\n",
+       " ' Correctly close a Dyck-n word.',\n",
+       " 'Solve multi-step arithmetic problems.',\n",
+       " 'Given a series of navigation instructions, determine whether one would end up back at the starting point.',\n",
+       " 'Answer extremely simple questions about the colors of objects on a surface.',\n",
+       " 'A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.',\n",
+       " 'A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.',\n",
+       " 'A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.',\n",
+       " 'Determine whether an artificially constructed sentence relating to sports is plausible or not.',\n",
+       " 'Determine which of two sentences is sarcastic.',\n",
+       " 'Evaluate the truth value of a random Boolean function expressed as a natural-language word problem.',\n",
+       " 'Solve the math word problem, giving your answer as an arabic numeral.',\n",
+       " 'Solve the math word problem',\n",
+       " 'Please use your domain knowledge in medical area to solve the questions.',\n",
+       " \"In this task, you're given a pair of sentences, premise and hypothesis. Your job is to choose whether the two sentences clearly agree/disagree with each other, or if this cannot be determined.\",\n",
+       " 'Please perform Sentiment Classification task',\n",
+       " \"A question that is free of any grammatical or logical errors, should be labeled 'Yes.', otherwise it should be indicated as 'No.'. A question is grammatically correct if all its entities i.e. nouns, verbs, adjectives, prepositions, pronouns, adverbs are at appropriate position. A question is logically correct if the semantic makes sense.\",\n",
+       " 'You are given a sentence and a question in the input. If the information provided in the sentence is enough to answer the question, label \"Yes.\", otherwise label \"No.\". Do not use any facts other than those provided in the sentence while labeling \"Yes.\" or \"No.\".',\n",
+       " 'In this task, you will be shown a short story with a beginning, two potential middles, and an ending. Your job is to choose the middle statement that makes the story coherent / plausible by writing \"1\" or \"2\" in the output. If both sentences are plausible, pick the one that makes most sense.',\n",
+       " 'Answer the following question: ',\n",
+       " 'Define if the sentence entails the question.',\n",
+       " 'Summarize the following text',\n",
+       " 'Please perform Sentiment Classification task.',\n",
+       " 'Classify this sentence based on the provided categories.',\n",
+       " 'Identify the most suitable category for this question.']"
+      ]
+     },
+     "execution_count": 3,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "prompts"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "id": "792dae57",
+   "metadata": {
+    "scrolled": true
+   },
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "INFO 05-14 18:17:45 __init__.py:207] Automatically detected platform cuda.\n",
+      "INFO 05-14 18:17:52 config.py:549] This model supports multiple tasks: {'embed', 'classify', 'score', 'generate', 'reward'}. Defaulting to 'generate'.\n",
+      "INFO 05-14 18:17:52 config.py:1382] Defaulting to use mp for distributed inference\n",
+      "INFO 05-14 18:17:52 llm_engine.py:234] Initializing a V0 LLM engine (v0.7.3) with config: model='t-tech/T-lite-it-1.0', speculative_config=None, tokenizer='t-tech/T-lite-it-1.0', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, override_neuron_config=None, tokenizer_revision=None, trust_remote_code=True, dtype=torch.bfloat16, max_seq_len=1600, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=2, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto,  device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='xgrammar'), observability_config=ObservabilityConfig(otlp_traces_endpoint=None, collect_model_forward_time=False, collect_model_execute_time=False), seed=0, served_model_name=t-tech/T-lite-it-1.0, num_scheduler_steps=1, multi_step_stream_outputs=True, enable_prefix_caching=False, chunked_prefill_enabled=False, use_async_output_proc=True, disable_mm_preprocessor_cache=False, mm_processor_kwargs=None, pooler_config=None, compilation_config={\"splitting_ops\":[],\"compile_sizes\":[],\"cudagraph_capture_sizes\":[256,248,240,232,224,216,208,200,192,184,176,168,160,152,144,136,128,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,4,2,1],\"max_capture_size\":256}, use_cached_outputs=False, \n",
+      "WARNING 05-14 18:17:53 multiproc_worker_utils.py:300] Reducing Torch parallelism from 10 threads to 1 to avoid unnecessary CPU contention. Set OMP_NUM_THREADS in the external environment to tune this value as needed.\n",
+      "INFO 05-14 18:17:53 custom_cache_manager.py:19] Setting Triton cache manager to: vllm.triton_utils.custom_cache_manager:CustomCacheManager\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:53 multiproc_worker_utils.py:229] Worker ready; awaiting tasks\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:54 cuda.py:229] Using Flash Attention backend.\n",
+      "INFO 05-14 18:17:54 cuda.py:229] Using Flash Attention backend.\n",
+      "INFO 05-14 18:17:54 utils.py:916] Found nccl from library libnccl.so.2\n",
+      "INFO 05-14 18:17:54 pynccl.py:69] vLLM is using nccl==2.21.5\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:54 utils.py:916] Found nccl from library libnccl.so.2\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:54 pynccl.py:69] vLLM is using nccl==2.21.5\n",
+      "INFO 05-14 18:17:55 custom_all_reduce_utils.py:244] reading GPU P2P access cache from /nfs/home/ahairulin/.cache/vllm/gpu_p2p_access_cache_for_0,1.json\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:55 custom_all_reduce_utils.py:244] reading GPU P2P access cache from /nfs/home/ahairulin/.cache/vllm/gpu_p2p_access_cache_for_0,1.json\n",
+      "WARNING 05-14 18:17:55 custom_all_reduce.py:145] Custom allreduce is disabled because your platform lacks GPU P2P capability or P2P test failed. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m WARNING 05-14 18:17:55 custom_all_reduce.py:145] Custom allreduce is disabled because your platform lacks GPU P2P capability or P2P test failed. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
+      "INFO 05-14 18:17:55 shm_broadcast.py:258] vLLM message queue communication handle: Handle(connect_ip='127.0.0.1', local_reader_ranks=[1], buffer_handle=(1, 4194304, 6, 'psm_e4fd430b'), local_subscribe_port=35809, remote_subscribe_port=None)\n",
+      "INFO 05-14 18:17:55 model_runner.py:1110] Starting to load model t-tech/T-lite-it-1.0...\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:55 model_runner.py:1110] Starting to load model t-tech/T-lite-it-1.0...\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:17:55 weight_utils.py:254] Using model weights format ['*.safetensors']\n",
+      "INFO 05-14 18:17:55 weight_utils.py:254] Using model weights format ['*.safetensors']\n"
+     ]
+    },
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "dc4621ec05b148f9aed875ea6b742e8d",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Loading safetensors checkpoint shards:   0% Completed | 0/4 [00:00<?, ?it/s]\n"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:19:17 model_runner.py:1115] Loading model weights took 7.1186 GB\n",
+      "INFO 05-14 18:19:17 model_runner.py:1115] Loading model weights took 7.1186 GB\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:19:22 worker.py:267] Memory profiling takes 4.73 seconds\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:19:22 worker.py:267] the current vLLM instance can use total_gpu_memory (11.76GiB) x gpu_memory_utilization (0.90) = 10.58GiB\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:19:22 worker.py:267] model weights take 7.12GiB; non_torch_memory takes 0.20GiB; PyTorch activation peak memory takes 0.19GiB; the rest of the memory reserved for KV Cache is 3.08GiB.\n",
+      "INFO 05-14 18:19:22 worker.py:267] Memory profiling takes 4.88 seconds\n",
+      "INFO 05-14 18:19:22 worker.py:267] the current vLLM instance can use total_gpu_memory (11.76GiB) x gpu_memory_utilization (0.90) = 10.58GiB\n",
+      "INFO 05-14 18:19:22 worker.py:267] model weights take 7.12GiB; non_torch_memory takes 0.20GiB; PyTorch activation peak memory takes 1.40GiB; the rest of the memory reserved for KV Cache is 1.87GiB.\n",
+      "INFO 05-14 18:19:22 executor_base.py:111] # cuda blocks: 4374, # CPU blocks: 9362\n",
+      "INFO 05-14 18:19:22 executor_base.py:116] Maximum concurrency for 1600 tokens per request: 43.74x\n",
+      "INFO 05-14 18:19:26 model_runner.py:1434] Capturing cudagraphs for decoding. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI. If out-of-memory error occurs during cudagraph capture, consider decreasing `gpu_memory_utilization` or switching to eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:19:26 model_runner.py:1434] Capturing cudagraphs for decoding. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI. If out-of-memory error occurs during cudagraph capture, consider decreasing `gpu_memory_utilization` or switching to eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Capturing CUDA graph shapes: 100%|████████████████████████████████████████████████████████████████████████| 35/35 [00:20<00:00,  1.67it/s]"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "\u001b[1;36m(VllmWorkerProcess pid=195699)\u001b[0;0m INFO 05-14 18:19:47 model_runner.py:1562] Graph capturing finished in 21 secs, took 0.42 GiB\n",
+      "INFO 05-14 18:19:47 model_runner.py:1562] Graph capturing finished in 21 secs, took 0.42 GiB\n",
+      "INFO 05-14 18:19:47 llm_engine.py:436] init engine (profile, create kv cache, warmup model) took 30.31 seconds\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "\n"
+     ]
+    }
+   ],
+   "source": [
+    "from coolprompt.assistant import PromptTuner\n",
+    "pt = PromptTuner()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "id": "fa563efd",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "prompt: What is common with the crow and writing table?\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.92it/s, est. speed input: 111.44 toks/s, output: 44.19 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: larities between crows and writing tables, and can you provide an example to illustrate these similarities?\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: А как сделать чтобы langchain создал локальную модель\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|███████████████████████████████| 1/1 [00:19<00:00, 19.45s/it, est. speed input: 3.19 toks/s, output: 79.11 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, while ensuring clarity, removing ambiguity, and incorporating an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I improve the prompt to better guide LLMs in creating a local model with LangChain, while ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I improve the clarity and effectiveness of the prompt for LLMs in creating a local model with LangChain, while ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I improve the clarity and effectiveness of the prompt for LLMs in creating a local model with LangChain, while ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its effectiveness for LLMs when creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I optimize the prompt for LLMs to create a local model with LangChain, ensuring clarity, removing ambiguity, and providing an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to enhance its effectiveness for LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and adding an example? \n",
+      "\n",
+      "Rewritten prompt:\n",
+      "How can I structure the prompt to effectively guide LLMs in creating a local model with LangChain, ensuring clarity, removing ambiguity, and including an example? \n",
+      "\n",
+      "Output:\n",
+      "How can I rephrase the prompt to maximize its\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: бро напиши пж решение задачи: доказать что моноид это категория\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:02<00:00,  2.96s/it, est. speed input: 23.29 toks/s, output: 79.31 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: Rephrase the problem statement to clarify the intent: \"Prove that a monoid, which is a set equipped with an associative binary operation and an identity element, can be considered a category with a single object, where the morphisms are the elements of the monoid, and composition of morphisms is given by the monoid operation.\" Add an example to illustrate the concept. \"Consider a monoid (M, *) with elements {a, b, c} and operation * defined as follows: a * a = a, a * b = b, a * c = c, b * a = b, b * b = b, b * c = c, c * a = c, c * b = c, c * c = c. Show how this monoid can be represented as a category with a single object and morphisms corresponding to the elements of the monoid, and explain how composition of morphisms aligns with the monoid operation.\"\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: привет я составляю сборку для майнкрафт 1.21 neoforge и мне нужна база. это моды типа wawla, dynamic lights, jei+nei, journey миникарта, показ восстановления еды, показ прочности предметов, еще какие то\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.15it/s, est. speed input: 135.12 toks/s, output: 75.07 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: bling a Minecraft 1.21 Neoforge modpack and need a base. Can you provide a structured list of specific mods like WAWLA, Dynamic Lights, JEI+NEI, Journey Minimap, Food Restoration display, Item Durability display, and any additional relevant mods?\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: >>> send_email(None)\n",
+      "Traceback (most recent call last):\n",
+      "  File \"<stdin>\", line 1, in <module>\n",
+      "  File \"/path/to/project/main.py\", line 8, in send_email\n",
+      "    raise InvalidEmailAddress(\"Invalid email address\")\n",
+      "InvalidEmailAddress: Invalid email address\n",
+      "а чо я неправильно пишу?\n",
+      "\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:01<00:00,  1.77s/it, est. speed input: 66.79 toks/s, output: 77.55 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ne)\n",
+      "Traceback (most recent call last):\n",
+      "  File \"<stdin>\", line 1, in <module>\n",
+      "  File \"/path/to/project/main.py\", line 8, in send_email\n",
+      "    raise InvalidEmailAddress(\"Invalid email address\")\n",
+      "InvalidEmailAddress: Invalid email address\n",
+      "\n",
+      "Please provide a clear and concise explanation of the error, including specific examples, and suggest a corrected code snippet to fix the issue. For example, if the error is related to an invalid email address, provide an example of a valid email address and explain why the current input is invalid. Additionally, provide a corrected code snippet that demonstrates the proper usage of the `send_email` function.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Evaluate the result of a random Boolean expression.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.55it/s, est. speed input: 145.72 toks/s, output: 74.14 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: lowing Boolean expression into a structured format, providing specific details, removing any ambiguity, and including an example to illustrate the intended outcome.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Order adjectives correctly in English sentences.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.73it/s, est. speed input: 152.77 toks/s, output: 73.65 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: re and arrange adjectives in English sentences, providing specific examples to clarify their order and ensuring clarity by removing any ambiguity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Answer questions about which times certain events could have occurred.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  4.33it/s, est. speed input: 255.88 toks/s, output: 69.39 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result:  timeframes for specific events, providing examples to clarify ambiguity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Questions that involve enumerating objects and asking the model to count them.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.78it/s, est. speed input: 110.72 toks/s, output: 75.00 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: mpt by structuring it, providing specifics, removing ambiguity, adding an example, and preserving the original intent: \"Count the number of objects in the following list: [example list of objects].\"\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Clarify the meaning of sentences with ambiguous pronouns.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.12it/s, est. speed input: 184.31 toks/s, output: 71.85 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result:  with ambiguous pronouns by providing clear antecedents and adding examples to maintain the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A logical deduction task which requires deducing the order of a sequence of objects.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.93it/s, est. speed input: 187.61 toks/s, output: 73.28 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ce order of objects through logical reasoning, providing a structured explanation with specific examples to clarify any ambiguity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A logical deduction task which requires deducing the order of a sequence of objects.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.83it/s, est. speed input: 117.22 toks/s, output: 75.09 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: of a sequence of objects using logical reasoning. Provide a clear and concise explanation of your deduction process, and include an example of how to apply this reasoning to a specific sequence.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A logical deduction task which requires deducing the order of a sequence of objects.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.95it/s, est. speed input: 125.13 toks/s, output: 74.29 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ical deduction task by structuring it, providing specific examples, removing ambiguity, and adding context to deduce the order of a sequence of objects. Keep the original intent intact.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Answer questions about causal attribution.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:00<00:00,  1.25it/s, est. speed input: 67.33 toks/s, output: 76.06 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ions: structure, specifics, remove ambiguity, add example, keep intent. Answer questions about causal attribution. For example, \"What factors led to the increase in sales last quarter?\" or \"How did the new marketing campaign affect customer satisfaction?\" Provide detailed explanations and examples to clarify the causal relationships.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt:  Infer the date from context.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:01<00:00,  1.01s/it, est. speed input: 53.72 toks/s, output: 76.61 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: mpt by structuring it, adding specifics, removing ambiguity, and providing an example while keeping the original intent. \n",
+      "\n",
+      "Revised prompt:\n",
+      "Given a context, infer the date. For example, if the context is \"The Fourth of July\", the inferred date is July 4th, 2023 (assuming the current year is 2023).\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Select the humorous edit that 'ruins' the input movie or musical artist name.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.61it/s, est. speed input: 234.89 toks/s, output: 68.66 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: iest alteration that 'spoils' the original movie or artist name.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Sort a list of words.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  4.31it/s, est. speed input: 233.36 toks/s, output: 69.14 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: f words alphabetically, providing an example for clarity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Name geometric shapes from their SVG paths.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.89it/s, est. speed input: 217.98 toks/s, output: 70.06 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: c shapes by analyzing their SVG path data and provide examples for each shape.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Recommend movies similar to the given list of movies.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.25it/s, est. speed input: 188.59 toks/s, output: 71.53 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: with similar themes and styles to the given list of movies, providing specific examples for each recommendation.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Detect the type of error in an English translation of a German source sentence.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.12it/s, est. speed input: 133.76 toks/s, output: 74.31 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: r type in the English translation of a German source sentence by applying transformations such as restructuring, providing specific examples, removing ambiguity, and maintaining the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Distinguish deductively valid arguments from formal fallacies.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.60it/s, est. speed input: 153.49 toks/s, output: 72.84 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ely valid arguments and formal fallacies by structuring them, providing specific examples, removing ambiguity, and clarifying intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Answer questions about a table of penguins and their attributes.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.23it/s, est. speed input: 194.28 toks/s, output: 71.23 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: uestions about the attributes of penguins in a table, providing clear examples and removing any ambiguity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt:  Correctly close a Dyck-n word.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:01<00:00,  1.02s/it, est. speed input: 55.93 toks/s, output: 76.53 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: rrectly close a Dyck-n word\" prompt by structuring it, adding specifics, removing ambiguity, providing an example, and keeping the intent. Output the revised prompt: \"Given a Dyck-n word, identify the correct sequence of closing parentheses to ensure the word is balanced, and provide an example of a Dyck-3 word with its corresponding closing sequence.\"\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Solve multi-step arithmetic problems.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:00<00:00,  1.45it/s, est. speed input: 80.05 toks/s, output: 75.68 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: arithmetic problems by applying transformations: structure, specifics, remove ambiguity, add example, and keep intent. Provide a detailed solution for the following problem: 45 + 27 - 19 * 3 / 6.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Given a series of navigation instructions, determine whether one would end up back at the starting point.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.84it/s, est. speed input: 190.35 toks/s, output: 71.02 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: of navigation instructions, assess if following them would return to the initial location. Provide an example for clarity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Answer extremely simple questions about the colors of objects on a surface.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.52it/s, est. speed input: 215.12 toks/s, output: 70.53 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: stions about the colors of objects on a surface, providing specific examples and avoiding ambiguity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.08it/s, est. speed input: 152.07 toks/s, output: 72.91 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: al positions of a set of objects after applying a sequence of swaps, given their initial positions and a description of the swaps. Provide an example for clarity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:00<00:00,  1.23it/s, est. speed input: 90.08 toks/s, output: 75.27 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: k by structuring it as follows: Given a set of objects with initial positions and a sequence of swaps, determine their final positions. Include specifics like object labels and swap details. Remove any ambiguity in the description. Provide an example of the input and output format. Maintain the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.03it/s, est. speed input: 148.09 toks/s, output: 73.03 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: f identifying the final positions of a set of objects, starting from their initial positions, after executing a specified sequence of swaps. Provide an example for clarity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Determine whether an artificially constructed sentence relating to sports is plausible or not.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.23it/s, est. speed input: 140.36 toks/s, output: 73.52 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: sibility of a sports-related sentence created artificially, considering structure, specific details, removing ambiguity, and providing an example to maintain the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Determine which of two sentences is sarcastic.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.88it/s, est. speed input: 167.46 toks/s, output: 72.18 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: astic sentence by transforming it into a clear, specific format with an example, and remove any ambiguity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Evaluate the truth value of a random Boolean function expressed as a natural-language word problem.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.33it/s, est. speed input: 151.77 toks/s, output: 72.38 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: en natural-language word problem into a structured Boolean function, providing specific details, eliminating any ambiguity, and adding an example to clarify the intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Solve the math word problem, giving your answer as an arabic numeral.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.16it/s, est. speed input: 138.56 toks/s, output: 73.61 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: rd problem and provide the answer as a single arabic numeral, ensuring clarity and removing any ambiguity. Include a clear example to illustrate your solution.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Solve the math word problem\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.00it/s, est. speed input: 165.08 toks/s, output: 72.03 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: h word problem into a clear, specific, unambiguous question with an example, maintaining the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Please use your domain knowledge in medical area to solve the questions.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.43it/s, est. speed input: 148.56 toks/s, output: 73.06 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: cal expertise to address the questions by applying transformations: structure, specifics, remove ambiguity, add example, and maintain the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: In this task, you're given a pair of sentences, premise and hypothesis. Your job is to choose whether the two sentences clearly agree/disagree with each other, or if this cannot be determined.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.45it/s, est. speed input: 216.19 toks/s, output: 71.24 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: nd a hypothesis, determine if they clearly agree, disagree, or if it's unclear. Provide an example for each scenario.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Please perform Sentiment Classification task\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.01it/s, est. speed input: 110.46 toks/s, output: 74.31 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result:  Classification by analyzing the sentiment of a given text, providing a clear classification as positive, negative, or neutral. Example: \"I love this product!\" is positive.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: A question that is free of any grammatical or logical errors, should be labeled 'Yes.', otherwise it should be indicated as 'No.'. A question is grammatically correct if all its entities i.e. nouns, verbs, adjectives, prepositions, pronouns, adverbs are at appropriate position. A question is logically correct if the semantic makes sense.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.36it/s, est. speed input: 163.85 toks/s, output: 73.73 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: d 'Yes.' if free of grammatical and logical errors, 'No.' otherwise. Ensure correct entity positions: nouns, verbs, adjectives, prepositions, pronouns, adverbs. Semantic coherence is required for logical correctness. Provide an example.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: You are given a sentence and a question in the input. If the information provided in the sentence is enough to answer the question, label \"Yes.\", otherwise label \"No.\". Do not use any facts other than those provided in the sentence while labeling \"Yes.\" or \"No.\".\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:01<00:00,  1.03s/it, est. speed input: 101.95 toks/s, output: 75.74 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: and a question, determine if the sentence provides sufficient information to answer the question. If so, label \"Yes.\"; otherwise, label \"No.\". Utilize only the information provided in the sentence for labeling, and do not incorporate external knowledge. Example: Sentence: \"The cat is on the mat.\" Question: \"Is the cat indoors?\" Label: \"Yes.\"\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: In this task, you will be shown a short story with a beginning, two potential middles, and an ending. Your job is to choose the middle statement that makes the story coherent / plausible by writing \"1\" or \"2\" in the output. If both sentences are plausible, pick the one that makes most sense.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  1.05it/s, est. speed input: 119.65 toks/s, output: 75.57 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result:  will be given a short story with a beginning, two potential middles, and an ending. Your goal is to select the middle statement that creates a coherent and plausible narrative by writing \"1\" or \"2\" in the output. If both sentences are plausible, choose the one that best aligns with the story's intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Answer the following question: \n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.98it/s, est. speed input: 161.30 toks/s, output: 71.69 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: al of France? (Provide a specific example of a famous landmark in Paris to clarify the intent)\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Define if the sentence entails the question.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.88it/s, est. speed input: 161.29 toks/s, output: 72.00 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: sentence logically supports the question, using examples to clarify any ambiguity and restructure the sentence for clarity.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Summarize the following text\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  3.13it/s, est. speed input: 172.21 toks/s, output: 72.02 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ense the text, providing clear examples, removing any ambiguity, and maintaining the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Please perform Sentiment Classification task.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|██████████████████████████████| 1/1 [00:00<00:00,  1.73it/s, est. speed input: 95.20 toks/s, output: 74.43 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result:  Classification task by structuring the input, providing specific examples, removing ambiguity, and keeping the intent clear. Example: Classify the sentiment of the sentence \"I love this product!\" as positive.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Classify this sentence based on the provided categories.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.28it/s, est. speed input: 132.28 toks/s, output: 72.98 toks/s]\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: ence into the given categories by applying transformations such as restructuring, adding specifics, removing ambiguity, providing an example, and maintaining the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+      "prompt: Identify the most suitable category for this question.\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "Processed prompts: 100%|█████████████████████████████| 1/1 [00:00<00:00,  2.76it/s, est. speed input: 160.38 toks/s, output: 71.89 toks/s]"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "result: stion into a clear, specific category by rephrasing it and providing an example, while maintaining the original intent.\n",
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
+     ]
+    },
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "\n"
+     ]
+    }
+   ],
+   "source": [
+    "for prompt in prompts:\n",
+    "    print(f\"prompt: {prompt}\")\n",
+    "    print(f\"result: {pt.run(start_prompt=prompt)}\")\n",
+    "    print(\"%\" * 80)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "a122665b-fc42-4ce3-af3c-5e5b5d0f6e43",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3 (ipykernel)",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.12.9"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/requirements.txt b/requirements.txt
index 5383ff9..c5ab853 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,3 +8,6 @@ nltk==3.9.1
 supar==1.1.4
 rouge_score==0.1.2
 scikit-learn==1.6.1
+langchain==0.3.25
+langchain-community==0.3.24
+langchain-core==0.3.59


Reviews:
user: login: Mr-Cool-in-Git
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-06T13:11:48Z
user: login: Mr-Cool-in-Git
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-12T17:35:23Z
user: login: Mr-Cool-in-Git
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-13T12:00:53Z
user: login: samiaFife
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-14T08:25:49Z
user: login: Mr-Cool-in-Git
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-14T13:07:12Z
user: login: Mr-Cool-in-Git
body: Ставлю апрув
поправь эти комменты и мерджи
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-05-16T19:56:03Z
user: login: samiaFife
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-18T15:57:16Z

Review comments:
diff_hunk: @@ -1,7 +1,129 @@
-'''List of supported LLM Interface'''
+"""List of supported LLM Interface"""
+
+from typing import Any, Dict
+import requests
+import torch
+from transformers import AutoTokenizer, AutoModelForCausalLM
+from openai import OpenAI
+
+DEFAULTS = {
+    "model_name": "AnatoliiPotapov/T-lite-instruct-0.1",
+    "openai_model_name": "gpt-3.5-turbo",
+    "max_new_tokens": 100,
+    "temperature": 0.0,  # ? а какую ставить?
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: 0
created_at: 2025-05-06T11:49:15Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,129 @@
-'''List of supported LLM Interface'''
+"""List of supported LLM Interface"""
+
+from typing import Any, Dict
+import requests
+import torch
+from transformers import AutoTokenizer, AutoModelForCausalLM
+from openai import OpenAI
+
+DEFAULTS = {
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: перенести в utils
created_at: 2025-05-06T12:49:37Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,129 @@
-'''List of supported LLM Interface'''
+"""List of supported LLM Interface"""
+
+from typing import Any, Dict
+import requests
+import torch
+from transformers import AutoTokenizer, AutoModelForCausalLM
+from openai import OpenAI
+
+DEFAULTS = {
+    "model_name": "AnatoliiPotapov/T-lite-instruct-0.1",
+    "openai_model_name": "gpt-3.5-turbo",
+    "max_new_tokens": 100,
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: увеличить до 2000
created_at: 2025-05-06T12:50:11Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,30 @@
+import os
+from random import random
+
+import numpy as np
+import torch
+
+
+DEFAULT_MODEL_NAME = "t-tech/T-lite-it-1.0"
+DEFAULT_MODEL_PARAMETERS = {
+    "max_new_tokens": 4000,
+    "temperature": 0.5,
+}
+NAIVE_AUTOPROMPTING_PROMPT_TEMPLATE = (
+    "Rewrite the following prompt to maximize its effectiveness for LLMs.\n"
+    "Apply transformations: structure, specifics, remove ambiguity, add example, keep intent.\n"
+    "Only output the rewritten prompt, with no explanation or formatting.\n"
+    "\n"
+    "Prompt:\n"
+    "<PROMPT>\n"
+    "Rewritten prompt:\n"
+)
+
+
+def seed_everything(seed: int = 42):
+    random.seed(seed)
+    os.environ["PYTHONHASHSEED"] = str(seed)
+    # np.random.seed(seed)
path: coolprompt/utils/__init__.py
user: login: Mr-Cool-in-Git
body: это убрать
created_at: 2025-05-12T17:15:47Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,30 @@
+import os
+from random import random
+
+import numpy as np
+import torch
+
+
+DEFAULT_MODEL_NAME = "t-tech/T-lite-it-1.0"
path: coolprompt/utils/__init__.py
user: login: Mr-Cool-in-Git
body: DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS вынеси в отдельный файл скрипт default.py
NAIVE_AUTOPROMPTING_PROMPT_TEMPLATE в файл prompt_template.py
__init__.py надо удалить
created_at: 2025-05-12T17:18:23Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,31 @@
+from assistant import PromptHelper
+import json
+
+prompts = [
path: coolprompt/naive_test.py
user: login: Mr-Cool-in-Git
body: сделай пример в ноутбуке в папке notebooks/ вне coolprompt
created_at: 2025-05-12T17:19:21Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,59 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+import gc
+from typing import Any, Dict, Optional
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS, seed_everything
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine.
+
+    Attributes:
+        DEFAULT_MODEL_NAME (str): Name of the default model to use (from utils).
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: это не атрибуты класса, в доке их указывать не надо
created_at: 2025-05-12T17:22:00Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,59 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+import gc
+from typing import Any, Dict, Optional
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS, seed_everything
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine.
+
+    Attributes:
+        DEFAULT_MODEL_NAME (str): Name of the default model to use (from utils).
+        DEFAULT_MODEL_PARAMETERS (Dict[str, Any]): Default generation parameters.
+    """
+
+    @staticmethod
+    def init(params: Optional[Dict[str, Any]] = None) -> BaseLanguageModel:
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: актуализируй типизацию под python 3.12 
в питоне 3.12 typing не требуется
created_at: 2025-05-12T17:24:26Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,59 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+import gc
+from typing import Any, Dict, Optional
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS, seed_everything
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine.
+
+    Attributes:
+        DEFAULT_MODEL_NAME (str): Name of the default model to use (from utils).
+        DEFAULT_MODEL_PARAMETERS (Dict[str, Any]): Default generation parameters.
+    """
+
+    @staticmethod
+    def init(params: Optional[Dict[str, Any]] = None) -> BaseLanguageModel:
+        """Initialize the vLLM-powered LangChain LLM.
+
+        Args:
+            params (Optional[Dict[str, Any]], optional): Optional dictionary of parameters to override defaults.
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: нейминг заменить на config
created_at: 2025-05-12T17:24:48Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,59 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+import gc
+from typing import Any, Dict, Optional
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS, seed_everything
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine.
+
+    Attributes:
+        DEFAULT_MODEL_NAME (str): Name of the default model to use (from utils).
+        DEFAULT_MODEL_PARAMETERS (Dict[str, Any]): Default generation parameters.
+    """
+
+    @staticmethod
+    def init(params: Optional[Dict[str, Any]] = None) -> BaseLanguageModel:
+        """Initialize the vLLM-powered LangChain LLM.
+
+        Args:
+            params (Optional[Dict[str, Any]], optional): Optional dictionary of parameters to override defaults.
+
+        Returns:
+            BaseLanguageModel: Initialized LangChain-compatible language model instance.
+        """
+        seed_everything(42)
+        gc.collect()
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: не требуется
created_at: 2025-05-12T17:25:05Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,59 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+import gc
+from typing import Any, Dict, Optional
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS, seed_everything
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine.
+
+    Attributes:
+        DEFAULT_MODEL_NAME (str): Name of the default model to use (from utils).
+        DEFAULT_MODEL_PARAMETERS (Dict[str, Any]): Default generation parameters.
+    """
+
+    @staticmethod
+    def init(params: Optional[Dict[str, Any]] = None) -> BaseLanguageModel:
+        """Initialize the vLLM-powered LangChain LLM.
+
+        Args:
+            params (Optional[Dict[str, Any]], optional): Optional dictionary of parameters to override defaults.
+
+        Returns:
+            BaseLanguageModel: Initialized LangChain-compatible language model instance.
+        """
+        seed_everything(42)
+        gc.collect()
+        if torch.cuda.is_available:
+            torch.cuda.empty_cache()
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: тоже
created_at: 2025-05-12T17:25:15Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,59 @@
-'''List of supported LLM Interface'''
+"""LangChain-compatible LLM interface.
 
+Example:
+    >>> from language_model.llm import DefaultLLM
+    >>> llm = DefaultLLM.init()
+    >>> response = llm.invoke("Hello!")
+"""
 
-class BaseLLM:
-    '''Base LLM interface'''
-    def __init__(self):
-        pass
+import gc
+from typing import Any, Dict, Optional
+
+import torch
+from transformers import AutoTokenizer
+from langchain_community.llms import VLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import DEFAULT_MODEL_NAME, DEFAULT_MODEL_PARAMETERS, seed_everything
+
+
+class DefaultLLM:
+    """Default LangChain-compatible LLM using vLLM engine.
+
+    Attributes:
+        DEFAULT_MODEL_NAME (str): Name of the default model to use (from utils).
+        DEFAULT_MODEL_PARAMETERS (Dict[str, Any]): Default generation parameters.
+    """
+
+    @staticmethod
+    def init(params: Optional[Dict[str, Any]] = None) -> BaseLanguageModel:
+        """Initialize the vLLM-powered LangChain LLM.
+
+        Args:
+            params (Optional[Dict[str, Any]], optional): Optional dictionary of parameters to override defaults.
+
+        Returns:
+            BaseLanguageModel: Initialized LangChain-compatible language model instance.
+        """
+        seed_everything(42)
+        gc.collect()
+        if torch.cuda.is_available:
+            torch.cuda.empty_cache()
+
+        generation_params = DEFAULT_MODEL_PARAMETERS.copy()
+        if params is not None:
+            generation_params.update(params)
+
+        try:
+            tokenizer = AutoTokenizer.from_pretrained(DEFAULT_MODEL_NAME, padding_side="left")
+            terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("
")]
+            return VLLM(
+                model=DEFAULT_MODEL_NAME,
+                trust_remote_code=True,
+                max_new_tokens=generation_params["max_new_tokens"],
+                temperature=generation_params["temperature"],
+                stop_token_ids=terminators,
+                torch_dtype=torch.float16,  # * взял из конфига для проведения экспериментов
+            )
+        except Exception as e:
+            print(f"Failed to load default model: {e}")
+            raise
path: coolprompt/language_model/llm.py
user: login: Mr-Cool-in-Git
body: не рекомендуется использовать raise явно
и тут лучше try except убрать
created_at: 2025-05-12T17:28:59Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import NAIVE_AUTOPROMPTING_PROMPT_TEMPLATE
+
+
 class PromptHelper:
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: Давай сменим нейминг на Prompter или PromptTuner
created_at: 2025-05-12T17:33:31Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from utils import NAIVE_AUTOPROMPTING_PROMPT_TEMPLATE
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: from coolprompt.utils.prompt_template import NAIVE_AUTOPROMPTING_PROMPT_TEMPLATE
created_at: 2025-05-12T17:33:56Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,30 @@
+import os
+from random import random
+
+import numpy as np
+import torch
+
+
+DEFAULT_MODEL_NAME = "t-tech/T-lite-it-1.0"
+DEFAULT_MODEL_PARAMETERS = {
+    "max_new_tokens": 4000,
+    "temperature": 0.5,
+}
+NAIVE_AUTOPROMPTING_PROMPT_TEMPLATE = (
path: coolprompt/utils/__init__.py
user: login: Mr-Cool-in-Git
body: лучше naive_prompt_template
created_at: 2025-05-12T17:35:19Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.prompt_template import NAIVE_PROMPT_TEMPLATE
+
+
+class PromptTuner:
+    """Docstring"""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Docstring
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: langchain_core.language_models.base.BaseLanguageModel
+            #config: dict
+            #token: str = None
+            #interface: str - [hf, ollama, openapi]
+        """
+        # token = ...
+        # config = ...
+        self._model = model if model is not None else DefaultLLM.init()
 
-    def invoke(self, ):
-        '''Docstring
+    def invoke(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None) -> str:
+        """Docstring
 
         Args:
             start_prompt: str
             dataset: pd.DataFrame
             target: str
         Returns:
             final_prompt: str
-        '''
-        pass
+        """
+        if dataset is None:
+            return self._naive_autoprompting(start_prompt)
+
+    def _naive_autoprompting(self, prompt: str) -> str:
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: вынести в optimizers в naive.py
created_at: 2025-05-13T11:58:26Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.prompt_template import NAIVE_PROMPT_TEMPLATE
+
+
+class PromptTuner:
+    """Docstring"""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Docstring
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: langchain_core.language_models.base.BaseLanguageModel
+            #config: dict
+            #token: str = None
+            #interface: str - [hf, ollama, openapi]
+        """
+        # token = ...
+        # config = ...
+        self._model = model if model is not None else DefaultLLM.init()
 
-    def invoke(self, ):
-        '''Docstring
+    def invoke(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None) -> str:
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: переименовать на run
created_at: 2025-05-13T11:58:46Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.prompt_template import NAIVE_PROMPT_TEMPLATE
+
+
+class PromptTuner:
+    """Docstring"""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Docstring
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: langchain_core.language_models.base.BaseLanguageModel
+            #config: dict
+            #token: str = None
+            #interface: str - [hf, ollama, openapi]
+        """
+        # token = ...
+        # config = ...
+        self._model = model if model is not None else DefaultLLM.init()
 
-    def invoke(self, ):
-        '''Docstring
+    def invoke(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None) -> str:
+        """Docstring
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: в аргументах должен стоять флаг method: str = None

далее по функции делается проверка на наличие method
если отсутствует, вызываем наивный оптимизатор
created_at: 2025-05-13T12:00:13Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.prompt_template import NAIVE_PROMPT_TEMPLATE
+
+
+class PromptTuner:
+    """Docstring"""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Docstring
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: langchain_core.language_models.base.BaseLanguageModel
+            #config: dict
+            #token: str = None
+            #interface: str - [hf, ollama, openapi]
+        """
+        # token = ...
+        # config = ...
+        self._model = model if model is not None else DefaultLLM.init()
 
-    def invoke(self, ):
-        '''Docstring
+    def invoke(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None) -> str:
+        """Docstring
 
         Args:
             start_prompt: str
             dataset: pd.DataFrame
             target: str
         Returns:
             final_prompt: str
-        '''
-        pass
+        """
+        if dataset is None:
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: dataset is None or method is None
created_at: 2025-05-13T12:00:49Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.utils.prompt_template import NAIVE_PROMPT_TEMPLATE
+
+
+class PromptTuner:
+    """Docstring"""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Docstring
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: langchain_core.language_models.base.BaseLanguageModel
+            #config: dict
+            #token: str = None
+            #interface: str - [hf, ollama, openapi]
+        """
+        # token = ...
+        # config = ...
+        self._model = model if model is not None else DefaultLLM.init()
 
-    def invoke(self, ):
-        '''Docstring
+    def invoke(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None) -> str:
+        """Docstring
path: coolprompt/assistant.py
user: login: samiaFife
body: выходит, в _naive_optimizer можно так же передать dataset, чтобы, к примеру, оценить выход на тесте?
created_at: 2025-05-14T08:25:49Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,30 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.optimizer.naive import naive_optimizer
+
+
+class PromptTuner:
+    """Docstring"""
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: Вместо Docstring Добавь краткое описание класса/метода/функции
created_at: 2025-05-14T13:06:46Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from coolprompt.language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.optimizer.naive import naive_optimizer
+
+
+class PromptTuner:
+    """Prompt optimization tool supporting multiple methods."""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Initializes the tuner with a LangChain-compatible language model.
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: Any LangChain BaseLanguageModel instance which supports invoke(str) -> str. Will use DefaultLLM if not provided.
+        """
+        self._model = model or DefaultLLM.init()
+        self._validate_model()
 
-    def invoke(self, ):
-        '''Docstring
+    def run(self, start_prompt: str, dataset: pd.DataFrame = None, target: str = None, method: str = None) -> str:
+        """Optimizes prompts using provided model.
 
         Args:
-            start_prompt: str
-            dataset: pd.DataFrame
-            target: str
+            start_prompt: Initial prompt text to optimize.
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: оформление докстрингов следующее var: dtype - description
например: start_prompt: str - Initial prompt text to optimize.

переделай там с другими аргументами
created_at: 2025-05-16T19:51:20Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from coolprompt.language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.optimizer.naive import naive_optimizer
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: по гугл стайл коду собственные модули ставятся в самый низ
в твоем случае это coolprompt модули
created_at: 2025-05-16T19:51:58Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from coolprompt.language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.optimizer.naive import naive_optimizer
+
+
+class PromptTuner:
+    """Prompt optimization tool supporting multiple methods."""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Initializes the tuner with a LangChain-compatible language model.
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: Any LangChain BaseLanguageModel instance which supports invoke(str) -> str. Will use DefaultLLM if not provided.
+        """
+        self._model = model or DefaultLLM.init()
path: coolprompt/assistant.py
user: login: Mr-Cool-in-Git
body: это разве вернет модель? кажется что булевское выражение или я ошибаюсь, ты тестировал?
created_at: 2025-05-16T19:53:08Z
author_association: COLLABORATOR
diff_hunk: @@ -1,27 +1,39 @@
-class PromptHelper:
-    '''Docstring'''
-    def __init__(self):
-        '''Docstring
+import pandas as pd
+from coolprompt.language_model.llm import DefaultLLM
+from langchain_core.language_models.base import BaseLanguageModel
+from coolprompt.optimizer.naive import naive_optimizer
+
+
+class PromptTuner:
+    """Prompt optimization tool supporting multiple methods."""
+
+    def __init__(self, model: BaseLanguageModel = None):
+        """Initializes the tuner with a LangChain-compatible language model.
 
         Args:
-            model_name: str
-            config: dict
-            token: str = None
-            interface: str - [hf, ollama, openapi]
-        '''
-        token = ...
-        config = ...
-        model = ...
-        pass
+            model: Any LangChain BaseLanguageModel instance which supports invoke(str) -> str. Will use DefaultLLM if not provided.
+        """
+        self._model = model or DefaultLLM.init()
path: coolprompt/assistant.py
user: login: samiaFife
body: судя по всему, or возвращает первый операнд, если он истинен, иначе второй
https://docs.python.org/3.12/library/stdtypes.html#boolean-operations-and-or-not
created_at: 2025-05-18T15:57:16Z
author_association: COLLABORATOR

PR comments:
user: login: samiaFife
created_at: 2025-05-12T16:40:13Z
body: Добавил наивный автопромптинг и дефолтную langchain модель. Переписал с HF на vLLM. Протестить пока не успел. Добавил небольшой тест для демонстрации результатов в naive_test (пара моих промптов + промпты из basic_prompts). 

https://coolprompt.kaiten.ru/space/496185/boards/card/49441886
author_association: COLLABORATOR
user: login: samiaFife
created_at: 2025-05-14T15:34:17Z
body: обновил PR: добавил дефолтные параметры обертки langchain vllm (n, best_of), т.к. при invoke возвращалось полотно из output'ов, сейчас все еще возвращается, но для единственного промпта из ноутбука-примера, возможно это из-за того, что он на русском. Также есть разница между параметрами обычного vllm и langchain обертки, первые передаются во вторую как vllm_kwargs, но тут следует быть осторожным. Я думаю, следовало бы аккуратнее оформить передачу config в DefaultLLM.init() и, возможно, generation_args - дефолтные параметры обертки.
author_association: COLLABORATOR