Skip to main content

A Python package for building effective chat prompts from vague user ideas.

Project description

prompt-recipe-smith

PyPI GitHub Open In Colab Python Tests

prompt-recipe-smith is a small Python package for building effective chat prompts from vague user ideas.

It is designed for people who may not know AI, software, or prompt engineering terms. The package helps turn a rough thought into a clearer prompt by applying a reusable prompt-building procedure.

PromptTemplate vs PromptRecipe

A PromptTemplate is a fixed prompt form with variables:

from prompt_recipe_smith import PromptTemplate

template = PromptTemplate("Explain {topic} for a beginner.")
print(template.render({"topic": "email security"}))

A PromptRecipe is more than a template. It can include steps, defaults, examples, clarification ideas, and up to three simple branches. A PromptBuilder applies the recipe to a user's rough input and returns a PromptResult.

Installation

Install from PyPI:

uv add prompt-recipe-smith

Minimal Example

The command-line app asks three clarification questions, then prints the final prompt for the chat agent:

prompt-recipe-smith I want to plan a small workshop

One-shot Builder

from prompt_recipe_smith import PromptBuilder
from prompt_recipe_smith.output import to_json, to_plain_text
from prompt_recipe_smith.recipes import clarify_idea_recipe

recipe = clarify_idea_recipe()
result = PromptBuilder().build(recipe, "I want to write a polite follow-up email")

print(to_plain_text(result))
print(to_json(result))

Plain Text Output

Help me turn this writing idea into a clear request:
I want to write a polite follow-up email

Ask up to three plain-language clarification questions, then draft an improved prompt.

Layered Questions

Use PromptSessionRunner when you want the same three-question flow in Python:

The built-in clarification questions are written in English, but users can answer them in any language. The CLI, API, and JSON output preserve Unicode text such as Japanese, Chinese, French, and Arabic.

from prompt_recipe_smith import PromptBuilder
from prompt_recipe_smith.recipes import clarify_idea_recipe
from prompt_recipe_smith.session import PromptSessionRunner

runner = PromptSessionRunner(
    recipe=clarify_idea_recipe(),
    builder=PromptBuilder(),
)
session = runner.start("I want to plan a small workshop")

session = runner.answer(session, "A one-day facilitation agenda")
session = runner.answer(session, "First-time team leads")
session = runner.answer(session, "Keep it practical and under six hours")

result = runner.finish(session)
print(result.prompt)

Keyword Matching

Branch keywords are internal hints used to select a simple recipe path such as writing, learning, or planning. The built-in keyword data is defined in src/prompt_recipe_smith/recipes/builtin.py, and the matching logic is handled by src/prompt_recipe_smith/models.py.

Notebook Demo

Open In Colab

A Google Colab-friendly demo notebook is available at examples/prompt_recipe_smith_colab_demo.ipynb. It shows installation, one-shot prompt building, the three-question layered flow, multilingual answers, and JSON output.

JSON Output

{
  "prompt": "Help me turn this writing idea into a clear request:\nI want to write a polite follow-up email\n\nAsk up to three plain-language clarification questions, then draft an improved prompt.",
  "recipe_name": "clarify-idea",
  "user_input": "I want to write a polite follow-up email",
  "selected_branch": "writing",
  "steps": [
    "Restate the user's rough idea.",
    "Ask for the missing context only if it matters.",
    "Produce a practical prompt the user can paste into chat."
  ],
  "provider": "chatgpt",
  "answers": {}
}

Development

uv sync
uv run pytest
uv run ruff check .
uv run mypy src
uv build

Scope

The first version supports plain text and JSON output. JSONL, Gemini, Anthropic, and Django integrations are future extension targets. The provider layer does not call external APIs.

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

prompt_recipe_smith-0.2.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

prompt_recipe_smith-0.2.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file prompt_recipe_smith-0.2.0.tar.gz.

File metadata

  • Download URL: prompt_recipe_smith-0.2.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for prompt_recipe_smith-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cbf38219e6a875b53b62edc1dfcf3880ce34ab7127944510f7db29a724e08de0
MD5 bd2eeef5039a6ce7bc4756ac4c651b1c
BLAKE2b-256 e23fe4929b041a479c9d2d0f5fe980867693931c33b16f31b64f56d784aa2b76

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_recipe_smith-0.2.0.tar.gz:

Publisher: pypi.yml on yeiichi/prompt-recipe-smith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prompt_recipe_smith-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prompt_recipe_smith-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45d43a29ee51d0782fe6cc8128eaccc01e9b3eafda722b7ec22ea1e226bab797
MD5 34499b8fad3e07fbe69d138249ecf90f
BLAKE2b-256 8bb97443478da5d8053495b9f71df5ce9c8102713601d6bdb42a2bb5751ce12c

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_recipe_smith-0.2.0-py3-none-any.whl:

Publisher: pypi.yml on yeiichi/prompt-recipe-smith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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