Skip to main content

A prompt engineering toolkit for LLMs

Project description

arhupy

PyPI version Python versions License GitHub stars

A lightweight prompt engineering toolkit for LLMs

arhupy helps you create, fill, chain, save, version, and estimate prompts for LLMs like Claude, GPT, and Gemini. It is small by design and uses only the Python standard library.

Installation

Install from PyPI:

pip install arhupy

Install from source:

git clone https://github.com/Typeshi-dotcom/arhupy.git
cd arhupy
pip install -e .

Quick Start

from arhupy import Prompt

prompt = Prompt("You are a {role}. Speak in {language}.")
print(prompt.fill(role="teacher", language="English"))

Features

  • Fill prompt templates with named placeholders
  • Chain multiple prompts into one final prompt
  • Save and load prompt templates from a local JSON library
  • Export and import prompts or prompt chains as shareable JSON files
  • Estimate token counts with a simple standard-library helper
  • Score prompts and get simple feedback from local heuristics
  • Compare prompts and see scoring differences from the CLI
  • Improve prompts with Claude through a simple command
  • Launch a local web dashboard for scoring and comparison
  • Track prompt template versions with notes
  • No external dependencies

CLI Usage

Show available commands:

arhupy --help

Score a prompt:

arhupy score "You are a fitness coach"

Compare two prompts:

arhupy diff "You are a coach" "You are a strict fitness coach"

Improve a prompt:

arhupy improve "You are a coach" --api-key YOUR_KEY

Save, list, export, and import prompts:

arhupy save my_prompt "You are a coach"
arhupy list
arhupy export prompts.json
arhupy import prompts.json

Start the local web dashboard:

arhupy web

Examples

Prompt

from arhupy import Prompt

prompt = Prompt("You are a {role}. Speak in {language}.")
filled = prompt.fill(role="coding assistant", language="English")

print(filled)
prompt.preview()
prompt.reset()

PromptChain

from arhupy import Prompt, PromptChain

system = Prompt("System: {instruction}")
user = Prompt("User: {task}")

system.fill(instruction="Be concise and practical.")
user.fill(task="Explain prompt chaining.")

chain = PromptChain([system, user])
print(chain.build())

Library Save And Load

from arhupy import Prompt, load, save

prompt = Prompt("Summarize this in {style}: {text}")
save("summarizer", prompt)

loaded = load("summarizer")
print(loaded.fill(style="plain English", text="Prompt engineering is useful."))

Saved prompts are stored in arhupy_library.json in your current working directory.

Token Estimation

from arhupy import estimate_tokens

tokens = estimate_tokens("A short prompt for an LLM.")
print(tokens)

Prompt Scoring

arhupy score "You are a fitness coach"

Prompt Comparison

arhupy diff "You are a fitness coach" "You are a helpful assistant"

Web Dashboard

arhupy web

This starts a local dashboard at http://localhost:8000.

Saving and Sharing Prompts

arhupy save my_prompt "You are a coach"
arhupy export prompts.json
arhupy import prompts.json
arhupy list

AI Prompt Improvement

arhupy improve "You are a coach" --api-key YOUR_KEY

Use a real Claude API key for live AI improvement. The YOUR_KEY placeholder runs a local demo improvement so the command can be tested safely.

Claude Integration

from arhupy import Prompt, ClaudeClient

client = ClaudeClient(api_key="your-api-key")

prompt = Prompt("You are a {role}. Answer this: {question}")
response = client.ask_with_template(prompt, role="fitness coach", question="What is progressive overload?")
print(response)

Export and Import

Save a prompt to JSON:

from arhupy import Prompt, export_prompt

prompt = Prompt("Write a {tone} email about {topic}.")
prompt.fill(tone="friendly", topic="a project update")

export_prompt(prompt, "email_prompt.json")

Load a prompt from JSON:

from arhupy import import_prompt

prompt = import_prompt("email_prompt.json")
print(prompt)

Save a prompt chain to JSON:

from arhupy import Prompt, PromptChain, export_chain

system = Prompt("System: {instruction}")
user = Prompt("User: {request}")
system.fill(instruction="Be concise.")
user.fill(request="Summarize this report.")

chain = PromptChain([system, user])
export_chain(chain, "summary_chain.json")

Load a prompt chain from JSON:

from arhupy import import_chain

chain = import_chain("summary_chain.json")
print(chain.build())

Contributing

Contributions are welcome. See CONTRIBUTING.md for setup instructions, test commands, and pull request guidance.

License

This project is licensed under the MIT License. See LICENSE for details.

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

arhupy-1.0.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

arhupy-1.0.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file arhupy-1.0.0.tar.gz.

File metadata

  • Download URL: arhupy-1.0.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for arhupy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7042b754a9ede67d76f545fe2f607afd55e494cf0f1d94d6af70e9ff973e7baa
MD5 65b82ac27f03d63af80df0954ebdf3ff
BLAKE2b-256 dc5b7e4dc1aa83c515cdd9a44bf6c6eade74ed66b2d7ccb89104bfa23cd16511

See more details on using hashes here.

File details

Details for the file arhupy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: arhupy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for arhupy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6f66a2a118aa3c3f8615124f0bd72dc57f2e76a0921b869b132e354dd3a0598
MD5 c1f20a3ba503c7affcad06a106529c59
BLAKE2b-256 2728553e6a9893422f4d7ed5c9f07fb01dc762b86573626d59cc8c954df87571

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