Skip to main content

A lightweight, modular library for building, composing, and managing structured prompts for LLMs

Project description

prompting-forge

Minimal, focused prompting library for the Tool-Forge ecosystem.

This package provides the core prompt primitives only:

  • PromptTemplate: define structured prompts with {variables}
  • ChatPrompt: rendered prompt as messages (system + user)

All LLM execution, chaining, and parsing utilities live in genai-forge.

Install

pip install prompting-forge

For chaining (query | template | llm | parser) and model calls:

pip install genai-forge

Python 3.10+.

Quickstart (with genai-forge)

from prompting_forge.prompting import PromptTemplate
from genai_forge import create_llm, PydanticOutputParser
from pydantic import BaseModel

class CityPlan(BaseModel):
    city: str
    attractions: list[str]
    days: int

template = PromptTemplate(
    system="You are a concise assistant.",
    template="Create a weekend plan.\nCity: {city}",
)

llm = create_llm("openai:gpt-4o-mini", temperature=0.2)
parser = PydanticOutputParser(CityPlan)

query = "Generate a simple weekend plan for a city."
chain = query | template | llm | parser
plan = chain({"city": "Lisbon"})
print(plan)

Notes

  • PromptTemplate uses Python str.format. Missing variables raise clear errors.
  • When used with genai-forge, parser instructions can be appended automatically.
  • The pipe operators on PromptTemplate are enabled via a lazy import of genai_forge.chain. If you don’t install genai-forge, you can still call template.format(...) manually and pass the result to your own client.

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

prompting_forge-0.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

prompting_forge-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file prompting_forge-0.1.1.tar.gz.

File metadata

  • Download URL: prompting_forge-0.1.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prompting_forge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fe66125019005212520c32ce6b6b32480f18ca175168ae2fbd8270bd47d9da5d
MD5 300f6ee4c05ffc7e9bdf063bb18368fe
BLAKE2b-256 c4d8ebc30012f7c927c9001abcac2605ad272b77e41b4b62030d3793d907ad3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompting_forge-0.1.1.tar.gz:

Publisher: release.yml on ToolForge-AI/prompting-forge

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

File details

Details for the file prompting_forge-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for prompting_forge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8987491d663f0281bd645b0fac19d0950d64b20d6aee7575f952ef627ff55be
MD5 245d5411717d8eb5c819cdad284035cd
BLAKE2b-256 1e7841f7cf4fe4fb94e624bad1d376dfb860da27e77875b9524338c535e03044

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompting_forge-0.1.1-py3-none-any.whl:

Publisher: release.yml on ToolForge-AI/prompting-forge

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