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


What is PromptFletcher?

PromptFletcher is a lightweight and powerful Python library designed for:
Refining & optimizing prompts for LLMs
Context-aware prompt tuning for better responses
Heuristic-based evaluation to rank prompts
Integrating with open-source LLMs (GPT-Neo, GPT-J, BLOOM)


Installation

From PyPI (Coming Soon)

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

  • transformers>=4.30.0
  • torch>=2.0.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.0.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.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: promptfletcher-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 86d96a2debc7e9cc07820031df04412c0cbf17c9b4aab0a4cb86cd20aea75788
MD5 3ef0fdd07306a1f45f3dcd52724c13a7
BLAKE2b-256 1c0a471e82f28ac37e25d8b2667e6907ede48f23225a1312254555e49d501a92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: promptfletcher-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cbf718acf5e3b811bbdc08417980296909d109298d1dd7e67c4433040093553
MD5 bc218ebcb18d2279946ee53e70193d61
BLAKE2b-256 2378a673663801a266db874cb5306e29ee61f0ba4954049674b8aa4fd10e7bfd

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