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.
Metadata
Release files for swarmauri_prompt_j2prompttemplate 0.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_prompt_j2prompttemplate-0.7.3.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_prompt_j2prompttemplate-0.7.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / swarmauri_prompt_j2prompttemplate-0.7.3.tar.gz
| Download URL | swarmauri_prompt_j2prompttemplate-0.7.3.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f945af93377ec7b3596c4ec10199acbdfd43476338f15fb44fb104c8c16f1b8c
|
|
BLAKE2b-256 checksum How to use checksums |
8eb07ec804162bc44c66ce15bcf5d40358156c254932c31986c4e3695d24a956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|
Release files / swarmauri_prompt_j2prompttemplate-0.7.3-py3-none-any.whl
| Download URL | swarmauri_prompt_j2prompttemplate-0.7.3-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4abffa58f6c4621440721a224d8a432f5055b70cb490a8ec5b0359f108bcdc28
|
|
BLAKE2b-256 checksum How to use checksums |
afc7dce368e4de0d07ace98ae7704160cc2c1167be4f189058f11a7fc55e9fc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|