Spaces:
Runtime error
Runtime error
Hugo Bui
commited on
test
Browse files- app.py +1 -1
- prompts_simple.yaml +52 -0
- test_tools.py +59 -0
app.py
CHANGED
@@ -19,7 +19,7 @@ model = LiteLLMModel(
|
|
19 |
)
|
20 |
|
21 |
# Load prompt templates
|
22 |
-
with open("
|
23 |
prompt_templates = yaml.safe_load(f)
|
24 |
|
25 |
# Define the agent with all tools
|
|
|
19 |
)
|
20 |
|
21 |
# Load prompt templates
|
22 |
+
with open("prompts_simple.yaml", "r") as f:
|
23 |
prompt_templates = yaml.safe_load(f)
|
24 |
|
25 |
# Define the agent with all tools
|
prompts_simple.yaml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
system_prompt: |-
|
2 |
+
You are WanderMind, a travel assistant. Follow these steps EXACTLY:
|
3 |
+
|
4 |
+
1. First, check if user provided: mood, origin city, travel dates
|
5 |
+
2. If missing info, ask for it and STOP
|
6 |
+
3. If all info provided, follow this EXACT sequence:
|
7 |
+
|
8 |
+
Step A: need = MoodToNeed(mood="user's exact mood")
|
9 |
+
Step B: destinations = NeedToDestination(need=need)
|
10 |
+
Step C: weather = weather_forecast(location="first destination from list")
|
11 |
+
Step D: safety = country_info(country="country name", info_type="security")
|
12 |
+
Step E: flights = flights_finder(departure_airport="CDG", arrival_airport="destination airport", outbound_date="2025-06-15", return_date="2025-06-22")
|
13 |
+
Step F: final_answer("Complete travel recommendation with all details")
|
14 |
+
|
15 |
+
🚨 CRITICAL:
|
16 |
+
- Use tools ONE AT A TIME
|
17 |
+
- Print each result before moving to next step
|
18 |
+
- Don't write complex Python logic
|
19 |
+
- Don't assume data formats
|
20 |
+
- Just call tools and show results
|
21 |
+
|
22 |
+
Example:
|
23 |
+
```py
|
24 |
+
# Step 1: Get need
|
25 |
+
need = MoodToNeed(mood="happy")
|
26 |
+
print(f"Emotional need: {need}")
|
27 |
+
```
|
28 |
+
|
29 |
+
planning:
|
30 |
+
initial_plan: |-
|
31 |
+
1. Check user inputs (mood, origin, dates)
|
32 |
+
2. Call MoodToNeed(mood)
|
33 |
+
3. Call NeedToDestination(need)
|
34 |
+
4. Call weather_forecast(location)
|
35 |
+
5. Call country_info(country)
|
36 |
+
6. Call flights_finder(airports and dates)
|
37 |
+
7. Call final_answer(complete plan)
|
38 |
+
|
39 |
+
managed_agent:
|
40 |
+
task: |-
|
41 |
+
You are a helpful sub-agent named '{{name}}'.
|
42 |
+
Your manager gives you this task: {{task}}
|
43 |
+
Return your result with final_answer().
|
44 |
+
|
45 |
+
report: |-
|
46 |
+
Final answer from agent '{{name}}': {{final_answer}}
|
47 |
+
|
48 |
+
final_answer:
|
49 |
+
pre_messages: |-
|
50 |
+
Summarizing your travel plan:
|
51 |
+
post_messages: |-
|
52 |
+
Enjoy your journey!
|
test_tools.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
|
3 |
+
from tools.mood_to_need import MoodToNeedTool, claude_mood_to_need_model
|
4 |
+
from tools.need_to_destination import NeedToDestinationTool, claude_need_to_destination_model
|
5 |
+
from tools.weather_tool import WeatherTool
|
6 |
+
from tools.country_info_tool import CountryInfoTool
|
7 |
+
from tools.find_flight import FlightsFinderTool
|
8 |
+
|
9 |
+
def test_tools():
|
10 |
+
print("🧪 Testing individual tools...\n")
|
11 |
+
|
12 |
+
# Test 1: MoodToNeed
|
13 |
+
print("1️⃣ Testing MoodToNeed...")
|
14 |
+
mood_tool = MoodToNeedTool(model=claude_mood_to_need_model)
|
15 |
+
need = mood_tool.forward(mood="happy")
|
16 |
+
print(f" Input: 'happy' → Output: '{need}'\n")
|
17 |
+
|
18 |
+
# Test 2: NeedToDestination
|
19 |
+
print("2️⃣ Testing NeedToDestination...")
|
20 |
+
destination_tool = NeedToDestinationTool(model=claude_need_to_destination_model)
|
21 |
+
destinations = destination_tool.forward(need=need)
|
22 |
+
print(f" Input: '{need}' → Output: {destinations}\n")
|
23 |
+
|
24 |
+
# Test 3: WeatherTool
|
25 |
+
print("3️⃣ Testing WeatherTool...")
|
26 |
+
weather_tool = WeatherTool()
|
27 |
+
if destinations and len(destinations) > 0:
|
28 |
+
first_dest = destinations[0]["destination"]
|
29 |
+
weather = weather_tool.forward(location=first_dest)
|
30 |
+
print(f" Input: '{first_dest}' → Output: {weather[:200]}...\n")
|
31 |
+
|
32 |
+
# Test 4: CountryInfoTool
|
33 |
+
print("4️⃣ Testing CountryInfoTool...")
|
34 |
+
country_tool = CountryInfoTool()
|
35 |
+
if destinations and len(destinations) > 0:
|
36 |
+
# Extract country from destination
|
37 |
+
dest_parts = destinations[0]["destination"].split(", ")
|
38 |
+
if len(dest_parts) > 1:
|
39 |
+
country = dest_parts[1]
|
40 |
+
safety = country_tool.forward(country=country, info_type="security")
|
41 |
+
print(f" Input: '{country}' → Output: {safety[:200]}...\n")
|
42 |
+
|
43 |
+
# Test 5: FlightsFinderTool
|
44 |
+
print("5️⃣ Testing FlightsFinderTool...")
|
45 |
+
flights_tool = FlightsFinderTool()
|
46 |
+
if destinations and len(destinations) > 0:
|
47 |
+
dest_airport = destinations[0]["departure"]["to_airport"]
|
48 |
+
flights = flights_tool.forward(
|
49 |
+
departure_airport="CDG",
|
50 |
+
arrival_airport=dest_airport,
|
51 |
+
outbound_date="2025-06-15",
|
52 |
+
return_date="2025-06-22"
|
53 |
+
)
|
54 |
+
print(f" Input: CDG → {dest_airport} → Output: {flights[:200]}...\n")
|
55 |
+
|
56 |
+
print("✅ All tools tested!")
|
57 |
+
|
58 |
+
if __name__ == "__main__":
|
59 |
+
test_tools()
|