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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -7,6 +7,8 @@ from tools.final_answer import FinalAnswerTool
7
 
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.
@@ -55,8 +57,13 @@ def get_current_time_in_timezone(timezone: str) -> str:
55
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
56
 
57
 
 
 
 
58
  final_answer = FinalAnswerTool()
59
 
 
 
60
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
61
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
62
 
@@ -71,12 +78,14 @@ custom_role_conversions=None,
71
  # Import tool from Hub
72
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
73
 
 
 
74
  with open("prompts.yaml", 'r') as stream:
75
  prompt_templates = yaml.safe_load(stream)
76
 
77
  agent = CodeAgent(
78
  model=model,
79
- tools=[final_answer], ## add your tools here (don't remove final answer)
80
  max_steps=6,
81
  verbosity_level=1,
82
  grammar=None,
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+ tools = []
11
+
12
  @tool
13
  def reserve_flight_ticket(departure_date: str, destination_airport: str) -> dict:
14
  """Reserve an airline ticket for a given date and destination.
 
57
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
58
 
59
 
60
+ tools.append(reserve_flight_ticket())
61
+ tools.append(get_current_time_in_timezone())
62
+
63
  final_answer = FinalAnswerTool()
64
 
65
+ tools.append(final_answer)
66
+
67
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
68
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
69
 
 
78
  # Import tool from Hub
79
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
80
 
81
+ tools.append(image_generation_tool)
82
+
83
  with open("prompts.yaml", 'r') as stream:
84
  prompt_templates = yaml.safe_load(stream)
85
 
86
  agent = CodeAgent(
87
  model=model,
88
+ tools=tools,
89
  max_steps=6,
90
  verbosity_level=1,
91
  grammar=None,