Today I’m excited to introduce PomlSDK.jl, a new Julia package that brings structured prompt engineering to the Julia ecosystem through Microsoft’s Prompt Orchestration Markup Language (POML) standard.
What is PomlSDK.jl?
PomlSDK.jl is a Julia implementation of the POML standard developed by Microsoft Research. It provides a programmatic API for creating structured prompts for Large Language Models (LLMs) that go beyond simple text strings to include hierarchical organization, metadata, examples, and multi-modal content.
Why Use Structured Prompts?
Traditional prompt engineering often involves crafting plain text strings, which can become unwieldy for complex applications. PomlSDK.jl addresses this by:
- Providing a structured framework for organizing prompt components
- Enabling consistent prompt patterns across applications
- Supporting metadata and examples for few-shot learning
- Allowing multi-modal content integration
- Creating maintainable, reusable prompt templates
Installation
Installing PomlSDK.jl is straightforward:
using Pkg
Pkg.add("PomlSDK")
Basic Usage
The package follows a simple node-based approach to build prompt structures:
using PomlSDK
# Create a new prompt object
p = Prompt()
# Add a system role with instructions
role_node = role(p, caption="System")
add_text(p, "You are a helpful assistant that provides accurate information.")
# Add a task for the AI
task_node = task(p, caption="Answer Question", priority="high")
add_text(p, "What is the capital of France?")
# Generate the POML XML
poml_string = dump_poml(p)
println(poml_string)
Core Features
Hierarchical Structure Management
PomlSDK.jl uses a stack-based approach to manage prompt structure:
# Push a new node to the stack
task_node = task(p, caption="Data Analysis")
add_node!(p, task_node)
# Add content to the current node
add_text(p, "Analyze the provided dataset and identify key patterns.")
# Return to the previous context
pop_node!(p)
Example Management
For few-shot learning, you can easily add examples:
# Create an example set
example_set_node = example_set(p)
add_node!(p, example_set_node)
# Add individual examples
example_node = example(p)
add_node!(p, example_node)
add_text(p, "Input: 2+2\nOutput: 4")
pop_node!(p) # Back to example_set
example_node = example(p)
add_node!(p, example_node)
add_text(p, "Input: 3+5\nOutput: 8")
pop_node!(p) # Back to example_set
pop_node!(p) # Back to root
Metadata Support
Add descriptive metadata to your prompts:
meta_node = meta(p)
add_tag(p, "educational")
add_description(p, "Basic math examples for instruction tuning")
Multi-modal Content
Support for embedding various content types:
# Add an image
img_node = image(p, src="image/png;base64,...", alt="Data visualization")
# Add a document reference
doc_node = document(p, src="data.pdf", parser="pdf")
Advanced Usage
For more complex scenarios, PomlSDK.jl supports tool definitions and requests:
# Define a tool
tool_def = tool_definition(p, name="calculator", description="Performs basic math operations")
# Request tool usage
tool_req = tool_request(p, name="calculator", parameters=Dict("operation" => "add", "a" => 5, "b" => 7))
Why This Matters for Julia Users
PomlSDK.jl brings structured prompt engineering to Julia’s AI ecosystem, enabling:
- Consistent prompt patterns across different LLM applications
- Reproducible prompt engineering with version-controlled structures
- Complex prompt orchestration for advanced AI applications
- Interoperability with other POML-compliant systems
Whether you’re building educational tools, enterprise AI applications, or research prototypes, PomlSDK.jl provides the foundation for professional-grade prompt engineering in Julia.
Get Started Today
The package is ready for use with comprehensive documentation available at https://imohag9.github.io/PomlSDK.jl/dev/. Check out the examples and start building structured prompts that unlock the full potential of LLMs within your Julia workflow.