pvanand commited on
Commit
cbcfc90
1 Parent(s): 6fa5ecc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -6
main.py CHANGED
@@ -13,6 +13,7 @@ import time
13
  from datetime import datetime, timedelta
14
  import asyncio
15
  import requests
 
16
 
17
  app = FastAPI()
18
 
@@ -227,14 +228,11 @@ def analyze_news(query):
227
  return "Failed to fetch news data.", []
228
 
229
  # Prepare the prompt for the AI
230
- prompt = f"Based on the following recent news about '{query}', Provide a well summarized and formatted answer using markdown, give importance to the latest news:\n\n"
231
- for item in news_data:
232
- prompt += f"Title: {item['title']}\n"
233
- prompt += f"Snippet: {item['snippet']}\n"
234
- prompt += f"Last Updated: {item['last_updated']}\n\n"
235
 
236
  messages = [
237
- {"role": "system", "content": "You are a knowledgeable Assistant capable of providing insightful answers on various topics."},
238
  {"role": "user", "content": prompt}
239
  ]
240
 
 
13
  from datetime import datetime, timedelta
14
  import asyncio
15
  import requests
16
+ from prompts import CODING_ASSISTANT_PROMPT, NEWS_ASSISTANT_PROMPT, generate_news_prompt
17
 
18
  app = FastAPI()
19
 
 
228
  return "Failed to fetch news data.", []
229
 
230
  # Prepare the prompt for the AI
231
+ # Use the imported function to generate the prompt (now includes today's date)
232
+ prompt = generate_news_prompt(query, news_data)
 
 
 
233
 
234
  messages = [
235
+ {"role": "system", "content": NEWS_ASSISTANT_PROMPT},
236
  {"role": "user", "content": prompt}
237
  ]
238