A lightweight language for dynamic prompt processing with inline data transformations and caching.
Project description
PromptLang
PromptLang is a lightweight and efficient language designed for dynamic prompt processing with inline data transformations and caching.
Features
- Data Retrieval: Access values dynamically using
{user.name}. - Function Calls: Invoke functions with
{fn:do_something user.patient_id}. - Mandatory Fields: Ensure essential data is provided using
{mandatory user.name}. - Logical OR Operation: Handle fallback values with
{user.patient_id | user.name}.
Example Usage
from promptlang import PromptLang
def get_diagnosis_details(id):
return "some serious thing"
data = {"user": {"name": "Alice", "patient_id": 1234}}
cache = {}
pl = PromptLang(data, cache)
prompt = """
Please check the diagnosis is aligned with symptoms?
User's name is {user.name} and Discharge Details are {fn:get_diagnosis_details user.patient_id}
"""
print(pl.generate_prompt(prompt))
Installation
To install PromptLang, use:
pip install promptlang
License
This project is licensed under the MIT License.
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 promptlang-0.1.0.tar.gz.
File metadata
- Download URL: promptlang-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e073eed8019e56c2dbc1bcac1da70c76fb529cb0f51e0ed28898b2a6050bb957
|
|
| MD5 |
1b719970f8982a7d3915d2db995cc5ee
|
|
| BLAKE2b-256 |
56b48dee6ad5fb43cf1d2a4c55e825c7f44cc33a1e25668c152b43a002c3e554
|
File details
Details for the file PromptLang-0.1.0-py3-none-any.whl.
File metadata
- Download URL: PromptLang-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0ea794b13dc7814474e99451fef2486e3a181f963042771e0e7b5ee70865cec
|
|
| MD5 |
2a7721d24ce6053adeb5bd5866e6b848
|
|
| BLAKE2b-256 |
65a4c40f1d5988516ff0de27b1f6535ae8ef68c112253e5b4f5aa311cc570675
|