Skip to content

Fix missing context in orchestrator_workers notebook prompts #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
139 changes: 3 additions & 136 deletions patterns/agents/orchestrator_workers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,142 +122,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"=== ORCHESTRATOR OUTPUT ===\n",
"\n",
"ANALYSIS:\n",
"\n",
"This task requires creating marketing copy for an eco-friendly water bottle, which presents multiple angles for effective communication. The key challenge is balancing environmental benefits with practical features while maintaining appeal to different consumer segments.\n",
"\n",
"Key variations would be valuable because:\n",
"1. Technical buyers need specific details about materials and environmental impact\n",
"2. Lifestyle-focused consumers respond better to emotional benefits and storytelling\n",
"3. Different tones can target distinct market segments while promoting the same core product\n",
"\n",
"The technical approach serves those who make purchase decisions based on specifications and measurable impact, while the conversational approach connects with those who buy based on lifestyle alignment and emotional resonance.\n",
"\n",
"\n",
"TASKS:\n",
"[{'type': 'formal', 'description': '>Create a specification-focused description highlighting material composition, environmental certifications, capacity measurements, and quantifiable eco-impact (e.g., \"plastic bottles saved per year\"). Include technical details about manufacturing process and recycling capabilities.<'}, {'type': 'conversational', 'description': '>Develop a narrative-style description that focuses on the user experience, lifestyle benefits, and emotional connection to environmental protection. Use relatable scenarios and casual language to help readers envision the bottle as part of their daily routine.<'}, {'type': 'hybrid', 'description': '>Combine emotional appeal with key specifications by weaving technical details into a story-driven format. Balance environmental impact statistics with aspirational messaging about sustainability lifestyle choices.<'}]\n",
"\n",
"=== WORKER RESULT (formal) ===\n",
"\n",
"Introducing the EcoVessel Pro Series: A precision-engineered hydration solution crafted from 100% post-consumer recycled stainless steel, certified by the Global Recycled Standard (GRS).\n",
"\n",
"Technical Specifications:\n",
"• Capacity: 750ml / 25.4 fl oz\n",
"• Material: 18/8 food-grade recycled stainless steel (304 grade)\n",
"• Wall thickness: 2mm double-wall vacuum insulation\n",
"• Temperature retention: 24 hours cold / 12 hours hot\n",
"• Weight: 340g / 12 oz (empty)\n",
"\n",
"Environmental Certifications:\n",
"• Carbon Neutral Product certified by Climate Partner\n",
"• BPA-free verification from NSF International\n",
"• ISO 14001 Environmental Management certification\n",
"\n",
"Manufacturing Process:\n",
"Manufactured using hydroelectric power in our carbon-neutral facility, each vessel undergoes a proprietary eco-sanitization process utilizing steam-based sterilization, eliminating chemical cleaning agents. The powder coating is applied through a zero-waste electrostatic process.\n",
"\n",
"Environmental Impact Metrics:\n",
"• Eliminates approximately 167 single-use plastic bottles annually per user\n",
"• 87% lower carbon footprint compared to traditional bottle manufacturing\n",
"• 100% recyclable at end-of-life through our closed-loop recycling program\n",
"• Saves 2,920 liters of water annually through eliminated plastic bottle production\n",
"\n",
"Each unit includes a digital tracking code for real-time impact monitoring and verification of authenticity. Engineered for a minimum 10-year service life under normal usage conditions.\n",
"\n",
"\n",
"\n",
"=== WORKER RESULT (conversational) ===\n",
"\n",
"\n",
"\n",
"=== WORKER RESULT (hybrid) ===\n",
"\n",
"Meet the AquaVerde Elite - where your daily hydration ritual becomes a powerful statement for our planet's future.\n",
"\n",
"Imagine starting your day knowing that every sip you take helps prevent up to 167 single-use plastic bottles from entering our oceans annually. The AquaVerde Elite isn't just a water bottle; it's your personal ambassador in the fight against plastic pollution, crafted from aerospace-grade recycled stainless steel that's been given a second life.\n",
"\n",
"Built to accompany you through life's adventures, this 24oz companion features our innovative ThermaLock™ technology, maintaining your cold drinks frosty for 24 hours or your hot beverages steaming for 12 hours. The double-wall vacuum insulation isn't just about performance - it's engineered to use 30% less material than conventional designs while delivering superior temperature retention.\n",
"\n",
"The bottle's sleek silhouette houses thoughtful details that enhance your daily experience: a leak-proof AutoSeal cap that operates with one hand, a built-in carrying loop made from recycled climbing rope, and our signature CloudTouch™ exterior finish that's both grippy and gorgeous. Available in four nature-inspired colors (Ocean Deep, Forest Canopy, Desert Dawn, and Mountain Mist), each bottle's finish is created using a water-based, zero-VOC coating process.\n",
"\n",
"But perhaps the most beautiful feature is what you don't see - every AquaVerde Elite helps fund clean water projects in developing communities, with 2% of each purchase supporting water conservation initiatives worldwide. Your choice to carry the AquaVerde Elite isn't just about staying hydrated; it's about being part of a global movement toward a more sustainable future.\n",
"\n",
"Specifications that matter:\n",
"• Capacity: 24oz/710ml\n",
"• Weight: 12.8oz\n",
"• Materials: 90% recycled 18/8 stainless steel\n",
"• BPA-free, phthalate-free\n",
"• Dishwasher safe\n",
"• Lifetime warranty\n",
"\n",
"Join the growing community of AquaVerde carriers who've collectively prevented over 2 million single-use bottles from entering our ecosystems. Because every drop counts, and every choice matters.\n",
"\n",
"\n"
]
}
],
"source": [
"ORCHESTRATOR_PROMPT = \"\"\"\n",
"Analyze this task and break it down into 2-3 distinct approaches:\n",
"\n",
"Task: {task}\n",
"\n",
"Return your response in this format:\n",
"\n",
"<analysis>\n",
"Explain your understanding of the task and which variations would be valuable.\n",
"Focus on how each approach serves different aspects of the task.\n",
"</analysis>\n",
"\n",
"<tasks>\n",
" <task>\n",
" <type>formal</type>\n",
" <description>Write a precise, technical version that emphasizes specifications</description>\n",
" </task>\n",
" <task>\n",
" <type>conversational</type>\n",
" <description>Write an engaging, friendly version that connects with readers</description>\n",
" </task>\n",
"</tasks>\n",
"\"\"\"\n",
"\n",
"WORKER_PROMPT = \"\"\"\n",
"Generate content based on:\n",
"Task: {original_task}\n",
"Style: {task_type}\n",
"Guidelines: {task_description}\n",
"\n",
"Return your response in this format:\n",
"\n",
"<response>\n",
"Your content here, maintaining the specified style and fully addressing requirements.\n",
"</response>\n",
"\"\"\"\n",
"\n",
"\n",
"orchestrator = FlexibleOrchestrator(\n",
" orchestrator_prompt=ORCHESTRATOR_PROMPT,\n",
" worker_prompt=WORKER_PROMPT,\n",
")\n",
"\n",
"results = orchestrator.process(\n",
" task=\"Write a product description for a new eco-friendly water bottle\",\n",
" context={\n",
" \"target_audience\": \"environmentally conscious millennials\",\n",
" \"key_features\": [\"plastic-free\", \"insulated\", \"lifetime warranty\"]\n",
" }\n",
")"
]
"outputs": [],
"source": "ORCHESTRATOR_PROMPT = \"\"\"\nAnalyze this task and break it down into 2-3 distinct approaches:\n\nTarget audience: {target_audience}\nKey features: {key_features}\nTask: {task}\n\nReturn your response in this format:\n\n<analysis>\nExplain your understanding of the task and which variations would be valuable.\nFocus on how each approach serves different aspects of the task.\n</analysis>\n\n<tasks>\n <task>\n <type>formal</type>\n <description>Write a precise, technical version that emphasizes specifications</description>\n </task>\n <task>\n <type>conversational</type>\n <description>Write an engaging, friendly version that connects with readers</description>\n </task>\n</tasks>\n\"\"\"\n\nWORKER_PROMPT = \"\"\"\nGenerate content based on:\nTask: {original_task}\nStyle: {task_type}\nGuidelines: {task_description}\nTarget audience: {target_audience}\nKey features: {key_features}\n\nReturn your response in this format:\n\n<response>\nYour content here, maintaining the specified style and fully addressing requirements.\n</response>\n\"\"\"\n\n\norchestrator = FlexibleOrchestrator(\n orchestrator_prompt=ORCHESTRATOR_PROMPT,\n worker_prompt=WORKER_PROMPT,\n)\n\nresults = orchestrator.process(\n task=\"Write a product description for a new eco-friendly water bottle\",\n context={\n \"target_audience\": \"environmentally conscious millennials\",\n \"key_features\": [\"plastic-free\", \"insulated\", \"lifetime warranty\"]\n }\n)"
}
],
"metadata": {
Expand All @@ -281,4 +148,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}