ChienChung commited on
Commit
4ead7c3
·
verified ·
1 Parent(s): c6614cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -304,21 +304,25 @@ def search_web(query):
304
  snippet = result.get("snippet", "No Snippet")
305
  raw_output += f"Title: {title}\nLink: {link}\nSnippet: {snippet}\n\n"
306
  prompt = f"""
307
- You are a helpful assistant. Based on the user's question and the following web search results:
308
 
309
- 1. First, identify which entries are actually relevant to the question.
310
- 2. Then, extract any useful facts or figures.
311
- 3. Finally, write a clear and concise answer in **British English**.
 
 
 
 
 
 
312
 
313
- If **none** of the results answer the question, respond with: “Sorry, I couldn't find a reliable answer from the current results.”
314
- At the end, include 1–2 relevant source titles and URLs if applicable.
315
  --- Web Search Results ---
316
  {raw_output}
317
 
318
  --- User's Question ---
319
  "{query}"
320
 
321
- Final Answer:
322
  """
323
  summarized = _general_chat(prompt)
324
  return summarized if summarized else raw_output.strip()
 
304
  snippet = result.get("snippet", "No Snippet")
305
  raw_output += f"Title: {title}\nLink: {link}\nSnippet: {snippet}\n\n"
306
  prompt = f"""
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()