Update app.py
Browse files
app.py
CHANGED
@@ -303,27 +303,7 @@ def search_web(query):
|
|
303 |
link = result.get("link", "No Link")
|
304 |
snippet = result.get("snippet", "No Snippet")
|
305 |
raw_output += f"Title: {title}\nLink: {link}\nSnippet: {snippet}\n\n"
|
306 |
-
prompt =
|
307 |
-
You are a helpful assistant. Given the following web search results and the user's question, do the following:
|
308 |
-
|
309 |
-
1. Identify which entries are relevant.
|
310 |
-
2. Extract and combine useful insights and data.
|
311 |
-
3. Present the answer in natural, fluent British English, suitable for a professional summary.
|
312 |
-
|
313 |
-
Important:
|
314 |
-
- If the results contain **lists or categories**, you may summarise them into key points.
|
315 |
-
- Avoid markdown formatting like `**` or `##`.
|
316 |
-
- Write the final answer in a natural tone, as if explaining to a colleague.
|
317 |
-
- If the results do not answer the question, say: “Sorry, I couldn't find a reliable answer from the current results.”
|
318 |
-
|
319 |
-
--- Web Search Results ---
|
320 |
-
{raw_output}
|
321 |
-
|
322 |
-
--- User's Question ---
|
323 |
-
"{query}"
|
324 |
-
|
325 |
-
Answer:
|
326 |
-
"""
|
327 |
summarized = _general_chat(prompt)
|
328 |
return summarized if summarized else raw_output.strip()
|
329 |
else:
|
@@ -640,12 +620,15 @@ def weather_agent_tool(query: str) -> str:
|
|
640 |
summary_prompt = f"""
|
641 |
You are a helpful weather reasoning assistant.
|
642 |
|
|
|
|
|
|
|
643 |
Based on the following weather data and the user's question, think step-by-step to extract the most relevant information, and give a natural, friendly, and cautious answer in British English.
|
644 |
|
645 |
Avoid being overly confident — never say "Yes, it will..." or "Definitely." Instead, use expressions like:
|
646 |
- "It is very likely that..."
|
647 |
- "There is a high chance of..."
|
648 |
-
- "Based on the
|
649 |
- "There may be..."
|
650 |
|
651 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
@@ -757,12 +740,15 @@ def weather_tool(query: str) -> str:
|
|
757 |
summary_prompt = f"""
|
758 |
You are a helpful weather reasoning assistant.
|
759 |
|
|
|
|
|
|
|
760 |
Based on the following weather data and the user's question, think step-by-step to extract the most relevant information, and give a natural, friendly, and cautious answer in British English.
|
761 |
|
762 |
Avoid being overly confident — never say "Yes, it will..." or "Definitely." Instead, use expressions like:
|
763 |
- "It is very likely that..."
|
764 |
- "There is a high chance of..."
|
765 |
-
- "Based on the
|
766 |
- "There may be..."
|
767 |
|
768 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
@@ -1153,7 +1139,7 @@ This demo presents a GPT-style Multi-Agent AI Assistant, built with **LangChain,
|
|
1153 |
2. What are the key ideas mentioned in this file? *(→ RAG QA Agent)*
|
1154 |
3. What is LangChain used for? | What are the latest trends in AI startups in 2025? | Tell me the most recent breakthrough in quantum computing. *(→ Online Rag Agent)*
|
1155 |
4. What's the current time in London? | What’s today’s date in New York? | What time is it in Taipei right now? *(→ Time Agent)*
|
1156 |
-
5. Will it rain or snow in Sapporo tomorrow night? | Is it too windy for cycling in Amsterdam at 6am? | Do I need to bring an umbrella later this evening in Edinburgh? | Should I wear sunscreen in Bangkok around noon tomorrow? | Is it gonna rain later? | What was the weather like in Paris on last Sunday? | Will
|
1157 |
6. If I earn $15 per hour and work 8 hours a day for 5 days, how much will I earn? | What is 5 * 22.5 / sin(45) | 3^3 + 4^2 | Calculate 25 * log(1000) | What is the square root of 144 *(→ Math Agent)*
|
1158 |
7. Who are you? | What can you do? | What is the meaning of life? *(→ General Chat Agent)*
|
1159 |
|
|
|
303 |
link = result.get("link", "No Link")
|
304 |
snippet = result.get("snippet", "No Snippet")
|
305 |
raw_output += f"Title: {title}\nLink: {link}\nSnippet: {snippet}\n\n"
|
306 |
+
prompt = "Summarize the following search results in a concise, human-friendly way:\n" + raw_output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
summarized = _general_chat(prompt)
|
308 |
return summarized if summarized else raw_output.strip()
|
309 |
else:
|
|
|
620 |
summary_prompt = f"""
|
621 |
You are a helpful weather reasoning assistant.
|
622 |
|
623 |
+
The user wants to know about the weather conditions at a specific time: {target_dt.strftime('%Y-%m-%d %H:%M')} in {location}.
|
624 |
+
Use the data below to answer their question. This may refer to the past, present, or future — do not assume it is the current weather.
|
625 |
+
|
626 |
Based on the following weather data and the user's question, think step-by-step to extract the most relevant information, and give a natural, friendly, and cautious answer in British English.
|
627 |
|
628 |
Avoid being overly confident — never say "Yes, it will..." or "Definitely." Instead, use expressions like:
|
629 |
- "It is very likely that..."
|
630 |
- "There is a high chance of..."
|
631 |
+
- "Based on the available data, it seems that..."
|
632 |
- "There may be..."
|
633 |
|
634 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
|
|
740 |
summary_prompt = f"""
|
741 |
You are a helpful weather reasoning assistant.
|
742 |
|
743 |
+
The user wants to know about the weather conditions at a specific time: {target_dt.strftime('%Y-%m-%d %H:%M')} in {location}.
|
744 |
+
Use the data below to answer their question. This may refer to the past, present, or future — do not assume it is the current weather.
|
745 |
+
|
746 |
Based on the following weather data and the user's question, think step-by-step to extract the most relevant information, and give a natural, friendly, and cautious answer in British English.
|
747 |
|
748 |
Avoid being overly confident — never say "Yes, it will..." or "Definitely." Instead, use expressions like:
|
749 |
- "It is very likely that..."
|
750 |
- "There is a high chance of..."
|
751 |
+
- "Based on the available data, it seems that..."
|
752 |
- "There may be..."
|
753 |
|
754 |
Also, after answering the question, include a short weather summary and a useful suggestion (e.g., bring an umbrella, wear sunscreen, avoid outdoor activities).
|
|
|
1139 |
2. What are the key ideas mentioned in this file? *(→ RAG QA Agent)*
|
1140 |
3. What is LangChain used for? | What are the latest trends in AI startups in 2025? | Tell me the most recent breakthrough in quantum computing. *(→ Online Rag Agent)*
|
1141 |
4. What's the current time in London? | What’s today’s date in New York? | What time is it in Taipei right now? *(→ Time Agent)*
|
1142 |
+
5. Will it rain or snow in Sapporo tomorrow night? | Is it too windy for cycling in Amsterdam at 6am? | Do I need to bring an umbrella later this evening in Edinburgh? | Should I wear sunscreen in Bangkok around noon tomorrow? | Is it gonna rain later? | What was the weather like in Paris on last Sunday? | Will the weather be suitable for hiking at 3pm in Lake District?*(→ Weather Agent)*
|
1143 |
6. If I earn $15 per hour and work 8 hours a day for 5 days, how much will I earn? | What is 5 * 22.5 / sin(45) | 3^3 + 4^2 | Calculate 25 * log(1000) | What is the square root of 144 *(→ Math Agent)*
|
1144 |
7. Who are you? | What can you do? | What is the meaning of life? *(→ General Chat Agent)*
|
1145 |
|