Skip to content

Commit b96056b

Browse files
authored
skeleton-of-thought example (#919)
Signed-off-by: Mandana Vaziri <[email protected]>
1 parent 10f0c3d commit b96056b

File tree

2 files changed

+139
-0
lines changed

2 files changed

+139
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
description: Tip suggestion program illustration skeleton-of-thought
2+
defs:
3+
MAX_ITERATIONS: 50
4+
topics:
5+
read: topic.jsonl
6+
parser: jsonl
7+
8+
expand_tip:
9+
function:
10+
topic: str
11+
tip: str
12+
return:
13+
lastOf:
14+
- |
15+
Please expand a tip for a topic into a detailed paragraph.
16+
Topic: staying healthy
17+
Tip: Regular Exercise
18+
Paragraph: Incorporate physical activity into your daily routine. This doesn't necessarily mean intense gym workouts; it can be as simple as walking, cycling, or yoga. Regular exercise helps in maintaining a healthy weight, improves cardiovascular health, boosts mental health, and can enhance cognitive function, which is crucial for fields that require intense intellectual engagement.
19+
20+
Topic: building a campfire
21+
Tip: Choose the Right Location
22+
Paragraph: Always build your campfire in a safe spot. This means selecting a location that's away from trees, bushes, and other flammable materials. Ideally, use a fire ring if available. If you're building a fire pit, it should be on bare soil or on a bed of stones, not on grass or near roots which can catch fire underground. Make sure the area above is clear of low-hanging branches.
23+
24+
Topic: writing a blog post
25+
Tip: structure your content effectively
26+
Paragraph: A well-structured post is easier to read and more enjoyable. Start with an engaging introduction that hooks the reader and clearly states the purpose of your post. Use headings and subheadings to break up the text and guide readers through your content. Bullet points and numbered lists can make information more digestible. Ensure each paragraph flows logically into the next, and conclude with a summary or call-to-action that encourages reader engagement.
27+
28+
Topic: ${ topic }
29+
Tip: ${ tip }
30+
Paragraph:
31+
32+
- model: ollama_chat/granite3.2:8b
33+
parameters:
34+
temperature: 0
35+
max_tokens: 128
36+
stop: [".\n\n"]
37+
38+
suggest_tips:
39+
function:
40+
topic: str
41+
number: int
42+
return:
43+
lastOf:
44+
- "Please act as a helpful assistant. Your job is to provide users with useful tips on a specific topic.\n"
45+
- "Give ${ number } tips for ${ topic }, each under 8 words. Do not use quotes. Make sure there are ${ number } tips.\n"
46+
- model: ollama_chat/granite3.2:8b
47+
parameters:
48+
temperature: 0
49+
50+
text:
51+
- for:
52+
topic: ${ topics }
53+
repeat:
54+
call: ${ suggest_tips }
55+
args:
56+
topic: ${ topic.topic }
57+
number: ${ topic.number }
58+
pdl_context: []
59+
join:
60+
as: array
61+
max_iterations: ${ MAX_ITERATIONS }
62+
def: skeletons
63+
- "\n\n"
64+
- for:
65+
skeleton: ${ skeletons }
66+
repeat:
67+
lang: python
68+
code: |
69+
skel = """ ${skeleton} """
70+
result = skel.split("\n")
71+
join:
72+
as: array
73+
def: skeletons_array
74+
- for:
75+
skeleton: ${ skeletons_array }
76+
topic: ${ topics[:MAX_ITERATIONS] }
77+
repeat:
78+
for:
79+
tip: ${ skeleton }
80+
repeat:
81+
call: ${ expand_tip }
82+
args:
83+
topic: ${ topic.topic }
84+
tip: ${ tip }
85+
pdl_context: []
86+
join:
87+
as: array
88+
89+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{"topic": "organizing a successful charity event", "number": 6}
2+
{"topic": "improving personal credit scores", "number": 7}
3+
{"topic": "staying motivated during job searches", "number": 5}
4+
{"topic": "maintaining a work-life balance", "number": 9}
5+
{"topic": "reducing carbon footprint at home", "number": 8}
6+
{"topic": "starting a book club", "number": 5}
7+
{"topic": "learning to play a musical instrument", "number": 7}
8+
{"topic": "getting into freelance writing", "number": 6}
9+
{"topic": "beginner yoga poses", "number": 8}
10+
{"topic": "preparing for graduate school exams", "number": 5}
11+
{"topic": "exploring minimalist living", "number": 9}
12+
{"topic": "effective grocery shopping", "number": 7}
13+
{"topic": "winter camping", "number": 5}
14+
{"topic": "starting a podcast on a budget", "number": 8}
15+
{"topic": "creating a capsule wardrobe", "number": 6}
16+
{"topic": "improving your writing skills", "number": 7}
17+
{"topic": "learning a new software quickly", "number": 9}
18+
{"topic": "reducing anxiety before public speaking", "number": 5}
19+
{"topic": "planning a solo travel adventure", "number": 8}
20+
{"topic": "beginner skateboarders", "number": 6}
21+
{"topic": "studying abroad", "number": 7}
22+
{"topic": "planting a vegetable garden", "number": 5}
23+
{"topic": "adopting a shelter pet", "number": 9}
24+
{"topic": "learning to cook ethnic cuisines", "number": 8}
25+
{"topic": "effective conflict resolution", "number": 5}
26+
{"topic": "starting a vlog", "number": 7}
27+
{"topic": "keeping a daily journal", "number": 6}
28+
{"topic": "improving sleep hygiene", "number": 8}
29+
{"topic": "beginner mountain climbers", "number": 5}
30+
{"topic": "creating a mobile app", "number": 9}
31+
{"topic": "maintaining a saltwater aquarium", "number": 7}
32+
{"topic": "preparing for a baby's arrival", "number": 6}
33+
{"topic": "writing a fantasy novel", "number": 5}
34+
{"topic": "effective team leadership", "number": 8}
35+
{"topic": "making a documentary film", "number": 9}
36+
{"topic": "learning about historical events", "number": 7}
37+
{"topic": "baking gluten-free treats", "number": 6}
38+
{"topic": "improving mental arithmetic skills", "number": 5}
39+
{"topic": "building a treehouse", "number": 8}
40+
{"topic": "getting started with watercolor painting", "number": 9}
41+
{"topic": "creating a YouTube tutorial series", "number": 7}
42+
{"topic": "landscape photography", "number": 5}
43+
{"topic": "navigating cultural differences", "number": 6}
44+
{"topic": "preparing for a marathon", "number": 8}
45+
{"topic": "building an online business", "number": 9}
46+
{"topic": "learning to dance at home", "number": 5}
47+
{"topic": "self-publishing a book", "number": 7}
48+
{"topic": "starting an urban farm", "number": 6}
49+
{"topic": "improving your memory", "number": 8}
50+
{"topic": "creating a personal brand online", "number": 9}

0 commit comments

Comments
 (0)