Skip to content

fix typo in python code #151

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
70 changes: 36 additions & 34 deletions 09-metacognition/code_samples/09-semantic-kernel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should commit notebooks that have clear outputs, and thus no execution count.

"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -34,7 +34,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -76,7 +76,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -99,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -157,13 +157,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>Book me a flight to Barcelona</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>To assist you with booking a flight to Barcelona, could you please let me know your preferred flight time?</div></div><hr>"
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>Book me a flight to Barcelona</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>Could you please let me know your preferred flight time? This way, I can find you the best options for your trip to Barcelona!</div></div><hr>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand All @@ -175,11 +175,11 @@
{
"data": {
"text/html": [
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>I prefer a later flight</div></div><div style='margin-bottom:10px'><details><summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary><div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap;'>Calling: get_flight_times()<br>Calling: ({\")<br>Calling: (destination)<br>Calling: (\":\")<br>Calling: (Barcelona)<br>Calling: (\"})<br>Result: Flight times for Barcelona: 08:30 AM, 02:15 PM, 10:45 PM</div></details></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>Based on your preference for later flights, I recommend the following available flight times to Barcelona:\n",
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>I prefer a later flight</div></div><div style='margin-bottom:10px'><details><summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary><div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap; font-size:14px; color:#333;>Calling: get_flight_times()<br>Calling: ({\")<br>Calling: (destination)<br>Calling: (\":\")<br>Calling: (Barcelona)<br>Calling: (\"})<br>Result: Flight times for Barcelona: 08:30 AM, 02:15 PM, 10:45 PM</div></details></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>I've noted your preference for a later flight. Based on your preference for later flights, I recommend the following options to Barcelona:\n",
"\n",
"- **10:45 PM**\n",
"\n",
"Would you like to book this flight, or should I look for alternative times?</div></div><hr>"
"Would you like to book this flight, or do you want to see any alternative times?</div></div><hr>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand All @@ -191,11 +191,7 @@
{
"data": {
"text/html": [
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>That is too late, choose the earliest flight</div></div><div style='margin-bottom:10px'><details><summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary><div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap;'>Calling: get_flight_times()<br>Calling: ({\"de)<br>Calling: (stina)<br>Calling: (tion\":)<br>Calling: ( \"Ba)<br>Calling: (rcelo)<br>Calling: (na\"})<br>Calling: get_flight_times()<br>Calling: ({\"de)<br>Calling: (stina)<br>Calling: (tion\":)<br>Calling: ( \"Ba)<br>Calling: (rcelo)<br>Calling: (na\"})<br>Result: Flight times for Barcelona: 08:30 AM, 02:15 PM, 10:45 PM<br>Result: Flight times for Barcelona: 08:30 AM, 02:15 PM, 10:45 PM</div></details></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>The earliest available flight to Barcelona is:\n",
"\n",
"- **08:30 AM**\n",
"\n",
"Would you like to book this flight?</div></div><hr>"
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>That is too late, choose the earliest flight</div></div><div style='margin-bottom:10px'><details><summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary><div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap; font-size:14px; color:#333;>Calling: get_flight_times()<br>Calling: ({\")<br>Calling: (destination)<br>Calling: (\":\")<br>Calling: (Barcelona)<br>Calling: (\"})<br>Result: Flight times for Barcelona: 08:30 AM, 02:15 PM, 10:45 PM<br>Calling: get_flight_times()<br>Calling: ({\"de)<br>Calling: (stina)<br>Calling: (tion\":)<br>Calling: ( \"Ba)<br>Calling: (rcelo)<br>Calling: (na\"})<br>Result: Flight times for Barcelona: 08:30 AM, 02:15 PM, 10:45 PM</div></details></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>The earliest flight to Barcelona is at **08:30 AM**. Would you like to book this flight?</div></div><hr>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand All @@ -207,19 +203,21 @@
{
"data": {
"text/html": [
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>I want to leave the same day, give me some suggestions of things to do in Barcelona during my layover if I take the last flight out</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>Since you are considering the **10:45 PM** flight to Barcelona, you will have a few hours of layover to explore the city! Here are some fantastic activities you can consider during your layover:\n",
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>I want to leave the same day, give me some suggestions of things to do in Barcelona during my layover if I take the last flight out</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>Since you're considering taking the last flight to Barcelona at **10:45 PM**, here are some great suggestions for things to do during your layover:\n",
"\n",
"1. **Explore La Rambla**: Stroll down this famous street lined with shops, cafes, and street performers. It's a vibrant area perfect for a quick walk.\n",
"\n",
"1. **Visit La Sagrada Familia**: This iconic basilica designed by Antoni Gaudí is a must-see. You can spend around1-2 hours exploring its unique architecture.\n",
"2. **Visit the Gothic Quarter**: Just a short walk away, the Gothic Quarter features beautiful medieval streets, the Barcelona Cathedral, and plenty of charming plazas.\n",
"\n",
"2. **Stroll through Park Güell**: Another masterpiece by Gaudí, this park features colorful mosaics, whimsical structures, and offers stunning views of the city. Plan for about1 hour.\n",
"3. **Relax at Park Güell**: If time allows, you can visit this famous park designed by Gaudí. The colorful mosaics and stunning architecture are breathtaking.\n",
"\n",
"3. **Explore the Gothic Quarter**: Wander through the narrow medieval streets, discover hidden plazas, and admire the beautiful architecture. You can spend about1-1.5 hours here.\n",
"4. **Enjoy Tapas**: Experience authentic Spanish cuisine at a local tapas bar. Dine at places like El Quim de la Boqueria or La Barceloneta for fresh seafood.\n",
"\n",
"4. **Sample Local Cuisine**: Enjoy a quick meal at a local tapas bar! Try traditional dishes like patatas bravas or jamón ibérico, which should take around1 hour.\n",
"5. **Catch the Magic Fountain Show**: If your layover permits and it’s operating, check the schedule for the Magic Fountain of Montjuïc. The lighting and music show is a must-see!\n",
"\n",
"5. **Relax at Barceloneta Beach**: If time allows, you can take a brief walk along the beach and enjoy the refreshing sea breeze (about1 hour).\n",
"6. **Visit Casa Batlló or Casa Milà**: Take a quick look at these famous Gaudí buildings, known for their unique architecture.\n",
"\n",
"Make sure to allow enough time to return to the airport, as you’ll want to be there well in advance of your flight. Enjoy your time in Barcelona!If you need further assistance or want to book your flight, just let me know!</div></div><hr>"
"Make sure to keep an eye on the time to ensure you get back to the airport without any stress! Would you like any more information on these activities?</div></div><hr>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand All @@ -231,15 +229,19 @@
{
"data": {
"text/html": [
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>I am streesed this wont be enough time</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>I understand your concern about timing! With a layover, it's essential to balance exploration and ensuring you can make it back to the airport on time. Since the **10:45 PM** flight means you may have to be back at the airport by around **9:15 PM**, you want to factor in travel time to and from Barcelona city center.\n",
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>I am streesed this wont be enough time</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>I understand your concern about having enough time during your layover, especially with a flight scheduled for **10:45 PM**. To make sure you can enjoy your time without feeling rushed, here are some quick and manageable activities you can do:\n",
"\n",
"Here's a revised suggestion that focuses on a shorter, more manageable experience during your layover:\n",
"1. **Grab a Quick Bite**: Head to a nearby tapas bar or café in the airport or close to it for a quick meal.\n",
"\n",
"1. **Visit La Sagrada Familia**: Since it's one of the most iconic sites, you could take a quick photo stop outside and admire the architecture without going inside. This way, you can spend just around **30-45 minutes**.\n",
"2. **Walk Along the Beach**: If you have a couple of hours, consider a quick stroll at Barceloneta Beach, which is not too far from the city center.\n",
"\n",
"2. **Walk in the Gothic Quarter**: Take a brief stroll through the vicinity (up to **1 hour**). You'll get to soak in the atmosphere without straying too far from the transport options back to the airport.\n",
"3. **Visit the Boqueria Market**: This famous food market is right off La Rambla and perfect for sampling local snacks and enjoying the vibrant atmosphere.\n",
"\n",
"3. **Grab a Quick Tapas Snack**: Find a nearby tapas bar to sample some quick local dishes (around **45 minutes**).Considering travel time to and from the airport, keeping these activities close or choosing just one option will ensure you have adequate time.Would you like to explore different flight options or activities? Your stress is understandable, and I'm here to help!</div></div><hr>"
"4. **Relax in a Park**: If you need a breather, visit Parc de la Ciutadella, a beautiful green space where you can relax.\n",
"\n",
"5. **See a Landmark**: If time permits, view one of the iconic landmarks like the Sagrada Familia or the Magic Fountain from a distance without entering.\n",
"\n",
"Make sure to plan your activities based on the time you have available. It's good to keep in mind that Barcelona's transportation can take some time, so factor that in when planning your return to the airport. Would you need assistance with transportation options as well?</div></div><hr>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand Down Expand Up @@ -307,7 +309,7 @@
" html_output += f\"<div style='margin-bottom:10px'>\"\n",
" html_output += f\"<details>\"\n",
" html_output += f\"<summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary>\"\n",
" html_output += f\"<div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap; font-size:14px; color:#333;\">\"\n",
" html_output += f\"<div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap; font-size:14px; color:#333;>\"\n",
" html_output += \"<br>\".join(function_calls)\n",
" html_output += f\"</div></details></div>\"\n",
"\n",
Expand All @@ -330,17 +332,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>Book me a flight to Paris</div></div><div style='margin-bottom:10px'><details><summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary><div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap;'>Calling: get_flight_times()<br>Calling: ({\")<br>Calling: (destination)<br>Calling: (\":\")<br>Calling: (Paris)<br>Calling: (\"})<br>Result: Flight times for Paris: 06:45 AM, 12:30 PM, 07:15 PM</div></details></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>Based on your previous preference for later flights, I recommend the following available flight times to Paris:\n",
"<div style='margin-bottom:10px'><div style='font-weight:bold'>User:</div><div style='margin-left:20px'>Book me a flight to Paris</div></div><div style='margin-bottom:20px'><div style='font-weight:bold'>TravelAgent:</div><div style='margin-left:20px; white-space:pre-wrap'>Based on your previous preference for later flights, I recommend the following option to Paris:\n",
"\n",
"- **07:15 PM**\n",
"- **10:45 PM**\n",
"\n",
"Would you like to book this flight, or should I look for alternative times?</div></div><hr>"
"Would you like to book this flight, or do you want to see any alternative times?</div></div><hr>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand Down Expand Up @@ -404,7 +406,7 @@
" html_output += f\"<div style='margin-bottom:10px'>\"\n",
" html_output += f\"<details>\"\n",
" html_output += f\"<summary style='cursor:pointer; font-weight:bold; color:#0066cc;'>Function Calls (click to expand)</summary>\"\n",
" html_output += f\"<div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap; font-size:14px; color:#333;\">\"\n",
" html_output += f\"<div style='margin:10px; padding:10px; background-color:#f8f8f8; border:1px solid #ddd; border-radius:4px; white-space:pre-wrap; font-size:14px; color:#333;>\"\n",
" html_output += \"<br>\".join(function_calls)\n",
" html_output += f\"</div></details></div>\"\n",
"\n",
Expand All @@ -430,7 +432,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -444,7 +446,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down