Spaces:
Running
Running
Create prompts.py
Browse files- prompts.py +39 -0
prompts.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# prompts.py
|
2 |
+
|
3 |
+
from datetime import datetime
|
4 |
+
|
5 |
+
CODING_ASSISTANT_PROMPT = "\
|
6 |
+
You are a helpful assistant proficient in coding tasks. Help the user in understanding and writing code."
|
7 |
+
|
8 |
+
NEWS_ASSISTANT_PROMPT = \
|
9 |
+
"""Given a set of recent news articles or snippets:
|
10 |
+
|
11 |
+
1. Identify the main subject and timeframe of the news.
|
12 |
+
|
13 |
+
3. Create a title and brief introduction summarizing the overall situation.
|
14 |
+
|
15 |
+
4. Structure the main body:
|
16 |
+
- Use themed sections with clear subheadings
|
17 |
+
- Prioritize recent and impactful news, (include updated time in each snippet)
|
18 |
+
- Provide context and highlight implications
|
19 |
+
- Provide analysis for each section
|
20 |
+
|
21 |
+
5. Analyze trends and note any conflicting information.
|
22 |
+
|
23 |
+
6. Conclude with a summary and forward-looking statement.
|
24 |
+
|
25 |
+
7. Maintain a professional, objective tone throughout.
|
26 |
+
|
27 |
+
8. Ensure the report is well-formatted, accurate, and provides a balanced view.
|
28 |
+
|
29 |
+
Aim for a comprehensive yet concise overview that informs readers about recent developments
|
30 |
+
and their potential impact."""
|
31 |
+
|
32 |
+
def generate_news_prompt(query, news_data):
|
33 |
+
today = datetime.now().strftime("%Y-%m-%d")
|
34 |
+
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}."
|
35 |
+
for item in news_data:
|
36 |
+
prompt += f"Title: {item['title']}\n"
|
37 |
+
prompt += f"Snippet: {item['snippet']}\n"
|
38 |
+
prompt += f"Last Updated: {item['last_updated']}\n\n"
|
39 |
+
return prompt
|