Skip to content

100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.

Invoke researcher in local_travel_agent + fix missing commas

thejeshf175db24f1fc
diff --git a/starter_ai_agents/ai_travel_agent/local_travel_agent.py b/starter_ai_agents/ai_travel_agent/local_travel_agent.py
index ca108b00..a1d8acae 100644
--- a/starter_ai_agents/ai_travel_agent/local_travel_agent.py
+++ b/starter_ai_agents/ai_travel_agent/local_travel_agent.py
@@ -84,7 +84,7 @@ if serp_api_key:
),
instructions=[
"Given a travel destination and the number of days the user wants to travel for, first generate a list of 3 search terms related to that destination and the number of days.",
- "For each search term, `search_google` and analyze the results."
+ "For each search term, `search_google` and analyze the results.",
"From the results of all searches, return the 10 most relevant results to the user's preferences.",
"Remember: the quality of the results is important.",
],
@@ -120,9 +120,21 @@ if serp_api_key:
with col1:
if st.button("Generate Itinerary"):
- with st.spinner("Processing..."):
- # Get the response from the assistant
- response: RunOutput = planner.run(f"{destination} for {num_days} days", stream=False)
+ with st.spinner("Researching your destination..."):
+ research_results: RunOutput = researcher.run(
+ f"Research {destination} for a {num_days} day trip", stream=False
+ )
+ st.write("Research completed")
+
+ with st.spinner("Creating your personalized itinerary..."):
+ prompt = f"""
+ Destination: {destination}
+ Duration: {num_days} days
+ Research Results: {research_results.content}
+
+ Please create a detailed itinerary based on this research.
+ """
+ response: RunOutput = planner.run(prompt, stream=False)
# Store the response in session state
st.session_state.itinerary = response.content
st.write(response.content)
diff --git a/starter_ai_agents/ai_travel_agent/travel_agent.py b/starter_ai_agents/ai_travel_agent/travel_agent.py
index fbb8068f..c4b01ff7 100644
--- a/starter_ai_agents/ai_travel_agent/travel_agent.py
+++ b/starter_ai_agents/ai_travel_agent/travel_agent.py
@@ -86,7 +86,7 @@ if openai_api_key and serp_api_key:
),
instructions=[
"Given a travel destination and the number of days the user wants to travel for, first generate a list of 3 search terms related to that destination and the number of days.",
- "For each search term, `search_google` and analyze the results."
+ "For each search term, `search_google` and analyze the results.",
"From the results of all searches, return the 10 most relevant results to the user's preferences.",
"Remember: the quality of the results is important.",
],