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.0.tar.gz (6.3 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.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prompting_forge-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 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.0.tar.gz
Algorithm Hash digest
SHA256 3426f9baec05b03ca59e1ca9ea182c746ff454fed32f2107806f2827db635396
MD5 fa15840ff231e5e8323123a051bb9706
BLAKE2b-256 6475c394d7b3d3f69ac54ae2641fc5d6138e1755335dbbc44c3e963eb175dbce

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompting_forge-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prompting_forge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 58ecdd8395445b5cbf7fc3709fbfecad2b0ce43a506c1ebd0ee95a1f79092f92
MD5 05d52903016b971c80278a72c3548ff1
BLAKE2b-256 ef13deaf205c349e1ed279c857b29233b7bc0c46cec102ca462c950848f5f5d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompting_forge-0.1.0-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