Skip to content

Commit

Permalink
Notebook tidy.
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sze <[email protected]>
  • Loading branch information
marklysze committed Dec 4, 2024
1 parent b33d8bb commit 3f2b8d0
Showing 1 changed file with 4 additions and 53 deletions.
57 changes: 4 additions & 53 deletions notebook/agentchat_swarm_graphrag_trip_planner.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,6 @@
"Remember: Change your host, port, and preferred OpenAI model if needed (gpt-4o-mini and better is recommended)."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
".\n"
]
}
],
"source": [
"print(os.curdir)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -873,50 +856,18 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Context: {'itinerary_confirmed': True, 'itinerary': '### Day 1:\\n- **Morning Attraction:** \\n - **Type:** Attraction \\n - **Location:** Colosseum \\n - **City:** Rome \\n - **Description:** An ancient amphitheater known for gladiatorial contests and public spectacles.\\n\\n- **Lunch:** \\n - **Type:** Restaurant \\n - **Location:** Trattoria da Enzo \\n - **City:** Rome \\n - **Description:** A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\n\\n- **Afternoon Attraction:** \\n - **Type:** Attraction \\n - **Location:** Trevi Fountain \\n - **City:** Rome \\n - **Description:** A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\n\\n- **Dinner:** \\n - **Type:** Restaurant \\n - **Location:** Armando al Pantheon \\n - **City:** Rome \\n - **Description:** Traditional Roman cuisine since 1961, located near the Pantheon.\\n\\n### Day 2:\\n- **Morning Attraction:** \\n - **Type:** Attraction \\n - **Location:** Vatican Museums \\n - **City:** Rome \\n - **Description:** A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\n\\n- **Lunch:** \\n - **Type:** Restaurant \\n - **Location:** Osteria delle Commari \\n - **City:** Rome \\n - **Description:** Local home-style Roman restaurant near Vatican Museums.\\n\\n- **Afternoon Attraction:** \\n - **Type:** Attraction \\n - **Location:** Basilica di Santa Maria Maggiore \\n - **City:** Rome \\n - **Description:** A major basilica in Rome, known for its rich history and impressive architecture.\\n\\n- **Dinner:** \\n - **Type:** Restaurant \\n - **Location:** Tonnarello \\n - **City:** Rome \\n - **Description:** Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.'}\n"
]
}
],
"outputs": [],
"source": [
"print(f\"Context: {context_variables}\")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'content': 'I want to go to Rome for a couple of days. Can you help me plan my trip?', 'role': 'assistant', 'name': 'customer'}\n",
"{'content': \"Of course! I'd love to help you plan your trip to Rome. \\n\\nTo get started, could you please provide me with the following information:\\n1. How many days will you be staying in Rome?\\n2. What activities or attractions are you interested in? (e.g., historical sites, museums, shopping, dining, etc.)\\n3. Do you have any specific preferences for meals or restaurants? \\n\\nOnce I have this information, I can start creating an itinerary for you!\", 'name': 'planner_agent', 'role': 'user'}\n",
"{'content': '2 days please, I want lunch and dinner, with an attraction to see in the morning and after lunch.', 'role': 'assistant', 'name': 'customer'}\n",
"{'content': 'None', 'tool_calls': [{'id': 'call_2dmMbckU5YjaCsL6Y8pWbrdK', 'function': {'arguments': '{}', 'name': 'transfer_to_graphrag_agent'}, 'type': 'function'}], 'name': 'planner_agent', 'role': 'assistant'}\n",
"{'content': 'SwarmAgent --> graphrag_agent', 'tool_responses': [{'tool_call_id': 'call_2dmMbckU5YjaCsL6Y8pWbrdK', 'role': 'tool', 'content': 'SwarmAgent --> graphrag_agent'}], 'name': 'Tool_Execution', 'role': 'tool'}\n",
"{'content': \"Restaurants in Rome:\\n- Trattoria da Enzo: A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\n- Il Pagliaccio: An elegant Michelin-starred restaurant offering contemporary Italian cuisine.\\n- Tonnarello: Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.\\n- Osteria delle Commari: Local home style Roman restaurant near Vatican Museums.\\n- Armando al Pantheon: Traditional Roman cuisine since 1961 near the Pantheon.\\n- Salumeria Roscioli Ristorante: Known for pasta alla gricia and amatriciana, and boasts an impressive wine cellar.\\n- L'Arcangelo: Famous for supplì (Roman rice balls) and gnocchi on Thursdays.\\n\\nAttractions in Rome:\\n- Colosseum: An ancient amphitheater known for gladiatorial contests and public spectacles.\\n- Vatican Museums: A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\n- Trevi Fountain: A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\n- Basilica di Santa Maria Maggiore: A major basilica in Rome, known for its rich history and impressive architecture.\", 'name': 'graphrag_agent', 'role': 'user'}\n",
"{'content': \"Great! Here's a preliminary itinerary for your 2-day trip to Rome, including attractions and meals. \\n\\n### Day 1:\\n- **Morning Attraction:** \\n - **Type:** Attraction \\n - **Location:** Colosseum \\n - **City:** Rome \\n - **Description:** An ancient amphitheater known for gladiatorial contests and public spectacles.\\n\\n- **Lunch:** \\n - **Type:** Restaurant \\n - **Location:** Trattoria da Enzo \\n - **City:** Rome \\n - **Description:** A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\n\\n- **Afternoon Attraction:** \\n - **Type:** Attraction \\n - **Location:** Trevi Fountain \\n - **City:** Rome \\n - **Description:** A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\n\\n- **Dinner:** \\n - **Type:** Restaurant \\n - **Location:** Armando al Pantheon \\n - **City:** Rome \\n - **Description:** Traditional Roman cuisine since 1961, located near the Pantheon.\\n\\n### Day 2:\\n- **Morning Attraction:** \\n - **Type:** Attraction \\n - **Location:** Vatican Museums \\n - **City:** Rome \\n - **Description:** A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\n\\n- **Lunch:** \\n - **Type:** Restaurant \\n - **Location:** Osteria delle Commari \\n - **City:** Rome \\n - **Description:** Local home-style Roman restaurant near Vatican Museums.\\n\\n- **Afternoon Attraction:** \\n - **Type:** Attraction \\n - **Location:** Basilica di Santa Maria Maggiore \\n - **City:** Rome \\n - **Description:** A major basilica in Rome, known for its rich history and impressive architecture.\\n\\n- **Dinner:** \\n - **Type:** Restaurant \\n - **Location:** Il Pagliaccio \\n - **City:** Rome \\n - **Description:** An elegant Michelin-starred restaurant offering contemporary Italian cuisine.\\n\\nPlease review this itinerary and let me know if it looks good to you or if you'd like to make any adjustments!\", 'name': 'planner_agent', 'role': 'user'}\n",
"{'content': \"I've eaten at Il Pagliaccio and didn't like it.\", 'role': 'assistant', 'name': 'customer'}\n",
"{'content': 'None', 'tool_calls': [{'id': 'call_8RcnbYXeN4Hq862VMhtOA9Rl', 'function': {'arguments': '{}', 'name': 'transfer_to_graphrag_agent'}, 'type': 'function'}], 'name': 'planner_agent', 'role': 'assistant'}\n",
"{'content': 'SwarmAgent --> graphrag_agent', 'tool_responses': [{'tool_call_id': 'call_8RcnbYXeN4Hq862VMhtOA9Rl', 'role': 'tool', 'content': 'SwarmAgent --> graphrag_agent'}], 'name': 'Tool_Execution', 'role': 'tool'}\n",
"{'content': \"Restaurants in Rome:\\n- Trattoria da Enzo: A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\n- Tonnarello: Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.\\n- Osteria delle Commari: Local home-style Roman restaurant near Vatican Museums.\\n- Armando al Pantheon: Traditional Roman cuisine since 1961 near the Pantheon.\\n- Salumeria Roscioli Ristorante: Known for pasta alla gricia and amatriciana, and boasts an impressive wine cellar.\\n- L'Arcangelo: Famous for supplì (Roman rice balls) and gnocchi on Thursdays.\\n\\nAttractions in Rome:\\n- Colosseum: An ancient amphitheater known for gladiatorial contests and public spectacles.\\n- Vatican Museums: A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\n- Trevi Fountain: A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\n- Basilica di Santa Maria Maggiore: A major basilica in Rome, known for its rich history and impressive architecture.\", 'name': 'graphrag_agent', 'role': 'user'}\n",
"{'content': \"Thank you for the feedback! Here's an updated itinerary with a different restaurant for your second dinner:\\n\\n### Day 1:\\n- **Morning Attraction:** \\n - **Type:** Attraction \\n - **Location:** Colosseum \\n - **City:** Rome \\n - **Description:** An ancient amphitheater known for gladiatorial contests and public spectacles.\\n\\n- **Lunch:** \\n - **Type:** Restaurant \\n - **Location:** Trattoria da Enzo \\n - **City:** Rome \\n - **Description:** A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\n\\n- **Afternoon Attraction:** \\n - **Type:** Attraction \\n - **Location:** Trevi Fountain \\n - **City:** Rome \\n - **Description:** A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\n\\n- **Dinner:** \\n - **Type:** Restaurant \\n - **Location:** Armando al Pantheon \\n - **City:** Rome \\n - **Description:** Traditional Roman cuisine since 1961, located near the Pantheon.\\n\\n### Day 2:\\n- **Morning Attraction:** \\n - **Type:** Attraction \\n - **Location:** Vatican Museums \\n - **City:** Rome \\n - **Description:** A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\n\\n- **Lunch:** \\n - **Type:** Restaurant \\n - **Location:** Osteria delle Commari \\n - **City:** Rome \\n - **Description:** Local home-style Roman restaurant near Vatican Museums.\\n\\n- **Afternoon Attraction:** \\n - **Type:** Attraction \\n - **Location:** Basilica di Santa Maria Maggiore \\n - **City:** Rome \\n - **Description:** A major basilica in Rome, known for its rich history and impressive architecture.\\n\\n- **Dinner:** \\n - **Type:** Restaurant \\n - **Location:** Tonnarello \\n - **City:** Rome \\n - **Description:** Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.\\n\\nPlease take a look at this updated itinerary and let me know if you're happy with it or if you'd like to make further changes!\", 'name': 'planner_agent', 'role': 'user'}\n",
"{'content': 'Great, lock it in.', 'role': 'assistant', 'name': 'customer'}\n",
"{'content': 'None', 'tool_calls': [{'id': 'call_yZeiuwaTMJIwthHTxUt7NGEx', 'function': {'arguments': '{\"final_itinerary\":\"### Day 1:\\\\n- **Morning Attraction:** \\\\n - **Type:** Attraction \\\\n - **Location:** Colosseum \\\\n - **City:** Rome \\\\n - **Description:** An ancient amphitheater known for gladiatorial contests and public spectacles.\\\\n\\\\n- **Lunch:** \\\\n - **Type:** Restaurant \\\\n - **Location:** Trattoria da Enzo \\\\n - **City:** Rome \\\\n - **Description:** A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\\\n\\\\n- **Afternoon Attraction:** \\\\n - **Type:** Attraction \\\\n - **Location:** Trevi Fountain \\\\n - **City:** Rome \\\\n - **Description:** A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\\\n\\\\n- **Dinner:** \\\\n - **Type:** Restaurant \\\\n - **Location:** Armando al Pantheon \\\\n - **City:** Rome \\\\n - **Description:** Traditional Roman cuisine since 1961, located near the Pantheon.\\\\n\\\\n### Day 2:\\\\n- **Morning Attraction:** \\\\n - **Type:** Attraction \\\\n - **Location:** Vatican Museums \\\\n - **City:** Rome \\\\n - **Description:** A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\\\n\\\\n- **Lunch:** \\\\n - **Type:** Restaurant \\\\n - **Location:** Osteria delle Commari \\\\n - **City:** Rome \\\\n - **Description:** Local home-style Roman restaurant near Vatican Museums.\\\\n\\\\n- **Afternoon Attraction:** \\\\n - **Type:** Attraction \\\\n - **Location:** Basilica di Santa Maria Maggiore \\\\n - **City:** Rome \\\\n - **Description:** A major basilica in Rome, known for its rich history and impressive architecture.\\\\n\\\\n- **Dinner:** \\\\n - **Type:** Restaurant \\\\n - **Location:** Tonnarello \\\\n - **City:** Rome \\\\n - **Description:** Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.\"}', 'name': 'mark_itinerary_as_complete'}, 'type': 'function'}], 'name': 'planner_agent', 'role': 'assistant'}\n",
"{'content': 'Itinerary recorded and confirmed.', 'tool_responses': [{'tool_call_id': 'call_yZeiuwaTMJIwthHTxUt7NGEx', 'role': 'tool', 'content': 'Itinerary recorded and confirmed.'}], 'name': 'Tool_Execution', 'role': 'tool'}\n",
"{'content': '{\"days\":[{\"events\":[{\"type\":\"Attraction\",\"location\":\"Colosseum\",\"city\":\"Rome\",\"description\":\"An ancient amphitheater known for gladiatorial contests and public spectacles.\"},{\"type\":\"Restaurant\",\"location\":\"Trattoria da Enzo\",\"city\":\"Rome\",\"description\":\"A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\"},{\"type\":\"Attraction\",\"location\":\"Trevi Fountain\",\"city\":\"Rome\",\"description\":\"A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\"},{\"type\":\"Restaurant\",\"location\":\"Armando al Pantheon\",\"city\":\"Rome\",\"description\":\"Traditional Roman cuisine since 1961, located near the Pantheon.\"}]},{\"events\":[{\"type\":\"Attraction\",\"location\":\"Vatican Museums\",\"city\":\"Rome\",\"description\":\"A complex of museums and galleries showcasing works of art collected by Popes over centuries.\"},{\"type\":\"Restaurant\",\"location\":\"Osteria delle Commari\",\"city\":\"Rome\",\"description\":\"Local home-style Roman restaurant near Vatican Museums.\"},{\"type\":\"Attraction\",\"location\":\"Basilica di Santa Maria Maggiore\",\"city\":\"Rome\",\"description\":\"A major basilica in Rome, known for its rich history and impressive architecture.\"},{\"type\":\"Restaurant\",\"location\":\"Tonnarello\",\"city\":\"Rome\",\"description\":\"Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.\"}]}]}', 'name': 'structured_output_agent', 'role': 'user'}\n",
"{'content': 'Your itinerary for your 2-day trip to Rome is confirmed! Here are the details:\\n\\n### Day 1:\\n- **Morning Attraction:** \\n - **Location:** Colosseum \\n - **Description:** An ancient amphitheater known for gladiatorial contests and public spectacles.\\n\\n- **Lunch:** \\n - **Location:** Trattoria da Enzo \\n - **Description:** A cozy trattoria known for its traditional Roman dishes and welcoming atmosphere.\\n\\n- **Afternoon Attraction:** \\n - **Location:** Trevi Fountain \\n - **Description:** A Baroque fountain known for its stunning sculptures and tradition of tossing coins.\\n\\n- **Dinner:** \\n - **Location:** Armando al Pantheon \\n - **Description:** Traditional Roman cuisine since 1961, located near the Pantheon.\\n\\n### Day 2:\\n- **Morning Attraction:** \\n - **Location:** Vatican Museums \\n - **Description:** A complex of museums and galleries showcasing works of art collected by Popes over centuries.\\n\\n- **Lunch:** \\n - **Location:** Osteria delle Commari \\n - **Description:** Local home-style Roman restaurant near Vatican Museums.\\n\\n- **Afternoon Attraction:** \\n - **Location:** Basilica di Santa Maria Maggiore \\n - **Description:** A major basilica in Rome, known for its rich history and impressive architecture.\\n\\n- **Dinner:** \\n - **Location:** Tonnarello \\n - **Description:** Casual stop for pasta, meatballs & other simple Roman dishes, plus patio seating & acoustic guitar.\\n\\nIf you need any further assistance or modifications before your trip, just let me know. Enjoy your time in Rome!', 'name': 'route_timing_agent', 'role': 'user'}\n"
]
}
],
"outputs": [],
"source": [
"for message in chat_result.chat_history:\n",
" print(message)"
Expand Down

0 comments on commit 3f2b8d0

Please sign in to comment.