Jinja2 Prompt Template for Swarmauri.
Project description
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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_prompt_j2prompttemplate-0.9.0.dev2.tar.gz.
File metadata
- Download URL: swarmauri_prompt_j2prompttemplate-0.9.0.dev2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a367d163cc4bd7d6f6c1cd4488f71e41080fe9e1f8c26b0f904641f0f45132c
|
|
| MD5 |
2d7c28dcd969c21ca5241fc3cb4463c6
|
|
| BLAKE2b-256 |
177571a4ddf97f2fd48696b4b8ed07cacac65b08ee048438b1c4ccd6e7d1b1dd
|
File details
Details for the file swarmauri_prompt_j2prompttemplate-0.9.0.dev2-py3-none-any.whl.
File metadata
- Download URL: swarmauri_prompt_j2prompttemplate-0.9.0.dev2-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e59a01a4d7d967b6c7aa83116f330a841940d0ddf91fe955912fb4070c6ade5
|
|
| MD5 |
8e656c0df35262cb351b06195954bca4
|
|
| BLAKE2b-256 |
02bea581f8d65dffcbd1a20144b4805a632300092e0037c63914fa82c5013781
|