Skip to main content

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.

Metadata

Release files for PromptLang 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PromptLang 0.1.0
File Size Uploaded
promptlang-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PromptLang 0.1.0
File Interpreter ABI Platform
PromptLang-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / promptlang-0.1.0.tar.gz

Download URL promptlang-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e073eed8019e56c2dbc1bcac1da70c76fb529cb0f51e0ed28898b2a6050bb957
BLAKE2b-256 checksum
How to use checksums
56b48dee6ad5fb43cf1d2a4c55e825c7f44cc33a1e25668c152b43a002c3e554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / PromptLang-0.1.0-py3-none-any.whl

Download URL PromptLang-0.1.0-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0ea794b13dc7814474e99451fef2486e3a181f963042771e0e7b5ee70865cec
BLAKE2b-256 checksum
How to use checksums
65a4c40f1d5988516ff0de27b1f6535ae8ef68c112253e5b4f5aa311cc570675
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page