A Python library for auto-prompt engineering and optimization for LLMs.
Project description
PromptFletcher 🚀
A Python library for auto-prompt engineering and optimization for LLMs.
PromptFletcher is a lightweight and fast Python library designed for:
Refining & optimizing prompts using NLTK-based NLP techniques
Context-aware prompt tuning for better responses
Heuristic-based evaluation to rank prompts
Fast execution without large transformer models
Installation
From PyPI
pip install promptfletcher
From GitHub
pip install git+https://github.com/Vikhram-S/PromptFletcher.git
Quick Start
Import & Initialize
from promptfletcher import AutoPromptEngineer
engineer = AutoPromptEngineer()
Define Context & Prompt
context = "We are exploring ways to enhance prompt engineering for LLMs."
initial_prompt = "How can I improve my AI-generated responses?"
Optimize the Prompt
refined_prompt = engineer.refine_prompt(initial_prompt, context)
print("Refined Prompt:", refined_prompt)
Features
Automated Prompt Refinement – Uses NLP techniques to improve prompt clarity.
LLM Response Evaluation – Integrates with open-source models like GPT-Neo & BLOOM.
Contextual Understanding – Ensures prompts align with relevant topics.
Lightweight & Fast – Minimal dependencies, designed for efficiency.
API Reference
AutoPromptEngineer Class
refine_prompt(prompt: str, context: str, iterations: int = 3) -> str
Refines a given prompt based on context and heuristic scoring.
engineer.refine_prompt("How do I make my AI-generated text more accurate?", "LLM optimization")
evaluate_prompt(prompt: str, context: str) -> float
Assigns a heuristic score to a prompt based on clarity and relevance.
score = engineer.evaluate_prompt("Tell me about AI safety?", "Machine Learning Ethics")
print("Prompt Score:", score)
📦 Dependencies
nltk>=3.6.0numpy>=1.21.0regex>=2023.3.23
Install dependencies manually:
pip install -r requirements.txt
License
PromptFletcher is licensed under the MIT License – free to use, modify, and distribute.
Contributing
We welcome contributions!
- Fork the repository
- Create a feature branch (
git checkout -b feature-new) - Commit changes & push (
git push origin feature-new) - Open a Pull Request
Contact & Support
- GitHub Issues: Report Bugs
- Email: vikhrams@saveetha.ac.in
If you find this useful, give us a star on GitHub!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptfletcher-0.1.1.tar.gz.
File metadata
- Download URL: promptfletcher-0.1.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05096e323f9a6ad19201d3566b88be4e0717917bdd038b253acaf6067a6fbd6f
|
|
| MD5 |
53b812421475e71e5eb54b0f4fe7ccf9
|
|
| BLAKE2b-256 |
2775f24a1f76ce675d81dd99b025246d0cc4696c8e6c73f36890d1fbbbf655cf
|
File details
Details for the file promptfletcher-0.1.1-py3-none-any.whl.
File metadata
- Download URL: promptfletcher-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75b2c825e1cfb4747e825fd87acf549ca411ffaf8faf6028c71d848b1d013868
|
|
| MD5 |
a737bdc750cf32661908bdb9af3e6c1a
|
|
| BLAKE2b-256 |
1cde76e9f3a303b72f9fdfe58a289d12c745f6c0784ef654b26171366eaf4952
|