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.2.tar.gz (7.6 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.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prompting_forge-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 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.2.tar.gz
Algorithm Hash digest
SHA256 5163b0e67ff873033d8f422678909ab3a4587fc370b924b3e113e605aba13e85
MD5 60583b7a98ea290b4fc2216687726abc
BLAKE2b-256 56c84d30b96a2f2653687a02d14159b6825bfaa14bca01a74a259aa453baedf5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for prompting_forge-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8942c2b9578b3ed7ef9cc6b7d8f2c870226eeeea369bf143cd3b10d62f621ee7
MD5 afc02c6f219f0680067b5c6b334816e3
BLAKE2b-256 dbf2f9fbbecd5f5293f6cf55368efb68bc080f4de96804275f5764b6c139f580

See more details on using hashes here.

Provenance

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