PromptFletcher is a lightweight, deterministic auto-prompt engineering library for NLP and LLM workflows.
Project description
PromptFletcher 🚀
Deterministic Auto-Prompt Engineering for Python & NLP
Overview
PromptFletcher is a lightweight, deterministic, and dependency-minimal Python library for automatic prompt refinement using classical NLP heuristics.
Unlike LLM-based prompt optimizers, PromptFletcher:
- Does not require external APIs
- Does not use large transformer models
- Works offline
- Produces reproducible results
- Is fast enough for CI, batch jobs, and research pipelines
It is ideal for developers, researchers, and teams who want structured prompt improvement without LLM overhead.
Key Capabilities
- Heuristic-based prompt evaluation
- Iterative prompt refinement
- Context-aware relevance scoring
- Fast execution using NLTK
- Deterministic and reproducible behavior
- Minimal runtime footprint
Installation
Install from PyPI (recommended)
pip install promptfletcher
Install from GitHub (latest)
pip install git+https://github.com/Vikhram-S/PromptFletcher.git
On first use, required NLTK resources are downloaded automatically.
Quick Start
Initialize the Engine
from promptfletcher import AutoPromptEngineer
engineer = AutoPromptEngineer()
Define Context and Prompt
context = "We are optimizing prompt quality for large language models." prompt = "How improve AI responses"
Refine the Prompt
refined = engineer.refine_prompt(prompt, context) print(refined)
Example output:
How improve AI responses? Please explain in detail.
How It Works
PromptFletcher applies classical NLP heuristics to evaluate and refine prompts:
| Heuristic | Description |
|---|---|
| Length | Penalizes prompts that are too short or too verbose |
| Clarity | Rewards explicit questions |
| Relevance | Measures keyword overlap with context |
| Iteration | Keeps only prompt improvements |
This design makes the system predictable, explainable, and easy to debug.
API Reference
AutoPromptEngineer
refine_prompt(prompt: str, context: str, iterations: int = 3) -> str
Refines a prompt iteratively using heuristic scoring.
evaluate_prompt(prompt: str, context: str) -> float
Returns a numeric quality score for a prompt.
Use Cases
- Prompt standardization in teams
- Automated prompt cleanup pipelines
- Prompt benchmarking
- Research experiments
- CI validation of prompts
- Offline prompt tuning
- Educational NLP projects
Dependencies
PromptFletcher keeps dependencies intentionally minimal:
- nltk >= 3.6
- numpy >= 1.21
- regex >= 2023.3.23
License
PromptFletcher is released under the MIT License.
You are free to use, modify, and distribute this software.
Contributing
Contributions are welcome.
Workflow:
- Fork the repository
- Create a branch (feature/your-feature)
- Commit your changes
- Push and open a Pull Request
Please ensure code is typed, documented, and non-breaking.
Support and Contact
Issues: https://github.com/Vikhram-S/PromptFletcher/issues
Email: vikhrams@saveetha.ac.in
Support the Project
If PromptFletcher helps you:
- Star the repository
- Use it in your projects
- Share it with others
Your support helps grow the project.
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.2.0.tar.gz.
File metadata
- Download URL: promptfletcher-0.2.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa0b6766d8ec68ee49c572198b2b5bc70674e3815cb3be502a157e2a457ac196
|
|
| MD5 |
51e2645f7e9415c529abb394016181fe
|
|
| BLAKE2b-256 |
3ed0557344fdb3342e3ca5e225960542ed78bd0549414ed6c097e4583d8926a7
|
File details
Details for the file promptfletcher-0.2.0-py3-none-any.whl.
File metadata
- Download URL: promptfletcher-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bcec72428d55d480cfbc3bc2c4114f3547465d5ec70eabcf604ffe708b9fa3f
|
|
| MD5 |
9f71bf1875bc996d2500805cdba6247c
|
|
| BLAKE2b-256 |
7f2deaa0eeca2d6be06d7a9757d86bdc097a2abad1d6ad8beda2a24e37d8c649
|