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.
Metadata
Release files for promptfletcher 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| promptfletcher-0.2.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptfletcher-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / promptfletcher-0.2.0.tar.gz
| Download URL | promptfletcher-0.2.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa0b6766d8ec68ee49c572198b2b5bc70674e3815cb3be502a157e2a457ac196
|
|
BLAKE2b-256 checksum How to use checksums |
3ed0557344fdb3342e3ca5e225960542ed78bd0549414ed6c097e4583d8926a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / promptfletcher-0.2.0-py3-none-any.whl
| Download URL | promptfletcher-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bcec72428d55d480cfbc3bc2c4114f3547465d5ec70eabcf604ffe708b9fa3f
|
|
BLAKE2b-256 checksum How to use checksums |
7f2deaa0eeca2d6be06d7a9757d86bdc097a2abad1d6ad8beda2a24e37d8c649
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|