Skip to main content

Jinja2 Prompt Template for Swarmauri.

Project description

Swamauri Logo

PyPI - Downloads 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

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.2.dev14.tar.gz.

File metadata

File hashes

Hashes for swarmauri_prompt_j2prompttemplate-0.7.2.dev14.tar.gz
Algorithm Hash digest
SHA256 6e98e60b3264f11ee56046e06e3331eb24353546f84563580fb28890bfd1e4e8
MD5 57d942ed6950537fd2704a31417f5438
BLAKE2b-256 58fb1410ff9b12e4af865c01ecb48ffdcbc248d6e40ec2e3d197414eb673af76

See more details on using hashes here.

File details

Details for the file swarmauri_prompt_j2prompttemplate-0.7.2.dev14-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_prompt_j2prompttemplate-0.7.2.dev14-py3-none-any.whl
Algorithm Hash digest
SHA256 7f29195c50a50d1ec0e1c7b9bcf03d7df0687381e36db77a4e0f988b383ef0a2
MD5 13ab1c335873e54b630403a404635d4b
BLAKE2b-256 715b54096937141624f4a02d4f1ad969009865fe9b0e929c91a87cc9109271bd

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