Skip to main content

Lightweight Python library for parsing and rendering POML prompts

Project description

Pomlight (Python)

Lightweight Python library for parsing and rendering POML prompts.

Install

pip install pomlight

Usage

from pomlight import poml

messages = poml("""<poml>
  <system>You are a helpful assistant.</system>
  <user>What is 2 + 2?</user>
</poml>""")

print(messages[0]["content"])  # "You are a helpful assistant."
print(messages[1]["content"])  # "What is 2 + 2?"

Use with OpenAI SDK

from openai import OpenAI
from pomlight import poml

client = OpenAI()

params = poml("""<poml>
  <runtime model="gpt-4o-mini" />
  <system>You are a helpful assistant. Reply in one short sentence.</system>
  <user>What is the capital of France?</user>
</poml>""", format="openai_chat")

response = client.chat.completions.create(**params)
print(response.choices[0].message.content)

Feature Coverage

See FeatureCoverage.md for supported components, template features, and what is not implemented.

Development

pip install -e .[dev]
pytest tests/

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

pomlight-0.1.6.tar.gz (61.4 kB view details)

Uploaded Source

Built Distribution

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

pomlight-0.1.6-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file pomlight-0.1.6.tar.gz.

File metadata

  • Download URL: pomlight-0.1.6.tar.gz
  • Upload date:
  • Size: 61.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pomlight-0.1.6.tar.gz
Algorithm Hash digest
SHA256 8d48e3865afc97f4d117a36e95a1f24317abd0dd8c12abeece69bb9180cb8943
MD5 14cd1a65599fcc9c0d1c2cd9cfb2864a
BLAKE2b-256 a7c2deb58f5e9a624e6536172e7eeab1be388b1d1c9359ab5c3f52d10146b85e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pomlight-0.1.6.tar.gz:

Publisher: publish-python.yml on gfauchart/pomlight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pomlight-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pomlight-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pomlight-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6eb22190254fb4f378c238449a3fcc9e3254a3a487c79be603eacdaa91721850
MD5 cd23e3b5f8f00e846c16b2da1cbcad80
BLAKE2b-256 57b3a8e0aab99f9f4338425abe303b2107b1214b3d0792d5d1d1b1435269fee8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pomlight-0.1.6-py3-none-any.whl:

Publisher: publish-python.yml on gfauchart/pomlight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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