Skip to main content

Jinja2 Prompt Template for Swarmauri.

Project description

Swamauri Logo

PyPI - Downloads GitHub Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_j2prompttemplate


Swarmauri Tool J2PromptTemplate

A Swarmauri package that provides tools for generating prompts using Jinja2 templates. Includes support for dynamic template rendering and variable substitution.

Installation

pip install swarmauri_tool_j2prompttemplate

Usage

Basic Template Rendering

from swarmauri_tool_j2prompttemplate.J2PromptTemplate import J2PromptTemplate

# Create a template instance
template = J2PromptTemplate(template="Hello, {{ name }}!")

# Generate a prompt
result = template(variables={"name": "World"})
print(result)  # Output: Hello, World!

Template Rendering from File

from swarmauri_tool_j2prompttemplate.J2PromptTemplate import J2PromptTemplate
from pathlib import Path

# Create a template instance with a file path
template_path = Path("path/to/template.j2")
template = J2PromptTemplate(template=template_path)

# Generate a prompt
result = template(variables={"name": "World"})
print(result)

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_prompt_j2prompttemplate-0.7.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file swarmauri_prompt_j2prompttemplate-0.7.1.tar.gz.

File metadata

File hashes

Hashes for swarmauri_prompt_j2prompttemplate-0.7.1.tar.gz
Algorithm Hash digest
SHA256 36a3683023c31ef77b90c1b370260fa1399a514f3e4f7606890cd98592843957
MD5 992ea660c88273f99375b8b4d1dd02b0
BLAKE2b-256 041ae4fb9103f71095e44508b58821dcc623ee41048d499347e6af1d4ee93b90

See more details on using hashes here.

File details

Details for the file swarmauri_prompt_j2prompttemplate-0.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_prompt_j2prompttemplate-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09cce7efa40e84267920c89d91d3dbd019224097f6bf25167be44a6094d49147
MD5 38bdf3714684746323f0318b96b7189c
BLAKE2b-256 33e0e61c5aea97b12695eb679e8872a0dbef130ce36ddaa90100b96f98aa62e7

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