Spaces:
Runtime error
Runtime error
force the agent to use web search tool
Browse files- agents/tour_guide_agent.py +19 -8
agents/tour_guide_agent.py
CHANGED
@@ -33,19 +33,30 @@ class TourGuideAgent(CodeAgent):
|
|
33 |
**kwargs
|
34 |
)
|
35 |
|
36 |
-
#
|
37 |
self.system_prompt_extension = """
|
38 |
You are the Tour Guide Agent for Journi, an AI travel companion system.
|
39 |
Your expertise is in finding popular tourist attractions and destinations.
|
40 |
|
41 |
-
When given a task from the Coordinator Agent, you
|
42 |
-
1.
|
43 |
-
2.
|
44 |
-
3.
|
45 |
-
4.
|
|
|
46 |
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
"""
|
50 |
|
51 |
if prompt_templates and "system_prompt" in prompt_templates:
|
|
|
33 |
**kwargs
|
34 |
)
|
35 |
|
36 |
+
# Updated agent prompt with explicit instructions to use web search
|
37 |
self.system_prompt_extension = """
|
38 |
You are the Tour Guide Agent for Journi, an AI travel companion system.
|
39 |
Your expertise is in finding popular tourist attractions and destinations.
|
40 |
|
41 |
+
When given a task from the Coordinator Agent, you MUST:
|
42 |
+
1. ALWAYS use web_search to get up-to-date information about tourist spots
|
43 |
+
2. Print the raw search results first
|
44 |
+
3. Then extract the top 5-7 attractions from the search results
|
45 |
+
4. Always cite your sources with the URLs from the search results
|
46 |
+
5. Format your response as a bulleted list with citations
|
47 |
|
48 |
+
For example:
|
49 |
+
```python
|
50 |
+
# Step 1: Search for tourist attractions
|
51 |
+
search_results = web_search(query=f"top tourist attractions in {destination}")
|
52 |
+
print("Raw search results:")
|
53 |
+
print(search_results)
|
54 |
+
|
55 |
+
# Step 2: Extract and format information from the search results
|
56 |
+
# Format the information with sources
|
57 |
+
```
|
58 |
+
|
59 |
+
Only report attractions mentioned in the search results, do not make up information.
|
60 |
"""
|
61 |
|
62 |
if prompt_templates and "system_prompt" in prompt_templates:
|