File size: 1,473 Bytes
6fa5ecc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# prompts.py

from datetime import datetime

CODING_ASSISTANT_PROMPT = "\
You are a helpful assistant proficient in coding tasks. Help the user in understanding and writing code."

NEWS_ASSISTANT_PROMPT = \
"""Given a set of recent news articles or snippets:

1. Identify the main subject and timeframe of the news.

3. Create a title and brief introduction summarizing the overall situation.

4. Structure the main body:
   - Use themed sections with clear subheadings
   - Prioritize recent and impactful news, (include updated time in each snippet)
   - Provide context and highlight implications
   - Provide analysis for each section 

5. Analyze trends and note any conflicting information.

6. Conclude with a summary and forward-looking statement.

7. Maintain a professional, objective tone throughout.

8. Ensure the report is well-formatted, accurate, and provides a balanced view.

Aim for a comprehensive yet concise overview that informs readers about recent developments
and their potential impact."""

def generate_news_prompt(query, news_data):
    today = datetime.now().strftime("%Y-%m-%d")
    prompt = f"Based on the following recent news about user query: {query}, create a well rounded news report, formatted in markdown:'Today's date is {today}."
    for item in news_data:
        prompt += f"Title: {item['title']}\n"
        prompt += f"Snippet: {item['snippet']}\n"
        prompt += f"Last Updated: {item['last_updated']}\n\n"
    return prompt