Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ This example defines a role and task for the LLM, includes an image for context,

### Visual Studio Code Extension

*Coming soon:* Search for "POML" in the Visual Studio Code Marketplace to install the POML extension.
Install from [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=poml-team.poml).

*Currently:* You can install the extension manually by downloading the `.vsix` file from our [GitHub releases page](https://github.com/microsoft/poml/releases) and installing it in VS Code via the Extensions view.
You can also install the extension manually by downloading the `.vsix` file from our [GitHub releases page](https://github.com/microsoft/poml/releases) and installing it in VS Code via the Extensions view.

You can also install POML using npm for Node.js projects or pip for Python projects.
Before testing prompts with the POML toolkit, make sure you have configured your preferred LLM model, API key, and endpoint. If these are not set, prompt testing will not work.

**To configure in Visual Studio Code:**
- Open the extension settings (open "Settings" and search for "POML").
- Set your model provider (e.g., OpenAI, Azure, Google), API key, and endpoint URL in the POML section.
- Alternatively, you can add these settings directly to your `settings.json` file.

### Node.js (via npm, coming soon)

Expand All @@ -54,13 +59,11 @@ npm install poml

### Python (via pip)

*Coming soon:*

```bash
pip install poml
```

*Currently:* For development or local installation, you might use `pip install -e .` from a cloned repository.
For development or local installation, you might use `pip install -e .` from a cloned repository.

## Documentation

Expand Down
30 changes: 30 additions & 0 deletions examples/101_explain_character.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- POML should always start with a POML tag to harvest most of its features. -->
<poml>
<role>You are a teacher explaining figures to kids.</role>
<!-- Use components like role and task to help you organize your intentions. This also usually comes with better LLM performance. -->
<task>Please describe the figure first and then provide background knowledge to help kids understand the figure.</task>
<output-format>Please write your response in a friendly tone.</output-format>

<!-- Use properties like captionStyle and caption to customize your prompt style. -->
<hint captionStyle="header" caption="Background Knowledge">
<!-- Document can be used to import a word document, a PDF or a pure text. -->
<Document src="assets/101_tom_and_jerry.docx"/>
</hint>

<!-- Organize few-shot examples with example. This will automatically generates an interaction of human and AI messages. -->
<example>
<input>
<!-- alt strings help models without vision capabilities to understand the images. -->
<!-- Specify syntax = "multimedia" to send the image itself to the prompt. -->
<img src="assets/101_tom_cat.jpg" alt="The image contains the Tom cat character." syntax="multimedia" />
</input>
<output>
<!-- Import the results from a txt file. -->
<Document src="assets/101_tom_introduction.txt"/>
</output>
</example>

<!-- In this case, the input is inferred as a human message. -->
<input><img src="assets/101_jerry_mouse.jpg" alt="The image contains the Jerry mouse character." syntax="multimedia" /></input>

</poml>
40 changes: 40 additions & 0 deletions examples/102_render_xml.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<poml syntax="xml">
<role>Senior Systems Architecture Consultant</role>
<task>Legacy System Migration Analysis</task>

<cp caption="Context">
<list>
<item>Fortune 500 retail company</item>
<item>Current system: 15-year-old monolithic application</item>
<item>500+ daily users</item>
<item>99.99% uptime requirement</item>
</list>
</cp>

<cp caption="Required Analysis" captionSerialized="RequiredAnalysis">
<list listStyle="decimal">
<item>Migration risks and mitigation strategies</item>
<item>Cloud vs hybrid options</item>
<item>Cost-benefit analysis</item>
<item>Implementation roadmap</item>
</list>
</cp>

<output-format>
<list>
<item>Executive brief (250 words)</item>
<item>Technical details (500 words)</item>
<item>Risk matrix</item>
<item>Timeline visualization</item>
<item>Budget breakdown</item>
</list>
</output-format>

<cp caption="Constraints">
<list>
<item>Must maintain operational continuity</item>
<item>Compliance with GDPR and CCPA</item>
<item>Maximum 18-month implementation window</item>
</list>
</cp>
</poml>
27 changes: 27 additions & 0 deletions examples/103_word_todos.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<poml>
<Task>I developed a project called Prompt Wizard and I want to write a blog to publish on the company website. I have already written a draft of the blog. There has been figures, numbers in tables, the key challenges, motivations, as well as some titles and subtitles. I want you to complete the <code>[TODO]</code>s in the draft.</Task>

<OutputFormat>Your response should be in the following format:

<Code inline="false">
<List>
<ListItem>TODO 1: </ListItem>
<ListItem>TODO 2: </ListItem>
<ListItem>...</ListItem>
</List>
</Code>
</OutputFormat>

<input>
<Document src="assets/103_prompt_wizard.docx" />
</input>

<stylesheet>
{
"image": {
"maxWidth": 500,
"maxHeight": 500
}
}
</stylesheet>
</poml>
33 changes: 33 additions & 0 deletions examples/104_financial_analysis.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<poml>
<SystemMessage>

<task>
Given the stock ticker, provide a full and up-to-date financial analysis covering the following aspects, cite sources.
</task>

<list listStyle="decimal">
<item>Current stock price, recent performance trends, and historical comparison.</item>
<item>Key financial ratios (e.g., P/E ratio, forward P/E, Price/Free cash flow, EPS growth this year, Return on equity, return on investment, current ratio, net profit margin, debt-to-equity ratio) and what they indicate about the company's financial health.</item>
<item>Support and resistance prices of the stock and how current indicators may drive the direction of the stock</item>
<item>Recent earnings reports, revenue growth or decline, and net income trends over the past quarter. Please also include if latest EPS report beat estimates.</item>
<item>Industry comparison to determine the company's standing relative to its peers.</item>
<item>Current analyst ratings, target price forecasts, and recent upgrades or downgrades.</item>
<item>Overall summary on whether the stock is considered a 'buy', 'hold', or 'sell' based on current financial data and market sentiment.</item>
</list>
</SystemMessage>

<HumanMessage>
<table src="assets/104_mag7.xlsx" selectedRecords=":-1" syntax="markdown" />

<p>The following two charts on a visualization of the table above. One of them shows the absolute price of the stocks, and the other one shows the price normalized by the price of the first day.</p>

<img src="assets/104_chart_price.png" syntax="multimedia" />

<img src="assets/104_chart_normalized_price.png" syntax="multimedia" />

<Hint>
The table contains stock tickers of 7 companies. Please analyze and give financial analysis and comparison for them.
</Hint>
</HumanMessage>

</poml>
48 changes: 48 additions & 0 deletions examples/105_write_blog_post.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<poml>
<task className="instruction">Create a blog post with these specifications:</task>

<output-format className="instruction">
<list listStyle="decimal">
<item>Title: [SEO-friendly title]</item>
<item>Introduction (100 words)
<list>
<item>Hook statement</item>
<item>Context setting</item>
<item>Main points preview</item>
</list>
</item>
<item>Main body (800 words)
<list>
<item>3-4 main points</item>
<item>Each point: [subtitle + 200 words]</item>
<item>Include real examples</item>
<item>Add actionable tips</item>
</list>
</item>
<item>Conclusion (100 words)
<list>
<item>Summary of key points</item>
<item>Call to action</item>
</list>
</item>
</list>
</output-format>

<cp className="instruction" caption="Style" captionSerialized="style">
<list>
<item>Tone: Professional but conversational</item>
<item>Level: Intermediate audience</item>
<item>Voice: Active, engaging</item>
<item>Format: Scannable, with subheadings</item>
</list>
</cp>

<cp className="instruction" caption="Include" captionSerialized="include">
<list>
<item>Practical examples</item>
<item>Statistics or research</item>
<item>Actionable takeaways</item>
<item>Relevant analogies</item>
</list>
</cp>
</poml>
36 changes: 36 additions & 0 deletions examples/106_research.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<poml>
<task>You are given various potential options or approaches for a project. Convert these into a well-structured research plan.</task>

<stepwise-instructions>
<list listStyle="decimal">
<item>Identifies Key Objectives
<list listStyle="dash">
<item>Clarify what questions each option aims to answer</item>
<item>Detail the data/info needed for evaluation</item>
</list>
</item>
<item>Describes Research Methods
<list listStyle="dash">
<item>Outline how you’ll gather and analyze data</item>
<item>Mention tools or methodologies for each approach</item>
</list>
</item>

<item>Provides Evaluation Criteria
<list listStyle="dash">
<item>Metrics, benchmarks, or qualitative factors to compare options </item>
<item>Criteria for success or viability</item>
</list>
</item>

<item>Specifies Expected Outcomes
<list listStyle="dash">
<item>Possible findings or results </item>
<item>Next steps or actions following the research</item>
</list>
</item>
</list>

Produce a methodical plan focusing on clear, practical steps.
</stepwise-instructions>
</poml>
4 changes: 4 additions & 0 deletions examples/107_read_report_pdf.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<poml>
<p>Provide a concise executive summary of the following text, highlighting key points, objectives, and outcomes. Keep the summary under 150 words and ensure it is suitable for a professional audience.</p>
<Document syntax="text" src="assets/107_usenix_paper.pdf" selectedPages="1:3" />
</poml>
50 changes: 50 additions & 0 deletions examples/201_orders_qa.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<poml>
<role>You are a chatbot agent answering customer's questions in a chat.</role>

<task>
Your task is to answer the customer's question using the data provided in the data section.
<!-- Use listStyle property to change the style of a list. -->
<list listStyle="decimal">
<item>You can access order history in the orders section including email id and order total with payment summary.</item>
<item>Refer to orderlines for item level details within each order in orders.</item>
</list>
</task>

<!-- cp means CaptionedParagraph, which is a paragraph with customized headings. -->
<cp caption="Data">
<cp caption="Orders">
<!-- Use table to read a csv file. By default, it follows its parents' style (markdown in this case). -->
<table src="assets/201_orders.csv" />
</cp>

<cp caption="Orderlines">
<!-- Use syntax to specify its output format. -->
<table src="assets/201_orderlines.csv" syntax="tsv" />
</cp>
</cp>

<!-- This can also be stepwise-instructions, and it's case-insensitive. -->
<StepwiseInstructions>
<!-- Read a file and save it as instructions -->
<let src="assets/201_order_instructions.json" name="instructions"/>
<!-- Use a for loop to iterate over the instructions, use {{ }} to evaluate an expression -->
<p for="ins in instructions">
Instruction {{loop.index+1}}: {{ ins }}
</p>
</StepwiseInstructions>

<!-- Specify the speaker of a block. -->
<HumanMessage>
<!-- Use a question-answer format. -->
<qa>How much did I pay for my last order?</qa>
</HumanMessage>

<!-- Use stylesheet (a CSS-like JSON) to modify the style in a batch. -->
<stylesheet>
{
"cp": {
"captionTextTransform": "upper"
}
}
</stylesheet>
</poml>
36 changes: 36 additions & 0 deletions examples/202_arc_agi.poml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<poml>
<SystemMessage>Be brief and clear in your responses</SystemMessage>
<let src="assets/202_arc_agi_data.json"/>
<HumanMessage>
<p>Find the common rule that maps an input grid to an output grid, given the examples below.</p>
<examples>
<example for="example in train" chat="false" caption="Example {{ loop.index }}" captionStyle="header">
<input><table records="{{ example.input }}"/></input>
<output><table records="{{ example.output }}"/></output>
</example>
</examples>

<p>Below is a test input grid. Predict the corresponding output grid by applying the rule you found. Your final answer should just be the text output grid itself.</p>
<input><table records="{{ test[0].input }}"/></input>
</HumanMessage>

<stylesheet>
{
"table": {
"syntax": "csv",
"writerOptions": {
"csvHeader": false,
"csvSeparator": " "
}
},
"input": {
"captionEnding": "colon-newline",
"captionStyle": "plain"
},
"output": {
"captionEnding": "colon-newline",
"captionStyle": "plain"
}
}
</stylesheet>
</poml>
Loading