Skip to main content

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.

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


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.0
  • numpy>=1.21.0
  • regex>=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!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature-new)
  3. Commit changes & push (git push origin feature-new)
  4. Open a Pull Request

Contact & Support

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

promptfletcher-0.1.3.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptfletcher-0.1.3-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file promptfletcher-0.1.3.tar.gz.

File metadata

  • Download URL: promptfletcher-0.1.3.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

Hashes for promptfletcher-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2c5101be8af3e66763f9b3ae782cda5a5779c1d0db07e4cf413fb6f3ac101683
MD5 2edd7e5cbde2cb4ead0430aed31fea74
BLAKE2b-256 31f36377094995c75435b623ab521cbeb5fe609dc3312039c74b4b3f03fc8f6d

See more details on using hashes here.

File details

Details for the file promptfletcher-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: promptfletcher-0.1.3-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

Hashes for promptfletcher-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2bf41b4ed9a15e01cff9e298ac8f09e8dc54cc38f88191dbc25419ac54c6095d
MD5 47950bedd297656f756de2da75e04ec9
BLAKE2b-256 3886f9bcfc74fd99cd60832f8a9ccdef026f6f2cd9be7b2740e9a1ab229609e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page