mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-12 04:50:39 +00:00
orchestrator agent
This commit is contained in:
parent
1abf1b0f55
commit
fcbd6dfae8
1 changed files with 459 additions and 3 deletions
|
@ -70,7 +70,9 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"#### 1.1 Prompt Chaining"
|
"#### 1.1 Prompt Chaining\n",
|
||||||
|
"\n",
|
||||||
|
""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -217,7 +219,9 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"#### 1.2 Routing"
|
"#### 1.2 Routing\n",
|
||||||
|
"\n",
|
||||||
|
""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -582,7 +586,9 @@
|
||||||
"source": [
|
"source": [
|
||||||
"#### 2. Evaluator-Optimizer Workflow\n",
|
"#### 2. Evaluator-Optimizer Workflow\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In the evaluator-optimizer workflow, one LLM call generates a response while another provider evaluation and feedback in a loop. "
|
"In the evaluator-optimizer workflow, one LLM call generates a response while another provider evaluation and feedback in a loop. \n",
|
||||||
|
"\n",
|
||||||
|
""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -941,6 +947,456 @@
|
||||||
"pprint(evaluator_agent_session.to_dict())"
|
"pprint(evaluator_agent_session.to_dict())"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 3. Orchestrator-Workers Workflow\n",
|
||||||
|
"\n",
|
||||||
|
"In the orchestrator-workers workflow, a central LLM dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results.\n",
|
||||||
|
"\n",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 64,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from typing import List, Dict\n",
|
||||||
|
"class OrchestratorOutputSchema(BaseModel):\n",
|
||||||
|
" analysis: str\n",
|
||||||
|
" tasks: List[Dict[str, str]]\n",
|
||||||
|
"\n",
|
||||||
|
"orchestrator_agent_config = AgentConfig({\n",
|
||||||
|
" **base_agent_config,\n",
|
||||||
|
" \"instructions\": \"\"\"Your job is to analyize the task provided by the user andbreak it down into 2-3 distinct approaches:\n",
|
||||||
|
"\n",
|
||||||
|
" Return your response in the following JSON format:\n",
|
||||||
|
" {{\n",
|
||||||
|
" \"analysis\": \"<Your understanding of the task and which variations would be valuable. Focus on how each approach serves different aspects of the task.>\",\n",
|
||||||
|
" \"tasks\": [\n",
|
||||||
|
" {{\n",
|
||||||
|
" \"type\": \"formal\",\n",
|
||||||
|
" \"description\": \"Write a precise, technical version that emphasizes specifications\"\n",
|
||||||
|
" }},\n",
|
||||||
|
" {{\n",
|
||||||
|
" \"type\": \"conversational\",\n",
|
||||||
|
" \"description\": \"Write an engaging, friendly version that connects with readers\"\n",
|
||||||
|
" }}\n",
|
||||||
|
" ]\n",
|
||||||
|
" }}\n",
|
||||||
|
" \"\"\",\n",
|
||||||
|
" \"response_format\": {\n",
|
||||||
|
" \"type\": \"json_schema\",\n",
|
||||||
|
" \"json_schema\": OrchestratorOutputSchema.model_json_schema()\n",
|
||||||
|
" }\n",
|
||||||
|
"})\n",
|
||||||
|
"\n",
|
||||||
|
"worker_agent_config = AgentConfig({\n",
|
||||||
|
" **base_agent_config,\n",
|
||||||
|
" \"instructions\": \"\"\"You will be given a <Task>, <Style>, and <Guidelines>. Generate content based on the provided\n",
|
||||||
|
" task, following the style and guideline descriptions. \n",
|
||||||
|
"\n",
|
||||||
|
" Return your response in this format:\n",
|
||||||
|
"\n",
|
||||||
|
" Response: Your content here, maintaining the specified style and fully addressing requirements.\n",
|
||||||
|
" \"\"\",\n",
|
||||||
|
"})\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 85,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def orchestrator_worker_workflow(task, context):\n",
|
||||||
|
" # single orchestrator agent\n",
|
||||||
|
" orchestrator_agent = Agent(client, orchestrator_agent_config)\n",
|
||||||
|
" orchestrator_session_id = orchestrator_agent.create_session(session_name=f\"orchestrator_agent_{uuid.uuid4()}\")\n",
|
||||||
|
"\n",
|
||||||
|
" orchestrator_response = orchestrator_agent.create_turn(\n",
|
||||||
|
" messages=[{\"role\": \"user\", \"content\": f\"Your task is to {task}. Here is some context: {context}\"}],\n",
|
||||||
|
" stream=False,\n",
|
||||||
|
" session_id=orchestrator_session_id,\n",
|
||||||
|
" )\n",
|
||||||
|
"\n",
|
||||||
|
" orchestrator_result = json.loads(orchestrator_response.output_message.content)\n",
|
||||||
|
" rich.print(f\"[cyan] Orchestrator Analysis: {orchestrator_result['analysis']} [/cyan]\")\n",
|
||||||
|
" pprint(orchestrator_result['tasks'])\n",
|
||||||
|
" \n",
|
||||||
|
" workers = {}\n",
|
||||||
|
" # spawn multiple worker agents\n",
|
||||||
|
" for task in orchestrator_result[\"tasks\"]:\n",
|
||||||
|
" worker_agent = Agent(client, worker_agent_config)\n",
|
||||||
|
" worker_session_id = worker_agent.create_session(session_name=f\"worker_agent_{uuid.uuid4()}\")\n",
|
||||||
|
" workers[task[\"type\"]] = worker_agent\n",
|
||||||
|
" \n",
|
||||||
|
" worker_response = worker_agent.create_turn(\n",
|
||||||
|
" messages=[{\"role\": \"user\", \"content\": f\"Your task is to {task['description']}.\"}],\n",
|
||||||
|
" stream=False,\n",
|
||||||
|
" session_id=worker_session_id,\n",
|
||||||
|
" )\n",
|
||||||
|
" rich.print(f\"[bold yellow] >>> Worker {task['type']} <<< [/bold yellow]\")\n",
|
||||||
|
" rich.print(worker_response.output_message.content)\n",
|
||||||
|
" \n",
|
||||||
|
" return orchestrator_agent, workers"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 86,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\"> Orchestrator Analysis: To effectively promote the new eco-friendly water bottle to environmentally conscious </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">millennials, it's crucial to highlight its key features in a way that resonates with this audience. The product </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">description should not only emphasize the bottle's eco-friendly aspects, such as being plastic-free, but also its </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">practical benefits, like insulation and durability, backed by a lifetime warranty. Different approaches can serve </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">various aspects of the task, such as focusing on the environmental impact, the user experience, or the product's </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">technical specifications. A formal approach can delve into the specifics of the materials used and how they </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">contribute to the eco-friendly nature of the product, while a conversational tone can connect with the audience on </span>\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080\">an emotional level, discussing how the product can be part of a larger sustainable lifestyle. </span>\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"\u001b[36m Orchestrator Analysis: To effectively promote the new eco-friendly water bottle to environmentally conscious \u001b[0m\n",
|
||||||
|
"\u001b[36mmillennials, it's crucial to highlight its key features in a way that resonates with this audience. The product \u001b[0m\n",
|
||||||
|
"\u001b[36mdescription should not only emphasize the bottle's eco-friendly aspects, such as being plastic-free, but also its \u001b[0m\n",
|
||||||
|
"\u001b[36mpractical benefits, like insulation and durability, backed by a lifetime warranty. Different approaches can serve \u001b[0m\n",
|
||||||
|
"\u001b[36mvarious aspects of the task, such as focusing on the environmental impact, the user experience, or the product's \u001b[0m\n",
|
||||||
|
"\u001b[36mtechnical specifications. A formal approach can delve into the specifics of the materials used and how they \u001b[0m\n",
|
||||||
|
"\u001b[36mcontribute to the eco-friendly nature of the product, while a conversational tone can connect with the audience on \u001b[0m\n",
|
||||||
|
"\u001b[36man emotional level, discussing how the product can be part of a larger sustainable lifestyle. \u001b[0m\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">[</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">{</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">'type'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'formal'</span>,\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">'description'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Write a detailed, technical description focusing on the materials, manufacturing process, and specifications that make the water bottle eco-friendly and durable, emphasizing the plastic-free composition and lifetime warranty.'</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>,\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">{</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">'type'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'conversational'</span>,\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">'description'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'Craft an engaging narrative that speaks to millennials about how this water bottle fits into their eco-conscious lifestyle, highlighting the benefits of insulation for daily use and the peace of mind that comes with a lifetime warranty, all while contributing to a plastic-free future.'</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>,\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">{</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">'type'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'creative'</span>,\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">'description'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"Develop a compelling story or scenario that showcases the water bottle in action, perhaps through the eyes of a young adventurer or an urban dweller, emphasizing how the product's features enhance their experiences while aligning with their values of sustainability and environmental stewardship.\"</span>\n",
|
||||||
|
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>\n",
|
||||||
|
"<span style=\"font-weight: bold\">]</span>\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"\u001b[1m[\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ \u001b[0m\u001b[1m{\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ │ \u001b[0m\u001b[32m'type'\u001b[0m: \u001b[32m'formal'\u001b[0m,\n",
|
||||||
|
"\u001b[2;32m│ │ \u001b[0m\u001b[32m'description'\u001b[0m: \u001b[32m'Write a detailed, technical description focusing on the materials, manufacturing process, and specifications that make the water bottle eco-friendly and durable, emphasizing the plastic-free composition and lifetime warranty.'\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n",
|
||||||
|
"\u001b[2;32m│ \u001b[0m\u001b[1m{\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ │ \u001b[0m\u001b[32m'type'\u001b[0m: \u001b[32m'conversational'\u001b[0m,\n",
|
||||||
|
"\u001b[2;32m│ │ \u001b[0m\u001b[32m'description'\u001b[0m: \u001b[32m'Craft an engaging narrative that speaks to millennials about how this water bottle fits into their eco-conscious lifestyle, highlighting the benefits of insulation for daily use and the peace of mind that comes with a lifetime warranty, all while contributing to a plastic-free future.'\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n",
|
||||||
|
"\u001b[2;32m│ \u001b[0m\u001b[1m{\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ │ \u001b[0m\u001b[32m'type'\u001b[0m: \u001b[32m'creative'\u001b[0m,\n",
|
||||||
|
"\u001b[2;32m│ │ \u001b[0m\u001b[32m'description'\u001b[0m: \u001b[32m\"Develop a compelling story or scenario that showcases the water bottle in action, perhaps through the eyes of a young adventurer or an urban dweller, emphasizing how the product's features enhance their experiences while aligning with their values of sustainability and environmental stewardship.\"\u001b[0m\n",
|
||||||
|
"\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n",
|
||||||
|
"\u001b[1m]\u001b[0m\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> Worker formal </span>\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"\u001b[1;33m Worker formal \u001b[0m\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Response: \n",
|
||||||
|
"\n",
|
||||||
|
"The eco-friendly water bottle is a masterpiece of innovative design and sustainable engineering, boasting a \n",
|
||||||
|
"plastic-free composition that sets it apart from traditional bottled water containers. At its core, this bottle is \n",
|
||||||
|
"made from a unique blend of materials, carefully selected for their durability, non-toxicity, and environmental \n",
|
||||||
|
"friendliness.\n",
|
||||||
|
"\n",
|
||||||
|
"The primary material used in the construction of the bottle is <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">18</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span> stainless steel, a food-grade metal alloy \n",
|
||||||
|
"renowned for its resistance to corrosion, durability, and ability to withstand extreme temperatures. This steel is \n",
|
||||||
|
"sourced from reputable suppliers who adhere to stringent environmental and social responsibility standards, \n",
|
||||||
|
"ensuring a minimal carbon footprint throughout the production process.\n",
|
||||||
|
"\n",
|
||||||
|
"To further enhance the bottle's eco-credentials, the inner lining is crafted from a specialized, BPA-free silicone \n",
|
||||||
|
"coating. This non-toxic and flexible material prevents the growth of bacteria and other microorganisms, \n",
|
||||||
|
"guaranteeing a clean and fresh drinking experience. The silicone coating is also resistant to scratches and fading,\n",
|
||||||
|
"maintaining the bottle's aesthetic appeal over time.\n",
|
||||||
|
"\n",
|
||||||
|
"The manufacturing process itself is a testament to the company's commitment to sustainability. The bottle is \n",
|
||||||
|
"produced using a state-of-the-art, precision welding technique that minimizes waste and reduces energy consumption.\n",
|
||||||
|
"The welding process is also free from toxic chemicals and emissions, ensuring a safe working environment for the \n",
|
||||||
|
"production team.\n",
|
||||||
|
"\n",
|
||||||
|
"In terms of specifications, the eco-friendly water bottle boasts an impressive array of features that contribute to\n",
|
||||||
|
"its durability and eco-friendliness. The bottle has a capacity of <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">27</span> ounces, making it an ideal size for daily \n",
|
||||||
|
"hydration needs. The double-walled insulation ensures that drinks remain at the optimal temperature for hours, \n",
|
||||||
|
"whether hot or cold, reducing the need for single-use cups and plastic water bottles.\n",
|
||||||
|
"\n",
|
||||||
|
"The bottle's dimensions are carefully designed for portability and convenience, measuring <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10.5</span> inches in height and\n",
|
||||||
|
"<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3.5</span> inches in diameter. The weight of the bottle is a mere <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13.5</span> ounces, making it easy to carry on-the-go. The \n",
|
||||||
|
"screw-top lid is designed with a secure, leak-proof seal, preventing spills and accidents.\n",
|
||||||
|
"\n",
|
||||||
|
"One of the most significant advantages of this eco-friendly water bottle is its lifetime warranty. The manufacturer\n",
|
||||||
|
"is so confident in the quality and durability of the product that it offers a comprehensive warranty, covering \n",
|
||||||
|
"defects and damage for the entire lifespan of the bottle. This warranty not only provides peace of mind for \n",
|
||||||
|
"customers but also encourages a shift away from disposable, single-use water bottles and towards a more \n",
|
||||||
|
"sustainable, long-term approach to hydration.\n",
|
||||||
|
"\n",
|
||||||
|
"In conclusion, the eco-friendly water bottle is a game-changer in the\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"Response: \n",
|
||||||
|
"\n",
|
||||||
|
"The eco-friendly water bottle is a masterpiece of innovative design and sustainable engineering, boasting a \n",
|
||||||
|
"plastic-free composition that sets it apart from traditional bottled water containers. At its core, this bottle is \n",
|
||||||
|
"made from a unique blend of materials, carefully selected for their durability, non-toxicity, and environmental \n",
|
||||||
|
"friendliness.\n",
|
||||||
|
"\n",
|
||||||
|
"The primary material used in the construction of the bottle is \u001b[1;36m18\u001b[0m/\u001b[1;36m8\u001b[0m stainless steel, a food-grade metal alloy \n",
|
||||||
|
"renowned for its resistance to corrosion, durability, and ability to withstand extreme temperatures. This steel is \n",
|
||||||
|
"sourced from reputable suppliers who adhere to stringent environmental and social responsibility standards, \n",
|
||||||
|
"ensuring a minimal carbon footprint throughout the production process.\n",
|
||||||
|
"\n",
|
||||||
|
"To further enhance the bottle's eco-credentials, the inner lining is crafted from a specialized, BPA-free silicone \n",
|
||||||
|
"coating. This non-toxic and flexible material prevents the growth of bacteria and other microorganisms, \n",
|
||||||
|
"guaranteeing a clean and fresh drinking experience. The silicone coating is also resistant to scratches and fading,\n",
|
||||||
|
"maintaining the bottle's aesthetic appeal over time.\n",
|
||||||
|
"\n",
|
||||||
|
"The manufacturing process itself is a testament to the company's commitment to sustainability. The bottle is \n",
|
||||||
|
"produced using a state-of-the-art, precision welding technique that minimizes waste and reduces energy consumption.\n",
|
||||||
|
"The welding process is also free from toxic chemicals and emissions, ensuring a safe working environment for the \n",
|
||||||
|
"production team.\n",
|
||||||
|
"\n",
|
||||||
|
"In terms of specifications, the eco-friendly water bottle boasts an impressive array of features that contribute to\n",
|
||||||
|
"its durability and eco-friendliness. The bottle has a capacity of \u001b[1;36m27\u001b[0m ounces, making it an ideal size for daily \n",
|
||||||
|
"hydration needs. The double-walled insulation ensures that drinks remain at the optimal temperature for hours, \n",
|
||||||
|
"whether hot or cold, reducing the need for single-use cups and plastic water bottles.\n",
|
||||||
|
"\n",
|
||||||
|
"The bottle's dimensions are carefully designed for portability and convenience, measuring \u001b[1;36m10.5\u001b[0m inches in height and\n",
|
||||||
|
"\u001b[1;36m3.5\u001b[0m inches in diameter. The weight of the bottle is a mere \u001b[1;36m13.5\u001b[0m ounces, making it easy to carry on-the-go. The \n",
|
||||||
|
"screw-top lid is designed with a secure, leak-proof seal, preventing spills and accidents.\n",
|
||||||
|
"\n",
|
||||||
|
"One of the most significant advantages of this eco-friendly water bottle is its lifetime warranty. The manufacturer\n",
|
||||||
|
"is so confident in the quality and durability of the product that it offers a comprehensive warranty, covering \n",
|
||||||
|
"defects and damage for the entire lifespan of the bottle. This warranty not only provides peace of mind for \n",
|
||||||
|
"customers but also encourages a shift away from disposable, single-use water bottles and towards a more \n",
|
||||||
|
"sustainable, long-term approach to hydration.\n",
|
||||||
|
"\n",
|
||||||
|
"In conclusion, the eco-friendly water bottle is a game-changer in the\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> Worker conversational </span>\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"\u001b[1;33m Worker conversational \u001b[0m\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Response:\n",
|
||||||
|
"\n",
|
||||||
|
"Imagine a world where the great outdoors is still great, where the air is fresh, the oceans are clean, and the \n",
|
||||||
|
"future is bright. As a millennial, you're likely no stranger to the importance of living an eco-conscious \n",
|
||||||
|
"lifestyle. You're probably already making conscious choices about the food you eat, the clothes you wear, and the \n",
|
||||||
|
"way you travel. But have you ever stopped to think about the humble water bottle that's always by your side?\n",
|
||||||
|
"\n",
|
||||||
|
"For many of us, staying hydrated on-the-go is a top priority. But let's be real – single-use plastic water bottles \n",
|
||||||
|
"are so last season. Not only do they contribute to the staggering <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span> million tons of plastic waste that enter our \n",
|
||||||
|
"oceans every year, but they're also a hassle to carry around and a waste of money in the long run.\n",
|
||||||
|
"\n",
|
||||||
|
"That's where our game-changing water bottle comes in. Made with durable, BPA-free materials and featuring advanced \n",
|
||||||
|
"insulation technology, this bottle is designed to keep your drinks hot or cold for hours on end. Whether you're \n",
|
||||||
|
"hiking through the mountains, biking through the city, or just need a refreshing drink at your desk, our bottle has\n",
|
||||||
|
"got you covered.\n",
|
||||||
|
"\n",
|
||||||
|
"But what really sets our bottle apart is its commitment to a plastic-free future. By choosing a reusable water \n",
|
||||||
|
"bottle, you're not only reducing your own plastic waste, but you're also supporting a movement that's dedicated to \n",
|
||||||
|
"making a positive impact on the planet. And with our lifetime warranty, you can have peace of mind knowing that \n",
|
||||||
|
"your bottle is built to last – and that we've got your back if anything ever goes wrong.\n",
|
||||||
|
"\n",
|
||||||
|
"So what does this mean for your daily life? For starters, you'll be able to stay hydrated and energized wherever \n",
|
||||||
|
"you go, without having to worry about wasting plastic or money. You'll also be joining a community of like-minded \n",
|
||||||
|
"individuals who are passionate about creating a more sustainable future. And with our bottle's sleek design and \n",
|
||||||
|
"range of stylish colors, you'll be making a statement that's as much about your personal style as it is about your \n",
|
||||||
|
"values.\n",
|
||||||
|
"\n",
|
||||||
|
"In short, our water bottle is more than just a product – it's a symbol of your commitment to a better world. It's a\n",
|
||||||
|
"reminder that even the smallest choices we make can have a big impact, and that together, we can create a future \n",
|
||||||
|
"that's free from plastic waste and full of possibilities. So why not make the switch today, and join the movement \n",
|
||||||
|
"towards a more sustainable tomorrow?\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"Response:\n",
|
||||||
|
"\n",
|
||||||
|
"Imagine a world where the great outdoors is still great, where the air is fresh, the oceans are clean, and the \n",
|
||||||
|
"future is bright. As a millennial, you're likely no stranger to the importance of living an eco-conscious \n",
|
||||||
|
"lifestyle. You're probably already making conscious choices about the food you eat, the clothes you wear, and the \n",
|
||||||
|
"way you travel. But have you ever stopped to think about the humble water bottle that's always by your side?\n",
|
||||||
|
"\n",
|
||||||
|
"For many of us, staying hydrated on-the-go is a top priority. But let's be real – single-use plastic water bottles \n",
|
||||||
|
"are so last season. Not only do they contribute to the staggering \u001b[1;36m8\u001b[0m million tons of plastic waste that enter our \n",
|
||||||
|
"oceans every year, but they're also a hassle to carry around and a waste of money in the long run.\n",
|
||||||
|
"\n",
|
||||||
|
"That's where our game-changing water bottle comes in. Made with durable, BPA-free materials and featuring advanced \n",
|
||||||
|
"insulation technology, this bottle is designed to keep your drinks hot or cold for hours on end. Whether you're \n",
|
||||||
|
"hiking through the mountains, biking through the city, or just need a refreshing drink at your desk, our bottle has\n",
|
||||||
|
"got you covered.\n",
|
||||||
|
"\n",
|
||||||
|
"But what really sets our bottle apart is its commitment to a plastic-free future. By choosing a reusable water \n",
|
||||||
|
"bottle, you're not only reducing your own plastic waste, but you're also supporting a movement that's dedicated to \n",
|
||||||
|
"making a positive impact on the planet. And with our lifetime warranty, you can have peace of mind knowing that \n",
|
||||||
|
"your bottle is built to last – and that we've got your back if anything ever goes wrong.\n",
|
||||||
|
"\n",
|
||||||
|
"So what does this mean for your daily life? For starters, you'll be able to stay hydrated and energized wherever \n",
|
||||||
|
"you go, without having to worry about wasting plastic or money. You'll also be joining a community of like-minded \n",
|
||||||
|
"individuals who are passionate about creating a more sustainable future. And with our bottle's sleek design and \n",
|
||||||
|
"range of stylish colors, you'll be making a statement that's as much about your personal style as it is about your \n",
|
||||||
|
"values.\n",
|
||||||
|
"\n",
|
||||||
|
"In short, our water bottle is more than just a product – it's a symbol of your commitment to a better world. It's a\n",
|
||||||
|
"reminder that even the smallest choices we make can have a big impact, and that together, we can create a future \n",
|
||||||
|
"that's free from plastic waste and full of possibilities. So why not make the switch today, and join the movement \n",
|
||||||
|
"towards a more sustainable tomorrow?\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> Worker creative </span>\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"\u001b[1;33m Worker creative \u001b[0m\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Response: \n",
|
||||||
|
"\n",
|
||||||
|
"As the sun rises over the bustling city, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span>-year-old Maya prepares for her daily adventure, grabbing her trusty \n",
|
||||||
|
"water bottle, the <span style=\"color: #008000; text-decoration-color: #008000\">\"EcoHydrate,\"</span> before heading out the door. This isn't just any water bottle – it's made from <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">80</span>% \n",
|
||||||
|
"recycled materials, is BPA-free, and has a built-in filter that ensures every sip is clean and refreshing, no \n",
|
||||||
|
"matter the water source. For Maya, who has grown up learning about the importance of sustainability and reducing \n",
|
||||||
|
"plastic waste, the EcoHydrate is more than just a water bottle; it's a symbol of her commitment to protecting the \n",
|
||||||
|
"planet.\n",
|
||||||
|
"\n",
|
||||||
|
"Maya's day begins in the city's urban garden, where she and her friends are working on a community project to \n",
|
||||||
|
"create a green oasis amidst the concrete jungle. As they plant trees, build a small pond, and lay out a path made \n",
|
||||||
|
"from recycled plastic, Maya uses her EcoHydrate to stay hydrated. The bottle's insulation keeps her drinks cool \n",
|
||||||
|
"even under the hot sun, and its durable design withstands the occasional drop without leaking. But what Maya loves \n",
|
||||||
|
"most about her EcoHydrate is the impact it has on reducing her carbon footprint. By using a refillable bottle, she \n",
|
||||||
|
"avoids buying plastic water bottles, which she knows contribute to the staggering amount of waste in oceans and \n",
|
||||||
|
"landfills.\n",
|
||||||
|
"\n",
|
||||||
|
"After a morning of gardening, Maya heads to the nearby park for a hike. She fills her EcoHydrate from a water \n",
|
||||||
|
"fountain, confident in the bottle's filter to remove any impurities. As she climbs, the scenic views of the city \n",
|
||||||
|
"remind her of why she's so passionate about environmental stewardship. The EcoHydrate becomes a constant companion,\n",
|
||||||
|
"a reminder of her values and a tool that enables her to live them out daily.\n",
|
||||||
|
"\n",
|
||||||
|
"Maya's story isn't unique; it echoes the sentiments of many urban dwellers who are increasingly conscious of their \n",
|
||||||
|
"environmental impact. Sarah, a freelance writer living in the heart of the city, relies on her EcoHydrate as she \n",
|
||||||
|
"navigates her busy day. From grabbing a quick coffee to meeting clients in different parts of the city, Sarah's \n",
|
||||||
|
"EcoHydrate is always by her side. The bottle's sleek design fits perfectly into her bag, and its capacity ensures \n",
|
||||||
|
"she stays hydrated throughout the day without needing to refill frequently.\n",
|
||||||
|
"\n",
|
||||||
|
"What resonates with Sarah is the EcoHydrate's alignment with her personal values. As someone who chooses public \n",
|
||||||
|
"transport, buys local produce, and avoids single-use plastics, the EcoHydrate is\n",
|
||||||
|
"</pre>\n"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
"Response: \n",
|
||||||
|
"\n",
|
||||||
|
"As the sun rises over the bustling city, \u001b[1;36m12\u001b[0m-year-old Maya prepares for her daily adventure, grabbing her trusty \n",
|
||||||
|
"water bottle, the \u001b[32m\"EcoHydrate,\"\u001b[0m before heading out the door. This isn't just any water bottle – it's made from \u001b[1;36m80\u001b[0m% \n",
|
||||||
|
"recycled materials, is BPA-free, and has a built-in filter that ensures every sip is clean and refreshing, no \n",
|
||||||
|
"matter the water source. For Maya, who has grown up learning about the importance of sustainability and reducing \n",
|
||||||
|
"plastic waste, the EcoHydrate is more than just a water bottle; it's a symbol of her commitment to protecting the \n",
|
||||||
|
"planet.\n",
|
||||||
|
"\n",
|
||||||
|
"Maya's day begins in the city's urban garden, where she and her friends are working on a community project to \n",
|
||||||
|
"create a green oasis amidst the concrete jungle. As they plant trees, build a small pond, and lay out a path made \n",
|
||||||
|
"from recycled plastic, Maya uses her EcoHydrate to stay hydrated. The bottle's insulation keeps her drinks cool \n",
|
||||||
|
"even under the hot sun, and its durable design withstands the occasional drop without leaking. But what Maya loves \n",
|
||||||
|
"most about her EcoHydrate is the impact it has on reducing her carbon footprint. By using a refillable bottle, she \n",
|
||||||
|
"avoids buying plastic water bottles, which she knows contribute to the staggering amount of waste in oceans and \n",
|
||||||
|
"landfills.\n",
|
||||||
|
"\n",
|
||||||
|
"After a morning of gardening, Maya heads to the nearby park for a hike. She fills her EcoHydrate from a water \n",
|
||||||
|
"fountain, confident in the bottle's filter to remove any impurities. As she climbs, the scenic views of the city \n",
|
||||||
|
"remind her of why she's so passionate about environmental stewardship. The EcoHydrate becomes a constant companion,\n",
|
||||||
|
"a reminder of her values and a tool that enables her to live them out daily.\n",
|
||||||
|
"\n",
|
||||||
|
"Maya's story isn't unique; it echoes the sentiments of many urban dwellers who are increasingly conscious of their \n",
|
||||||
|
"environmental impact. Sarah, a freelance writer living in the heart of the city, relies on her EcoHydrate as she \n",
|
||||||
|
"navigates her busy day. From grabbing a quick coffee to meeting clients in different parts of the city, Sarah's \n",
|
||||||
|
"EcoHydrate is always by her side. The bottle's sleek design fits perfectly into her bag, and its capacity ensures \n",
|
||||||
|
"she stays hydrated throughout the day without needing to refill frequently.\n",
|
||||||
|
"\n",
|
||||||
|
"What resonates with Sarah is the EcoHydrate's alignment with her personal values. As someone who chooses public \n",
|
||||||
|
"transport, buys local produce, and avoids single-use plastics, the EcoHydrate is\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "display_data"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"orchestrator_agent, workers = orchestrator_worker_workflow(\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",
|
||||||
|
")"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue