Revamped prompt
Browse files
components/generators/daily_feed.py
CHANGED
@@ -28,12 +28,22 @@ redis_client = redis.Redis.from_url(REDIS_URL, decode_responses=True)
|
|
28 |
# π° Topics to summarize
|
29 |
TOPICS = ["India news", "World news", "Tech news", "Finance news", "Sports news"]
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# βοΈ Build Mistral prompt
|
32 |
def build_prompt(content: str, topic: str) -> str:
|
33 |
-
return (
|
34 |
-
f"You are a news summarizer. Summarize the following content in 25-30 words. "
|
35 |
-
f"Make it engaging and informative. Include appropriate emojis. Topic: {topic}\n\n{content}"
|
36 |
-
)
|
37 |
|
38 |
# π§ Send prompt to Mistral
|
39 |
HEADERS = {
|
|
|
28 |
# π° Topics to summarize
|
29 |
TOPICS = ["India news", "World news", "Tech news", "Finance news", "Sports news"]
|
30 |
|
31 |
+
BASE_PROMPT = """
|
32 |
+
You are the official news summarizer for Nuse β a global, AI-powered news delivery platform. Your tone is factual, insightful, and engaging. Summarize news articles in a crisp, modern format.
|
33 |
+
|
34 |
+
Instructions:
|
35 |
+
- Write in 25β30 words only.
|
36 |
+
- Generate response organically and avoid trimming words to fit within the limit.
|
37 |
+
- Highlight key facts: who, what, when, where, and why.
|
38 |
+
- Use a professional tone, but include 1β2 well-placed emojis for engagement.
|
39 |
+
- Avoid any mention of Nuse, yourself, or the prompt.
|
40 |
+
- Never repeat headlines or include generic filler.
|
41 |
+
- Only return the summary. Do not include prompt, context, or metadata.
|
42 |
+
"""
|
43 |
+
|
44 |
# βοΈ Build Mistral prompt
|
45 |
def build_prompt(content: str, topic: str) -> str:
|
46 |
+
return f"{BASE_PROMPT.strip()}\n\nTopic: {topic}\n\n{content.strip()}"
|
|
|
|
|
|
|
47 |
|
48 |
# π§ Send prompt to Mistral
|
49 |
HEADERS = {
|