Skip to main content

Add your description here

Project description

broprompt

Lightweight Python library for prompt template management with dynamic parameter handling.

Features

  • Load prompt templates from markdown files
  • Dynamic parameter access via dot notation
  • Template + parameter combination into final prompt strings
  • Export/import parameters as dictionaries
  • Function-to-tool conversion utilities
  • Parameter validation and extraction

Usage

from broprompt.prompt_engineering import Prompt

# Load template from markdown file
prompts = Prompt.from_markdown("system_prompt.md")

# Set parameters
prompts.params.role = "assistant"
prompts.params.domain = "coding"

# Get final prompt string
final_prompt = prompts.str

# Export parameters
params_dict = prompts.to_dict()

# Import parameters
prompts.from_dict({"role": "expert", "tone": "professional"})

Tools Module

from broprompt.tools import convert_to_tool, register_tools

# Convert function to tool definition
def my_function(name: str, age: int) -> str:
    """Greets a person with their name and age."""
    return f"Hello {name}, you are {age} years old!"

tool_def = convert_to_tool(my_function)

# Register multiple tools
tools = register_tools([my_function])

Context Module

from broprompt.context import Context

# Create a context (LangChain Document equivalent)
ctx = Context(
    context="This is the document content",
    metadata={"source": "file.txt", "type": "text"}
)

# Access content
print(ctx.context)  # Direct access

# Automatic fields
print(ctx.id)         # Auto-generated UUID
print(ctx.created_at) # UTC timestamp

Template Format

Use {parameter_name} placeholders in your markdown files:

# System Prompt

You are {role}, specialized in {domain}.
Respond in {tone} tone.

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

broprompt-0.1.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

broprompt-0.1.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file broprompt-0.1.3.tar.gz.

File metadata

  • Download URL: broprompt-0.1.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for broprompt-0.1.3.tar.gz
Algorithm Hash digest
SHA256 00183bf41395fbfc3041b44f3ceaead3b7f1774635b6b25b68f185cb7537e33b
MD5 3f5db548c5389f67410a271373de5614
BLAKE2b-256 de4f67c58b221367a7374ae12d4e9294c2327b1215b404a831399ea945d56774

See more details on using hashes here.

File details

Details for the file broprompt-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: broprompt-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for broprompt-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 68a77e264fd90972ca8619be7881afd1b0df02886780e790de6f587135de33e0
MD5 7dc822de5471ad3d5d47ed1bbb3c8a41
BLAKE2b-256 e5a19880a7acd1ab253de7e018460b897fc730ef30799e4c3017eb19c259fd15

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