agiresearch / OpenAGI

OpenAGI: When LLM Meets Domain Experts
MIT License
1.82k stars 151 forks source link

feat: Implement TravelAgent for multi-tool travel planning #46 #60

Closed itsthemoon closed 1 month ago

itsthemoon commented 1 month ago

Description

This PR implements the TravelAgent feature for multi-tool travel planning. The changes include:

Related Issue

This PR addresses issue #46.

Further Work

dongyuanjushi commented 1 month ago

Cool! Could you also provide the screenshot of running travel agent? You can just leave the travel agent in the main.py in AIOS to run.

itsthemoon commented 1 month ago

Cool! Could you also provide the screenshot of running travel agent? You can just leave the travel agent in the main.py in AIOS to run.

It is very long to provide a full screenshot, but here is the output:


[TravelAgent] Initialized.

[TravelAgent] The task you need to solve is: I want to take a trip to Paris, France from July 4th to July 10th 2024 and I am traveling from New York City. Help me plan this trip.

[TravelAgent] Step 1: Identify the destination and search for hotel locations using the hotel_location_search tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 1: It will call the hotel_location_search with the params as {'query': 'Paris, France'}. The tool response is {"status": true, "message": "Success", "timestamp": 1715800382262, "data": [{"title": "Paris", "geoId": 187147, "documentId": "loc;187147;g187147", "trackingItems": "CITY", "secondaryText": "Ile-de-France, France"}]}

[TravelAgent] Step 2: Based on the hotel locations, find suitable hotels using the hotel_search tool, and select the best one.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 2: It will call the hotel_search with the params as {'geoId': '187147', 'checkIn': '2024-07-04', 'checkOut': '2024-07-10'}. The tool response is [{"id": "188729", "title": "Le Bristol Paris", "secondaryInfo": "8th Arr. - \u00c9lys\u00e9e", "bubbleRating": {"count": "2,299", "rating": 5}, "priceForDisplay": "$1,938", "priceDetails": null, "priceSummary": "View all 5 deals from $1,590"}, {"id": "228694", "title": "1. Hotel Malte - Astotel", "secondaryInfo": "Vivienne", "bubbleRating": {"count": "2,971", "rating": 5}, "priceForDisplay": "$387", "priceDetails": "Reserve now, pay at stay", "priceSummary": "View all 6 deals from $379"}]

[TravelAgent] Step 3: Get detailed information about the selected hotel using the get_hotel_details tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 3: It will call the get_hotel_details with the params as {'id': '188729', 'checkIn': '2024-07-04', 'checkOut': '2024-07-10'}. The tool response is {"name": "Le Bristol Paris", "rating": 5, "address": "112 rue du Faubourg Saint Honore 8th Arr., 75008 Paris France", "amenities": ["Amenities"], "description": [], "restaurantsNearby": [{"title": "114 Faubourg", "rating": 4.5, "primaryInfo": "\u20b9\u20b9\u20b9\u20b9 \u2022 French \u2022 European \u2022 Vegetarian Friendly", "distance": "33 m"}], "attractionsNearby": [{"title": "Bailly Gallery", "rating": "", "primaryInfo": "Art Galleries", "distance": "22 m"}]}

[TravelAgent] Step 4: Search for the nearest airport to the origin using the airport_search tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 4: It will call the airport_search with the params as {'query': 'New York City'}. The tool response is [{"name": "New York City, NY - All Airports (NYC)", "airportCode": "NYC", "coords": "40.713238,-74.00584"}]

[TravelAgent] Step 5: Search for the nearest airport to the destination using the airport_search tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 5: It will call the airport_search with the params as {'query': 'Paris, France'}. The tool response is [{"name": "Paris, France - All Airports (PAR)", "airportCode": "PAR", "coords": "48.857037,2.349401"}]

[TravelAgent] Step 6: Find available flights to the destination airport using the flight_search tool using the correct date.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 6: It will call the flight_search with the params as {'sourceAirportCode': 'NYC', 'date': '2024-07-04', 'returnDate': '2024-07-10', 'destinationAirportCode': 'PAR', 'itineraryType': 'ROUND_TRIP', 'sortOrder': 'ML_BEST_VALUE', 'classOfService': 'ECONOMY', 'numSeniors': 0, 'numAdults': 1}. The tool response is [{"originStationCode": "EWR", "destinationStationCode": "ORY", "departureDateTime": "2024-07-04T01:15:00-04:00", "arrivalDateTime": "2024-07-04T14:30:00+02:00", "classOfService": "ECONOMY", "marketingCarrierCode": "BF", "operatingCarrierCode": "BF", "flightNumber": 727, "numStops": 0, "distanceInKM": 5862.991, "isInternational": true}, {"originStationCode": "ORY", "destinationStationCode": "EWR", "departureDateTime": "2024-07-10T20:20:00+02:00", "arrivalDateTime": "2024-07-10T22:30:00-04:00", "classOfService": "ECONOMY", "marketingCarrierCode": "BF", "operatingCarrierCode": "BF", "flightNumber": 726, "numStops": 0, "distanceInKM": 5862.991, "isInternational": true}, {"originStationCode": "EWR", "destinationStationCode": "ORY", "departureDateTime": "2024-07-04T01:15:00-04:00", "arrivalDateTime": "2024-07-04T14:30:00+02:00", "classOfService": "ECONOMY", "marketingCarrierCode": "BF", "operatingCarrierCode": "BF", "flightNumber": 727, "numStops": 0, "distanceInKM": 5862.991, "isInternational": true}, {"originStationCode": "ORY", "destinationStationCode": "EWR", "departureDateTime": "2024-07-10T18:50:00+02:00", "arrivalDateTime": "2024-07-10T21:00:00-04:00", "classOfService": "ECONOMY", "marketingCarrierCode": "BF", "operatingCarrierCode": "BF", "flightNumber": 720, "numStops": 0, "distanceInKM": 5862.991, "isInternational": true}]

[TravelAgent] Step 7: Search for restaurant locations near destination using the restaurant_location_search tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 7: It will call the restaurant_location_search with the params as {'query': 'Paris, France'}. The tool response is [{"locationId": 187147, "localizedName": "Paris", "latitude": 48.857037, "longitude": 2.349401}]

[TravelAgent] Step 8: Based on the restaurant locations, find suitable restaurants using the restaurant_search tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 8: It will call the restaurant_search with the params as {'locationId': '187147'}. The tool response is [{"restaurantsId": "Restaurant_Review-g187147-d12714552-Reviews-Pizzeria_Arrivederci-Paris_Ile_de_France", "name": "Pizzeria Arrivederci", "averageRating": 5, "userReviewCount": 2752, "priceTag": "$$ - $$$", "establishmentTypeAndCuisineTags": ["Italian", "Pizza", "Mediterranean", "European", "Healthy", "Neapolitan", "Campania", "Sicilian", "Southern-Italian"]}, {"restaurantsId": "Restaurant_Review-g187147-d20208797-Reviews-Da_Giuseppe-Paris_Ile_de_France", "name": "Da Giuseppe", "averageRating": 5, "userReviewCount": 853, "priceTag": null, "establishmentTypeAndCuisineTags": ["Italian", "Pizza", "Healthy", "Romana", "Lazio", "Sicilian", "Central-Italian", "Southern-Italian"]}]

[TravelAgent] Step 9: Get detailed information about the selected restaurants using the get_restaurant_details tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 9: It will call the get_restaurant_details with the params as {'restaurantsId': 'Restaurant_Review-g187147-d12714552-Reviews-Pizzeria_Arrivederci-Paris_Ile_de_France'}. The tool response is {"name": "Pizzeria Arrivederci", "latitude": "48.84185", "longitude": "2.34349", "num_reviews": "2752", "rating": "5.0", "price_level": "$$ - $$$", "address": "47 rue Gay Lussac, 75005 Paris France", "phone": "+33 1 77 32 45 57", "website": "http://arrivedercipizzeria.com/", "cuisine": ["Italian", "Pizza", "Mediterranean", "European", "Healthy", "Neapolitan", "Campania", "Sicilian", "Southern-Italian", "Vegetarian Friendly", "Vegan Options"], "hours": [[{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}], [{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}], [{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}], [{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}], [{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}], [{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}], [{"open_time": 720, "close_time": 870}, {"open_time": 1140, "close_time": 1350}]]}

[TravelAgent] Step 10: Gather additional relevant information about the destination the user is visiting using the wikipedia tool.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] It starts to call external tools

[TravelAgent] The solution to step 10: It will call the wikipedia with the params as {'query': 'Paris, France'}. The tool response is Page: Paris Summary: Paris is the capital and most populous city of France. With an official estimated population of 2,102,650 residents as of 1 January 2023 in an area of more than 105 km2 (41 sq mi), Paris is the fourth-most populated city in the European Union and the 30th most densely populated city in the world in 2022. Since the 17th century, Paris has been one of the world's major centres of finance, diplomacy, commerce, culture, fashion, and gastronomy. For its leading role in the arts and sciences, as well as its early and extensive system of street lighting, in the 19th century, it became known as the City of Light. The City of Paris is the centre of the Île-de-France region, or Paris Region, with an official estimated population of 12,271,794 inhabitants on 1 January 2023, or about 19% of the population of France. The Paris Region had a GDP of €765 billion (US$1.064 trillion, PPP) in 2021, the highest in the European Union. According to the Economist Intelligence Unit Worldwide Cost of Living Survey, in 2022, Paris was the city with the ninth-highest cost of living in the world. Paris is a major railway, highway, and air-transport hub served by two international airports: Charles de Gaulle Airport (the third-busiest airport in Europe) and Orly Airport. Opened in 1900, the city's subway system, the Paris Métro, serves 5.23 million passengers daily; it is the second-busiest metro system in Europe after the Moscow Metro. Gare du Nord is the 24th-busiest railway station in the world and the busiest outside Japan, with 262 million passengers in 2015. Paris has one of the most sustainable transportation systems and is one of the only two cities in the world that received the Sustainable Transport Award twice. Paris is especially known for its museums and architectural landmarks: the Louvre received 8.9 million visitors in 2023, on track for keeping its position as the most-visited art museum in the world. The Musée d'Orsay, Musée Marmottan Monet and Musée de l'Orangerie are noted for their collections of French Impressionist art. The Pompidou Centre Musée National d'Art Moderne, Musée Rodin and Musée Picasso are noted for their collections of modern and contemporary art. The historical district along the Seine in the city centre has been classified as a UNESCO World Heritage Site since 1991. Paris hosts several United Nations organizations including UNESCO, and other international organizations such as the OECD, the OECD Development Centre, the International Bureau of Weights and Measures, the International Energy Agency, the International Federation for Human Rights, along with European bodies such as the European Space Agency, the European Banking Authority and the European Securities and Markets Authority. The football club Paris Saint-Germain and the rugby union club Stade Français are based in Paris. The 81,000-seat Stade de France, built for the 1998 FIFA World Cup, is located just north of Paris in the neighbouring commune of Saint-Denis. Paris hosts the annual French Open Grand Slam tennis tournament on the red clay of Roland Garros. The city hosted the Olympic Games in 1900 and 1924, and will host the 2024 Summer Olympics. The 1938 and 1998 FIFA World Cups, the 2019 FIFA Women's World Cup, the 2007 Rugby World Cup, as well as the 1960, 1984 and 2016 UEFA European Championships were also held in the city. Every July, the Tour de France bicycle race finishes on the Avenue des Champs-Élysées in Paris.

Page: Catacombs of Paris Summary: The Catacombs of Paris (French: Catacombes de Paris, ) are underground ossuaries in Paris, France, which hold the remains of more than six million people. Built to consolidate Paris's ancient stone quarries, they extend south from the Barrière d'Enfer ("Gate of Hell") former city gate; the ossuary was created as part of the effort to eliminate the effects of the city's overflowing cemeteries. Preparation work began shortly after a 1774 series of basement wall collapses around the

[TravelAgent] Step 11: Integrate the information gathered from the previous steps to provide a comprehensive travel plan.

[🤖gpt-4] TravelAgent is switched to executing.

[TravelAgent] The solution to step 11: Based on your request, here is your comprehensive travel plan:

Departure from New York City: Your journey will begin from New York City. The nearest airport to you is the New York City Airport (Code: NYC).

Flight Details: You will be taking a direct flight from Newark Liberty International Airport (EWR) to Paris Orly Airport (ORY) operating by BF airlines. The flight number is 727 and it will depart on July 4th, 2024 at 01:15 am.

Arrival in Paris: You will arrive in Paris on July 4th, 2024 at 14:30 pm (local time).

Hotel: You are suggested to stay at 'Le Bristol Paris', a 5 star hotel located at 112 rue du Faubourg Saint Honore 8th Arr., 75008 Paris.

Sightseeing: While in Paris, make sure to visit places like Bailly Gallery which is only 22 meters away from your hotel. Additionally, Paris is known for its museums like the Louvre and the Musée d'Orsay. The Seine in the city centre is a UNESCO World Heritage Site which is definitely worth a visit. The Catacombs of Paris are a unique attraction, holding the remains of more than six million people.

Eating Out: For dining, 'Pizzeria Arrivederci' is highly recommended, located at 47 rue Gay Lussac, 75005 Paris. They offer a variety of cuisines including Italian, Mediterranean, European and many more.

Departure from Paris: Your return flight, BF 726, departs from Paris Orly Airport (ORY) to Newark Liberty International Airport (EWR) on July 10th, 2024 at 20:20 pm (local time) and will arrive in New York on the same day at 22:30 pm (local time).

Safety Measures: Please ensure you are up to date with any travel advisories or safety measures in place during the time of your travel, and always follow the local rules and regulations.

Enjoy your trip to Paris!

[TravelAgent] Final result is: Based on your request, here is your comprehensive travel plan:

Departure from New York City: Your journey will begin from New York City. The nearest airport to you is the New York City Airport (Code: NYC).

Flight Details: You will be taking a direct flight from Newark Liberty International Airport (EWR) to Paris Orly Airport (ORY) operating by BF airlines. The flight number is 727 and it will depart on July 4th, 2024 at 01:15 am.

Arrival in Paris: You will arrive in Paris on July 4th, 2024 at 14:30 pm (local time).

Hotel: You are suggested to stay at 'Le Bristol Paris', a 5 star hotel located at 112 rue du Faubourg Saint Honore 8th Arr., 75008 Paris.

Sightseeing: While in Paris, make sure to visit places like Bailly Gallery which is only 22 meters away from your hotel. Additionally, Paris is known for its museums like the Louvre and the Musée d'Orsay. The Seine in the city centre is a UNESCO World Heritage Site which is definitely worth a visit. The Catacombs of Paris are a unique attraction, holding the remains of more than six million people.

Eating Out: For dining, 'Pizzeria Arrivederci' is highly recommended, located at 47 rue Gay Lussac, 75005 Paris. They offer a variety of cuisines including Italian, Mediterranean, European and many more.

Departure from Paris: Your return flight, BF 726, departs from Paris Orly Airport (ORY) to Newark Liberty International Airport (EWR) on July 10th, 2024 at 20:20 pm (local time) and will arrive in New York on the same day at 22:30 pm (local time).

Safety Measures: Please ensure you are up to date with any travel advisories or safety measures in place during the time of your travel, and always follow the local rules and regulations.

Enjoy your trip to Paris!