Hugo Bui commited on
Commit
26ecc91
·
unverified ·
2 Parent(s): 1ea11ef 81ddd7a

Merge branch 'main' of https://huggingface.co/spaces/AIAgentsTravel/AI_Agent_Hackathon

Browse files
__pycache__/Gradio_UI.cpython-313.pyc ADDED
Binary file (7.7 kB). View file
 
app.py CHANGED
@@ -9,6 +9,7 @@ from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
9
  from smolagents import MultiStepAgent, ActionStep, AgentText, AgentImage, AgentAudio, handle_agent_output_types
10
  from Gradio_UI import GradioUI
11
  import yaml
 
12
 
13
  # Initialize Claude model via Hugging Face
14
  model = HfApiModel(
@@ -22,6 +23,20 @@ with open("prompts.yaml", "r") as f:
22
  prompt_templates = yaml.safe_load(f)
23
 
24
  # Define the agent with all tools
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  agent = CodeAgent(
26
  model=model,
27
  tools=[
 
9
  from smolagents import MultiStepAgent, ActionStep, AgentText, AgentImage, AgentAudio, handle_agent_output_types
10
  from Gradio_UI import GradioUI
11
  import yaml
12
+ # from tools.mock_tools import MoodToNeedTool, NeedToDestinationTool, WeatherTool, FlightsFinderTool, FinalAnswerTool
13
 
14
  # Initialize Claude model via Hugging Face
15
  model = HfApiModel(
 
23
  prompt_templates = yaml.safe_load(f)
24
 
25
  # Define the agent with all tools
26
+ # agent = CodeAgent(
27
+ # model=model,
28
+ # tools=[
29
+ # MoodToNeedTool(), # Step 1: Mood → Need
30
+ # NeedToDestinationTool(), # Step 2: Need → Destination
31
+ # WeatherTool(), # Step 3: Weather for destination
32
+ # FlightsFinderTool(), # Step 4: Destination → Flights # Step 5: Claude wrap
33
+ # FinalAnswerTool() # Required final output
34
+ # ],
35
+ # max_steps=6,
36
+ # verbosity_level=1,
37
+ # prompt_templates=prompt_templates
38
+ # )
39
+
40
  agent = CodeAgent(
41
  model=model,
42
  tools=[
prompts.yaml CHANGED
@@ -93,15 +93,6 @@ planning:
93
  8. Call final_answer() with all outputs.
94
  <end_plan>
95
 
96
- evaluate_destination_weather_and_country:
97
- system: |-
98
- You are a travel advisor who evaluates whether the destination is suitable for the user based on the weather and country information. Consider the weather forecast, the suggested activity, and relevant country details (e.g., safety, accessibility, cultural factors).
99
- prompt: |-
100
- The destination is {city}, {country}, and the suggested activity is: {activity}.
101
- The weather forecast is: {weather}.
102
- Relevant country information: {country_info}.
103
- Based on this information, is this destination a good idea for the activity? Answer with "Yes" or "No" and provide a short explanation.
104
-
105
  update_facts_pre_messages: |-
106
  ### 1. Facts given in the task
107
  ### 2. Facts that we have learned
 
93
  8. Call final_answer() with all outputs.
94
  <end_plan>
95
 
 
 
 
 
 
 
 
 
 
96
  update_facts_pre_messages: |-
97
  ### 1. Facts given in the task
98
  ### 2. Facts that we have learned
tools/__pycache__/final_answer.cpython-313.pyc ADDED
Binary file (1.07 kB). View file
 
tools/__pycache__/find_flight.cpython-313.pyc ADDED
Binary file (4.53 kB). View file
 
tools/__pycache__/mood_to_need.cpython-313.pyc ADDED
Binary file (1.88 kB). View file
 
tools/__pycache__/need_to_destination.cpython-313.pyc ADDED
Binary file (3.4 kB). View file
 
tools/__pycache__/weather_tool.cpython-313.pyc ADDED
Binary file (10.4 kB). View file
 
tools/mock_tools.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents.tools import tool
2
+
3
+ @tool
4
+ def mood_to_need(mood: str) -> str:
5
+ """
6
+ Map a mood to a need.
7
+
8
+ Args:
9
+ mood (str): The current emotional state of the user.
10
+
11
+ Returns:
12
+ str: A description of what the user needs based on the mood.
13
+ """
14
+ return "You need relaxation and nature."
15
+
16
+ @tool
17
+ def need_to_destination(need: str) -> str:
18
+ """
19
+ Map a need to a destination.
20
+
21
+ Args:
22
+ need (str): The user's identified need (e.g., relaxation, adventure).
23
+
24
+ Returns:
25
+ str: A suggested destination that fulfills the need.
26
+ """
27
+ return "Bali, Indonesia"
28
+
29
+ @tool
30
+ def get_weather(dest: str) -> str:
31
+ """
32
+ Get weather forecast for a destination.
33
+
34
+ Args:
35
+ dest (str): The destination location.
36
+
37
+ Returns:
38
+ str: A weather forecast for the given destination.
39
+ """
40
+ return "Sunny and 28°C"
41
+
42
+ @tool
43
+ def get_flights(dest: str) -> str:
44
+ """
45
+ Get flight options for a destination.
46
+
47
+ Args:
48
+ dest (str): The destination location.
49
+
50
+ Returns:
51
+ str: A list of flight options for the destination.
52
+ """
53
+ return "Flight from Paris to Bali: €600 roundtrip"
54
+
55
+ @tool
56
+ def final_wrap(info: str) -> str:
57
+ """
58
+ Create a final wrap-up message.
59
+
60
+ Args:
61
+ info (str): Summary information about the destination and travel.
62
+
63
+ Returns:
64
+ str: A personalized wrap-up message.
65
+ """
66
+ return f"Bali sounds like a perfect place for relaxation with great weather and affordable flights!"
67
+
68
+ @tool
69
+ def final_answer_tool(answer: str) -> str:
70
+ """
71
+ Provides a final answer to the user.
72
+
73
+ Args:
74
+ answer (str): The final recommendation or conclusion.
75
+
76
+ Returns:
77
+ str: The same final answer.
78
+ """
79
+ return answer
80
+
81
+