Skip to main content

PromptL bindings for Python

Project description

PromptL

pip install promptl-ai

Requires Python 3.9 through 3.14.

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.8.17 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

promptl_ai-1.4.0.tar.gz (949.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptl_ai-1.4.0-py3-none-any.whl (928.6 kB view details)

Uploaded Python 3

File details

Details for the file promptl_ai-1.4.0.tar.gz.

File metadata

  • Download URL: promptl_ai-1.4.0.tar.gz
  • Upload date:
  • Size: 949.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for promptl_ai-1.4.0.tar.gz
Algorithm Hash digest
SHA256 cae093a8aad98ff69f1fb366f34ef3b43d7958794e5a3802bbe514ff5c655c2d
MD5 537fcca71c7ec1a808fe36450b712fd8
BLAKE2b-256 c828b9e99dc75e74e69dc15ee846d7912ac80caccd6e3f3a9e81cd5fa6ac946e

See more details on using hashes here.

File details

Details for the file promptl_ai-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: promptl_ai-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 928.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for promptl_ai-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecc6083816e58ce5e029d8f240a97ca30b0246a48c9d5e616e2cbb4c589f06e9
MD5 54d60b2efa681245759065c7becd9d8d
BLAKE2b-256 85713a41bcd50c8c76dfa7ff73f649c0176c598e74a27986fc543188b23150e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page