PromptL bindings for Python
Project description
PromptL
pip install promptl-ai
Requires Python 3.9 or higher.
What is PromptL?
PromptL offers a common, easy-to-use syntax for defining dynamic prompts for LLMs. It is a simple, yet powerful language that allows you to define prompts in a human-readable format, while still being able to leverage the full power of LLMs.
This repository contains the Python bindings for PromptL. Go to the main repository to learn more.
Usage
from promptl_ai import Promptl
promptl = Promptl()
prompt = """
<step>
First, think step by step about how to answer the user's question.
<user>
Taking into account this context: {{context}}
I have the following question: {{question}}
</user>
</step>
<step>
Finally, answer the user's question succinctly yet complete.
</step>
"""
chain = promptl.chains.create(
prompt=prompt,
parameters={
"context": "PromptL is a templating language specifically designed for LLM prompting.",
"question": "What is PromptL?",
},
)
conversation = chain.step()
conversation = chain.step("Reasoning...") # LLM response
conversation = chain.step("Answer...") # LLM response
print(conversation.messages)
Find more examples.
Development
Requires uv 0.5.10 or higher.
- Install dependencies:
uv venv && uv sync --all-extras --all-groups - Add [dev] dependencies:
uv add [--dev] <package> - Run linter:
uv run scripts/lint.py - Run formatter:
uv run scripts/format.py - Run tests:
uv run scripts/test.py - Build package:
uv build - Publish package:
uv publish
License
The PromptL bindings are licensed under the MIT License - read the LICENSE file for details.
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 promptl_ai-1.0.6.tar.gz.
File metadata
- Download URL: promptl_ai-1.0.6.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caf8ab08b77341384cd6f68e68b305447a7ecb86b161acb9a56c6b1d68b6d1b8
|
|
| MD5 |
13acab7876bb4932def5ceddcb85ea06
|
|
| BLAKE2b-256 |
81cf25354b4f34a028840729b9a33421e6e2adca9ea5920450f63fc606ed4fbd
|
File details
Details for the file promptl_ai-1.0.6-py3-none-any.whl.
File metadata
- Download URL: promptl_ai-1.0.6-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d991ef54fb979c789a927fadb6c6f7038ab08635875c355e002ba33025cd1843
|
|
| MD5 |
cbe82f36eb26b785060d982d75601426
|
|
| BLAKE2b-256 |
123b64dba92f43a697c04a7fc2a11988bde9d48ef7ced9d232b709d059b25bd1
|