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.9.0.dev4.tar.gz.

File metadata

File hashes

Hashes for swarmauri_prompt_j2prompttemplate-0.9.0.dev4.tar.gz
Algorithm Hash digest
SHA256 6dd68f1f4f7fff3c99a53e53f152c6f81523bb0b3e27532182b2b4fb87a9644e
MD5 1c55f8612397c414d370410fecd1e1f1
BLAKE2b-256 50705e324c1abfa13f2eb135c4760d955fcc677c8d40403a3a3bd2c3a2709622

See more details on using hashes here.

File details

Details for the file swarmauri_prompt_j2prompttemplate-0.9.0.dev4-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_prompt_j2prompttemplate-0.9.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b0a870dc97df20bd67777fb0b2186ef64ba3041c553718e95fcd6fdf6b00998
MD5 2f43b790b642d96b2e37f4378f101530
BLAKE2b-256 dc5459cb47475299c5a7f8321e331b5219358816f9102d6a08cdda7129006ba6

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