Spaces:
Running
Running
Update main.py
Browse files
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 |
-
|
231 |
-
|
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":
|
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 |
|