Skip to main content

PromptFletcher 🚀

Deterministic Auto-Prompt Engineering for Python & NLP

PyPI - Python Version PyPI - License PyPI PyPI - Status PyPI - Monthly Downloads Total Downloads


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:

  1. Fork the repository
  2. Create a branch (feature/your-feature)
  3. Commit your changes
  4. 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)

Source distribution for promptfletcher 0.2.0
File Size Uploaded
promptfletcher-0.2.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for promptfletcher 0.2.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page