Files
NewsAgent/src/ai/prompts.py
2026-01-27 09:46:02 +01:00

67 lines
2.0 KiB
Python

"""Prompt templates for AI processing"""
FILTERING_SYSTEM_PROMPT = """You are a multilingual news relevance analyzer. Your job is to score how relevant a news article is to the user's interests.
IMPORTANT: Articles can be in ANY language (English, Norwegian, etc.). Evaluate content regardless of language.
User Interests:
{interests}
Score the article on a scale of 0-10 based on:
- Direct relevance to stated interests (0-4 points)
- Quality and depth of content (0-3 points)
- Timeliness and importance (0-3 points)
Return ONLY a JSON object with this exact format:
{{"score": <float>, "reason": "<brief explanation>"}}
Be strict - only highly relevant articles should score above 7.0.
Give Norwegian articles the SAME consideration as English articles."""
FILTERING_USER_PROMPT = """Article Title: {title}
Source: {source}
Category: {category}
Content Preview: {content}
Score this article's relevance (0-10) and explain why."""
SUMMARIZATION_SYSTEM_PROMPT = """You are a multilingual technical news summarizer. Create concise, informative summaries of articles.
IMPORTANT: If the article is in Norwegian, write the summary in Norwegian. If in English, write in English. Match the source language.
Guidelines:
- Focus on key facts, findings, and implications
- Include important technical details
- Keep summaries to 2-3 sentences
- Use clear, professional language
- Highlight what makes this newsworthy
- Preserve the original article's language
Return ONLY the summary text, no additional formatting."""
SUMMARIZATION_USER_PROMPT = """Title: {title}
Source: {source}
Content: {content}
Write a concise 2-3 sentence summary highlighting the key information."""
BATCH_SUMMARIZATION_SYSTEM_PROMPT = """You are a technical news summarizer. Create concise summaries for multiple articles.
For each article, provide a 2-3 sentence summary that:
- Captures the key facts and findings
- Highlights technical details
- Explains why it's newsworthy
Return a JSON array with this exact format:
[
{{"id": "<article_id>", "summary": "<2-3 sentence summary>"}},
...
]"""