POML - Prompt Orchestration Markup Language

raw JSON →
0.0.8 verified Fri May 01 auth: no python

POML (Prompt Orchestration Markup Language) is a Python library for defining, composing, and managing prompts in a structured markup language. It allows you to define reusable prompt components, variables, and orchestration logic. As of version 0.0.8, the library is in early alpha with basic functionality for parsing and rendering POML templates. Release cadence is irregular.

pip install poml
error ModuleNotFoundError: No module named 'poml'
cause poml is not installed or installed in the wrong environment.
fix
Run pip install poml and ensure you are using the correct Python environment (e.g., virtualenv).
error AttributeError: module 'poml' has no attribute 'POML'
cause Importing the module directly instead of the class.
fix
Use from poml import POML instead of import poml.
error TypeError: render() got an unexpected keyword argument 'context'
cause The `render()` method signature changed in 0.0.8; it no longer accepts `context` as a keyword argument.
fix
Pass variables as a dict directly: poml.render(template, {"key": "value"}) instead of context=....
breaking POML 0.0.8 changed the API: render() now returns a string instead of a dict. Previous 0.0.7 returned {'content': ...}.
fix Update code from `result['content']` to `result` directly.
deprecated The `poml.parse()` function is deprecated and will be removed in 0.1.0. Use `poml.load()` instead.
fix Replace `poml.parse(template)` with `poml.load(template)`.
gotcha Templates must be indented consistently. Mixing tabs and spaces causes parsing errors. Use spaces only.
fix Configure your editor to replace tabs with spaces when editing .poml files.

Instantiate a POML object, define a template, and render with variables.

from poml import POML

poml = POML()
template = '''
[context]
user_name = "{{user_name}}"

[instructions]
Greet the user warmly.
'''
rendered = poml.render(template, {"user_name": "Alice"})
print(rendered)