Metadata-Version: 2.4
Name: promptrefiner
Version: 1.0.0
Summary: A Python library and CLI tool for refining prompts using various enhancement strategies.
Project-URL: Homepage, https://darshit7.github.io/promptrefiner/
Project-URL: Repository, https://github.com/darshit7/promptrefiner
Author-email: Darshit Patoliya <darshit7@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Darshit
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: litellm>=1.0.0
Requires-Dist: openai>=1.64.0
Requires-Dist: rich-click>=1.8.6
Description-Content-Type: text/markdown

<div align="center">
  <img src="./docs/assets/logo.png" alt="promptrefiner Logo" width="200">
  
  # Promptrefiner 🚀  
  **Enhancing prompts with intelligent strategies for LLMs**  

  [![PyPI Version](https://img.shields.io/pypi/v/promptrefiner)](https://pypi.org/project/promptrefiner/)
  [![GitHub Repo](https://img.shields.io/badge/GitHub-Code-black?logo=github)](https://github.com/darshit7/promptrefiner)
  [![License](https://img.shields.io/github/license/darshit7/promptrefiner)](https://darshit7.github.io/promptrefiner/LICENSE)
  [![Docs](https://img.shields.io/badge/docs-Promptrefiner-blue)](https://darshit7.github.io/promptrefiner/)
</div>

## 🚀 Welcome to Promptrefiner

> **Helping you craft the perfect prompt for better LLM responses!**

PromptRefiner is a lightweight **Python library** that helps users **write better prompts** for Large Language Models (LLMs) with minimal configurations. Many users struggle to craft effective prompts that yield the desired results.  

PromptRefiner **takes user input**, applies a **selected strategy**, and **returns an improved prompt** to get **more specific and effective responses from LLMs (Large Language Models).** It achieves this by leveraging an **LLM to refine the user’s prompt** based on predefined strategies, making it easier to get high-quality responses.

Whether you're using a prompt for **GPT-4, Claude, Mistral, or any other LLM**, PromptRefiner ensures **your input is well-structured** for the best possible output.

---

## ✨ Key Features

✅ **Supports 100+ LLM Clients** – Works with OpenAI, Anthropic, Hugging Face, and more!  
✅ **Highly Customizable** – Use different LLM clients per strategy or a single client for all.  
✅ **Command-Line First** – Quickly refine prompts from the CLI for rapid experimentation.  
✅ **Extensible** – Developers can create their own **custom prompt refinement strategies**.  
✅ **Seamless Integration** – Works effortlessly in Python applications or scripts.  

---

## 📥 Installation

Install PromptRefiner using pip:

```sh
pip install promptrefiner
```

---

## ⚡ Quick Start

### 🔧 **Using from the Command Line**

Before using `promptrefiner` in Python, make sure to **set environment variables** (Windows users should use set instead of export):  

```sh
export PREFINER_API_KEY="your-api-key-here"
export PREFINER_MODEL="openai/gpt-4"  # Change based on your LLM model
```

and there you go...  

```sh
promptrefiner --strategy fewshot "Tell me about AI"
```

### 🐍 **Using in a Python Script**

> Make sure to **set environment variables** `PREFINER_API_KEY` and `PREFINER_MODEL` before using `PromptRefiner` in your python script.

```python
from promptrefiner import PromptRefiner

prompt_refiner = PromptRefiner(strategies=["persona"])
refined_prompt = prompt_refiner.refine("Explain quantum mechanics.")
print(refined_prompt)
```

### ❓ Help Section of `promptrefiner`
Access available list of strategies, it's alias and all required help thorugh `--help` option.

```bash
(env) $promptrefiner --help
```
![PromptRefiner Help](./docs/assets/pr_help.jpg)
---

## 🔍 How It Works

1. **User provides a prompt** (e.g., "Tell me about AI").
2. **Selects a strategy** (e.g., "verbose" for a more detailed response).
3. **PromptRefiner applies a system prompt template** for that strategy.
4. **Sends it to an LLM** for refinement.
5. **Returns the improved prompt** back to the user.

🚀 **Under the hood:** Each strategy is backed by a system prompt template that guides the LLM to refine the user’s input for better results.

---

## 🤔 Why Use PromptRefiner?

🔹 **Improve prompt clarity & effectiveness** – Get sharper, more relevant responses.  
🔹 **Save time** – No need to manually tweak prompts for better results.  
🔹 **Optimized for developers & researchers** – Quickly test different prompting strategies.  
🔹 **Fine-tune for different LLMs** – Customize strategies for specific AI models.  
🔹 **Works for various use cases:**  

- Chatbots & AI assistants
- Content generation & summarization
- Data extraction from LLMs
- Code generation improvements

---

## 🚀 Join Us & Contribute!

We welcome **contributors, feedback, and feature suggestions!** 🚀

📌 **GitHub Repo**: [darshit7/promptrefiner](https://github.com/darshit7/promptrefiner)  
📌 **Documentation**: [Promptrefiner](https://darshit7.github.io/promptrefiner/)  
📌 **Report Issues & Ideas**: [Coming Soon](#)

👥 **Want to improve PromptRefiner?** Open a GitHub issue or contribute a pull request! 🛠️

---

🚀 **Refine your prompts. Supercharge your AI interactions. Try PromptRefiner today!**