Spaces:
Sleeping
Sleeping
Equivalent solution
#1
by
lokami
- opened
app.py
CHANGED
|
@@ -19,27 +19,28 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
"""
|
| 20 |
return "What magic will you build ?"
|
| 21 |
|
| 22 |
-
@tool
|
| 23 |
-
def get_cheapest_flight(departureId:str, arrivalId:str, departureDate:str)-> str:
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
try:
|
| 32 |
-
cheapest = get_flight(departureId, arrivalId, departureDate)
|
| 33 |
-
return f"""
|
| 34 |
-
Cheapest Flight Details:
|
| 35 |
-
Price: {cheapest['price']}
|
| 36 |
-
From: {cheapest['departure']['from']} at {cheapest['departure']['time']}
|
| 37 |
-
To: {cheapest['arrival']['to']} at {cheapest['arrival']['time']}
|
| 38 |
-
Airline: {cheapest['airline']}
|
| 39 |
-
"""
|
| 40 |
-
except Exception as e:
|
| 41 |
-
return f"Error fetching time for cheapest flight: {str(e)}"
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 19 |
"""
|
| 20 |
return "What magic will you build ?"
|
| 21 |
|
| 22 |
+
# @tool
|
| 23 |
+
# def get_cheapest_flight(departureId:str, arrivalId:str, departureDate:str)-> str:
|
| 24 |
+
# """A tool that returns information about the cheapest flight given the departure, arrival and date
|
| 25 |
+
# Args:
|
| 26 |
+
# departureId: The ID in which the airport of the departure location is.
|
| 27 |
+
# arrivalId: The ID in which the airport of the arrival location is.
|
| 28 |
+
# departureDate: the date to look for the cheapest flight.
|
| 29 |
+
# """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
# try:
|
| 32 |
+
# cheapest = get_flight(departureId, arrivalId, departureDate)
|
| 33 |
+
# return f"""
|
| 34 |
+
# Cheapest Flight Details:
|
| 35 |
+
# Price: {cheapest['price']}
|
| 36 |
+
# From: {cheapest['departure']['from']} at {cheapest['departure']['time']}
|
| 37 |
+
# To: {cheapest['arrival']['to']} at {cheapest['arrival']['time']}
|
| 38 |
+
# Airline: {cheapest['airline']}
|
| 39 |
+
# """
|
| 40 |
+
# except Exception as e:
|
| 41 |
+
# return f"Error fetching time for cheapest flight: {str(e)}"
|
| 42 |
+
# That is equivalent to:
|
| 43 |
+
get_cheapest_flight = get_flight()
|
| 44 |
|
| 45 |
@tool
|
| 46 |
def get_current_time_in_timezone(timezone: str) -> str:
|