poml 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +239 -0
  4. data/TUTORIAL.md +987 -0
  5. data/bin/poml +80 -0
  6. data/examples/101_explain_character.poml +30 -0
  7. data/examples/102_render_xml.poml +40 -0
  8. data/examples/103_word_todos.poml +27 -0
  9. data/examples/104_financial_analysis.poml +33 -0
  10. data/examples/105_write_blog_post.poml +48 -0
  11. data/examples/106_research.poml +36 -0
  12. data/examples/107_read_report_pdf.poml +4 -0
  13. data/examples/201_orders_qa.poml +50 -0
  14. data/examples/202_arc_agi.poml +36 -0
  15. data/examples/301_generate_poml.poml +46 -0
  16. data/examples/README.md +50 -0
  17. data/examples/_generate_expects.py +35 -0
  18. data/examples/assets/101_jerry_mouse.jpg +0 -0
  19. data/examples/assets/101_tom_and_jerry.docx +0 -0
  20. data/examples/assets/101_tom_cat.jpg +0 -0
  21. data/examples/assets/101_tom_introduction.txt +9 -0
  22. data/examples/assets/103_prompt_wizard.docx +0 -0
  23. data/examples/assets/104_chart_normalized_price.png +0 -0
  24. data/examples/assets/104_chart_price.png +0 -0
  25. data/examples/assets/104_mag7.xlsx +0 -0
  26. data/examples/assets/107_usenix_paper.pdf +0 -0
  27. data/examples/assets/201_order_instructions.json +7 -0
  28. data/examples/assets/201_orderlines.csv +2 -0
  29. data/examples/assets/201_orders.csv +3 -0
  30. data/examples/assets/202_arc_agi_data.json +1 -0
  31. data/examples/expects/101_explain_character.txt +117 -0
  32. data/examples/expects/102_render_xml.txt +28 -0
  33. data/examples/expects/103_word_todos.txt +121 -0
  34. data/examples/expects/104_financial_analysis.txt +86 -0
  35. data/examples/expects/105_write_blog_post.txt +41 -0
  36. data/examples/expects/106_research.txt +29 -0
  37. data/examples/expects/107_read_report_pdf.txt +151 -0
  38. data/examples/expects/201_orders_qa.txt +44 -0
  39. data/examples/expects/202_arc_agi.txt +64 -0
  40. data/examples/expects/301_generate_poml.txt +153 -0
  41. data/examples/ruby_expects/101_explain_character.txt +17 -0
  42. data/examples/ruby_expects/102_render_xml.txt +28 -0
  43. data/examples/ruby_expects/103_word_todos.txt +14 -0
  44. data/examples/ruby_expects/104_financial_analysis.txt +0 -0
  45. data/examples/ruby_expects/105_write_blog_post.txt +57 -0
  46. data/examples/ruby_expects/106_research.txt +5 -0
  47. data/examples/ruby_expects/107_read_report_pdf.txt +403 -0
  48. data/examples/ruby_expects/201_orders_qa.txt +41 -0
  49. data/examples/ruby_expects/202_arc_agi.txt +17 -0
  50. data/examples/ruby_expects/301_generate_poml.txt +17 -0
  51. data/lib/poml/components/base.rb +132 -0
  52. data/lib/poml/components/content.rb +156 -0
  53. data/lib/poml/components/data.rb +346 -0
  54. data/lib/poml/components/examples.rb +55 -0
  55. data/lib/poml/components/instructions.rb +93 -0
  56. data/lib/poml/components/layout.rb +50 -0
  57. data/lib/poml/components/lists.rb +82 -0
  58. data/lib/poml/components/styling.rb +36 -0
  59. data/lib/poml/components/text.rb +8 -0
  60. data/lib/poml/components/workflow.rb +63 -0
  61. data/lib/poml/components.rb +47 -0
  62. data/lib/poml/components_new.rb +297 -0
  63. data/lib/poml/components_old.rb +1096 -0
  64. data/lib/poml/context.rb +53 -0
  65. data/lib/poml/parser.rb +153 -0
  66. data/lib/poml/renderer.rb +147 -0
  67. data/lib/poml/template_engine.rb +66 -0
  68. data/lib/poml/version.rb +5 -0
  69. data/lib/poml.rb +53 -0
  70. data/media/logo-16-purple.png +0 -0
  71. data/media/logo-64-white.png +0 -0
  72. metadata +149 -0
@@ -0,0 +1,64 @@
1
+ ===== system =====
2
+
3
+ Be brief and clear in your responses
4
+
5
+ ===== human =====
6
+
7
+ Find the common rule that maps an input grid to an output grid, given the examples below.
8
+
9
+ # Examples
10
+
11
+ ## Example 0
12
+
13
+ Input:
14
+ 2 2 2
15
+ 2 1 8
16
+ 2 8 8
17
+
18
+ Output:
19
+ 2 2 2
20
+ 2 5 5
21
+ 2 5 5
22
+
23
+ ## Example 1
24
+
25
+ Input:
26
+ 1 1 1
27
+ 8 1 3
28
+ 8 2 2
29
+
30
+ Output:
31
+ 1 1 1
32
+ 5 1 5
33
+ 5 5 5
34
+
35
+ ## Example 2
36
+
37
+ Input:
38
+ 2 2 2
39
+ 8 8 2
40
+ 2 2 2
41
+
42
+ Output:
43
+ 2 2 2
44
+ 5 5 2
45
+ 2 2 2
46
+
47
+ ## Example 3
48
+
49
+ Input:
50
+ 3 3 8
51
+ 4 4 4
52
+ 8 1 1
53
+
54
+ Output:
55
+ 5 5 5
56
+ 4 4 4
57
+ 5 5 5
58
+
59
+ 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.
60
+
61
+ Input:
62
+ 1 3 2
63
+ 3 3 2
64
+ 1 3 2
@@ -0,0 +1,153 @@
1
+ ===== human =====
2
+
3
+ // PromptLibrary.jsx
4
+
5
+ /* Create a blog post. The prompt contains very specific instructions around output format, styles, and what to include in the content. */
6
+ function blog_post() {
7
+ return <poml>
8
+ <task className="instruction">Create a blog post with these specifications:</task>
9
+
10
+ <output-format className="instruction">
11
+ <list listStyle="decimal">
12
+ <item>Title: [SEO-friendly title]</item>
13
+ <item>Introduction (100 words)
14
+ <list>
15
+ <item>Hook statement</item>
16
+ <item>Context setting</item>
17
+ <item>Main points preview</item>
18
+ </list>
19
+ </item>
20
+ <item>Main body (800 words)
21
+ <list>
22
+ <item>3-4 main points</item>
23
+ <item>Each point: [subtitle + 200 words]</item>
24
+ <item>Include real examples</item>
25
+ <item>Add actionable tips</item>
26
+ </list>
27
+ </item>
28
+ <item>Conclusion (100 words)
29
+ <list>
30
+ <item>Summary of key points</item>
31
+ <item>Call to action</item>
32
+ </list>
33
+ </item>
34
+ </list>
35
+ </output-format>
36
+
37
+ <cp className="instruction" caption="Style" captionSerialized="style">
38
+ <list>
39
+ <item>Tone: Professional but conversational</item>
40
+ <item>Level: Intermediate audience</item>
41
+ <item>Voice: Active, engaging</item>
42
+ <item>Format: Scannable, with subheadings</item>
43
+ </list>
44
+ </cp>
45
+
46
+ <cp className="instruction" caption="Include" captionSerialized="include">
47
+ <list>
48
+ <item>Practical examples</item>
49
+ <item>Statistics or research</item>
50
+ <item>Actionable takeaways</item>
51
+ <item>Relevant analogies</item>
52
+ </list>
53
+ </cp>
54
+ </poml>;
55
+ }
56
+
57
+
58
+ /* Conduct in-depth research with AI, such as tackling academic papers, business analyses, or large investigative projects. */
59
+ function research() {
60
+ return <poml>
61
+ <task>You are given various potential options or approaches for a project. Convert these into a well-structured research plan.</task>
62
+
63
+ <stepwise-instructions>
64
+ <list listStyle="decimal">
65
+ <item>Identifies Key Objectives
66
+ <list listStyle="dash">
67
+ <item>Clarify what questions each option aims to answer</item>
68
+ <item>Detail the data/info needed for evaluation</item>
69
+ </list>
70
+ </item>
71
+ <item>Describes Research Methods
72
+ <list listStyle="dash">
73
+ <item>Outline how you’ll gather and analyze data</item>
74
+ <item>Mention tools or methodologies for each approach</item>
75
+ </list>
76
+ </item>
77
+
78
+ <item>Provides Evaluation Criteria
79
+ <list listStyle="dash">
80
+ <item>Metrics, benchmarks, or qualitative factors to compare options </item>
81
+ <item>Criteria for success or viability</item>
82
+ </list>
83
+ </item>
84
+
85
+ <item>Specifies Expected Outcomes
86
+ <list listStyle="dash">
87
+ <item>Possible findings or results </item>
88
+ <item>Next steps or actions following the research</item>
89
+ </list>
90
+ </item>
91
+ </list>
92
+
93
+ Produce a methodical plan focusing on clear, practical steps.
94
+ </stepwise-instructions>
95
+ </poml>;
96
+ }
97
+
98
+
99
+ /* Test the ability of an LLM to perform a complex reasoning task -- ARC-AGI. The data is in `arc_agi_data.json`.
100
+ */
101
+ function arc_agi() {
102
+ return <poml>
103
+ <SystemMessage>Be brief and clear in your responses</SystemMessage>
104
+ <let src="assets/202_arc_agi_data.json"/>
105
+ <HumanMessage>
106
+ <p>Find the common rule that maps an input grid to an output grid, given the examples below.</p>
107
+ <examples>
108
+ <example for="example in train" chat="false" caption="Example {{ loop.index }}" captionStyle="header">
109
+ <input><table records="{{ example.input }}"/></input>
110
+ <output><table records="{{ example.output }}"/></output>
111
+ </example>
112
+ </examples>
113
+
114
+ <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>
115
+ <input><table records="{{ test[0].input }}"/></input>
116
+ </HumanMessage>
117
+
118
+ <stylesheet>
119
+ {
120
+ "table": {
121
+ "syntax": "csv",
122
+ "writerOptions": {
123
+ "csvHeader": false,
124
+ "csvSeparator": " "
125
+ }
126
+ },
127
+ "input": {
128
+ "captionEnding": "colon-newline",
129
+ "captionStyle": "plain"
130
+ },
131
+ "output": {
132
+ "captionEnding": "colon-newline",
133
+ "captionStyle": "plain"
134
+ }
135
+ }
136
+ </stylesheet>
137
+ </poml>;
138
+ }
139
+
140
+
141
+ /* Summarize a report, such as a research paper or a business report. */
142
+ function read_report() {
143
+ return <poml>
144
+ <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>
145
+ <Document syntax="text" src="assets/107_usenix_paper.pdf" selectedPages="1:3" />
146
+ </poml>
147
+ ;
148
+ }
149
+
150
+
151
+ /* Write a entertaining story that is engaging, imaginative and captivating for the audience. */
152
+ function storyteller() {
153
+ return
@@ -0,0 +1,17 @@
1
+ # Role
2
+
3
+ You are a teacher explaining figures to kids.
4
+
5
+ # Task
6
+
7
+ Please describe the figure first and then provide background knowledge to help kids understand the figure.
8
+
9
+ # Output Format
10
+
11
+ Please write your response in a friendly tone.
12
+
13
+ # Background Knowledge
14
+
15
+ [Document: assets/101_tom_and_jerry.docx]
16
+
17
+ [Image: assets/101_tom_cat.jpg] (The image contains the Tom cat character.)[Document: assets/101_tom_introduction.txt][Image: assets/101_jerry_mouse.jpg] (The image contains the Jerry mouse character.)
@@ -0,0 +1,28 @@
1
+ ===== human =====
2
+
3
+ <role>Senior Systems Architecture Consultant</role>
4
+ <task>Legacy System Migration Analysis</task>
5
+ <Context>
6
+ <item>Fortune 500 retail company</item>
7
+ <item>Current system: 15-year-old monolithic application</item>
8
+ <item>500+ daily users</item>
9
+ <item>99.99% uptime requirement</item>
10
+ </Context>
11
+ <RequiredAnalysis>
12
+ <item>Migration risks and mitigation strategies</item>
13
+ <item>Cloud vs hybrid options</item>
14
+ <item>Cost-benefit analysis</item>
15
+ <item>Implementation roadmap</item>
16
+ </RequiredAnalysis>
17
+ <outputFormat>
18
+ <item>Executive brief (250 words)</item>
19
+ <item>Technical details (500 words)</item>
20
+ <item>Risk matrix</item>
21
+ <item>Timeline visualization</item>
22
+ <item>Budget breakdown</item>
23
+ </outputFormat>
24
+ <Constraints>
25
+ <item>Must maintain operational continuity</item>
26
+ <item>Compliance with GDPR and CCPA</item>
27
+ <item>Maximum 18-month implementation window</item>
28
+ </Constraints>
@@ -0,0 +1,14 @@
1
+ # Task
2
+
3
+ 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 s in the draft.
4
+
5
+ # Output Format
6
+
7
+ Your response should be in the following format:
8
+
9
+ [Document: assets/103_prompt_wizard.docx]{
10
+ "image": {
11
+ "maxWidth": 500,
12
+ "maxHeight": 500
13
+ }
14
+ }
File without changes
@@ -0,0 +1,57 @@
1
+ ===== human =====
2
+
3
+ # Task
4
+
5
+ Create a blog post with these specifications:
6
+
7
+ # Output Format
8
+
9
+ 1. Title: [SEO-friendly title]
10
+
11
+ 2. Introduction (100 words)
12
+
13
+ - Hook statement
14
+
15
+ - Context setting
16
+
17
+ - Main points preview
18
+
19
+ 3. Main body (800 words)
20
+
21
+ - 3-4 main points
22
+
23
+ - Each point: [subtitle + 200 words]
24
+
25
+ - Include real examples
26
+
27
+ - Add actionable tips
28
+
29
+ 4. Conclusion (100 words)
30
+
31
+ - Summary of key points
32
+
33
+ - Call to action
34
+
35
+
36
+
37
+ # style
38
+
39
+ - Tone: Professional but conversational
40
+
41
+ - Level: Intermediate audience
42
+
43
+ - Voice: Active, engaging
44
+
45
+ - Format: Scannable, with subheadings
46
+
47
+
48
+
49
+ # include
50
+
51
+ - Practical examples
52
+
53
+ - Statistics or research
54
+
55
+ - Actionable takeaways
56
+
57
+ - Relevant analogies
@@ -0,0 +1,5 @@
1
+ # Task
2
+
3
+ You are given various potential options or approaches for a project. Convert these into a well-structured research plan.
4
+
5
+ Produce a methodical plan focusing on clear, practical steps.