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.4.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.4-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: promptfletcher-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 cc3447e71f738e43650481f8abcfe10ba6038b6e7468b013a40f443aac145a7c
MD5 63d00290352c9096aa9aa1152eefa076
BLAKE2b-256 85bf62818bfdab3e6707567f0fae4accf37126835bcf004392d7594e5aa11976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: promptfletcher-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 639711ea3fe7636d12de019081f8ea9ac324cea1f705b171408b24cf22cd4699
MD5 a3755ac7481d228bd713f08be86dd2fe
BLAKE2b-256 af472cb10f700ddc7086fc994a48df15905144abe07dbfce15b3822d4491323f

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