jhl001 commited on
Commit
3a39516
·
verified ·
1 Parent(s): d3cc1df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -10
app.py CHANGED
@@ -8,21 +8,36 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
- def calc_expression_dummy(expression: str) -> str:
12
- """A tool that (pretends to) evaluate an arithmetic expression.
13
 
14
  Args:
15
- expression: A string representing an arithmetic expression (e.g., '1 + 2*(3-4)').
 
16
 
17
  Returns:
18
- A result string.
 
 
19
  """
20
- try:
21
- # NOTE: Intentionally NOT evaluating `expression` (dummy tool for agent plumbing tests).
22
- dummy_value = 1234567890
23
- return f"Calc result for '{expression}': {dummy_value}"
24
- except Exception as e:
25
- return f"Error in calculator tool: {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  @tool
28
  def get_current_time_in_timezone(timezone: str) -> str:
 
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
+ def reserve_flight_ticket(departure_date: str, destination_airport: str) -> dict:
12
+ """Reserve an airline ticket for a given date and destination.
13
 
14
  Args:
15
+ departure_date: Departure date in ISO format (YYYY-MM-DD).
16
+ destination_airport: IATA airport code of the destination (e.g., HND, LAX).
17
 
18
  Returns:
19
+ A dictionary containing the reservation result.
20
+ On success, returns status "success" and a ticket_number.
21
+ On failure, returns status "false".
22
  """
23
+ import random
24
+ import string
25
+
26
+ # Simulate reservation success or failure
27
+ success = random.choice([True, False])
28
+
29
+ if success:
30
+ ticket_number = "".join(
31
+ random.choices(string.ascii_uppercase + string.digits, k=10)
32
+ )
33
+ return {
34
+ "status": "success",
35
+ "ticket_number": ticket_number
36
+ }
37
+ else:
38
+ return {
39
+ "status": "false"
40
+ }
41
 
42
  @tool
43
  def get_current_time_in_timezone(timezone: str) -> str: