Skip to content

Commit d0a2344

Browse files
committed
проект приведен к лицеприятному виду
1 parent 22c5774 commit d0a2344

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

src/ai/prompts.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
77
Требуемая структура JSON (все ключи должны присутствовать, точно так, как указано ниже):
88
{
9-
"summary": "1-2 sentences, neutral overview of the entire article set",
10-
"main_conclusions": ["conclusion 1", "conclusion 2", "conclusion 3"],
11-
"sentiment_label": "positive" | "negative" | "neutral",
12-
"sentiment_score": <number 0-100, percentage of articles matching sentiment_label>,
13-
"sentiment_distribution": {"positive": <number>, "negative": <number>, "neutral": <number>},
14-
"main_topics": ["topic 1", "topic 2", "topic 3"],
9+
"summary": "1-2 предложения, нейтральный обзор всего набора статей.",
10+
"main_conclusions": ["Вывод 1", "Вывод 2", "Вывод 3"],
11+
"sentiment_label": "Позитивное" | "Негативное" | "Нейтральное",
12+
"sentiment_score": <число от 0 до 100, процент статей, соответствующих метке sentiment_label>,
13+
"sentiment_distribution": {"положительный": <число>, "отрицательный": <число>, "нейтральный": <число>},
14+
"main_topics": ["тема 1", "тема 2", "тема 3"],
1515
"highlight": {
16-
"url": "<url of the most important article>",
17-
"title": "<title>",
18-
"author": "<author or null>",
19-
"description": "<brief description or null>",
20-
"reason": "<one short sentence about why this article was selected>"
16+
"url": "<url самой важной статьи>",
17+
"title": "<заголовок>",
18+
"author": "<автор>",
19+
"description": "<краткое описание>",
20+
"reason": "<Одно короткое предложение о том, почему эта статья была выбрана.>"
2121
},
22-
"data_quality_warnings": ["warning 1", ...]
22+
"data_quality_warnings": ["предупреждение 1", ...]
2323
}
2424
2525
Правила:
@@ -41,12 +41,13 @@
4141
4242
10. Будьте объективны и основывайтесь на фактах. Выводите ТОЛЬКО объект JSON."""
4343

44-
USER_PROMPT_TEMPLATE = """Analyze this pocket of news articles.
44+
USER_PROMPT_TEMPLATE = """Проанализируй этот фрагмент новостных статей..
4545
46-
Keyword: {keyword}
47-
Total articles: {count}
46+
Ключевое слово: {keyword}
47+
Всего статей: {count}
4848
49-
Articles:
49+
Статьи:
5050
{articles}
5151
52-
Return the JSON object exactly as specified in the system prompt."""
52+
53+
Верни JSON-объект точно в том виде, в котором он указан в системном запросе."""

src/ai/report.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def _normalize_sentiment(
110110
neg = neg / total * 100
111111
neu = neu / total * 100
112112

113-
pos = min(round(pos, 2), 100.0)
114-
neg = min(round(neg, 2), 100.0)
115-
neu = min(round(neu, 2), 100.0)
113+
pos = min(round(pos, 2), 99.0)
114+
neg = min(round(neg, 2), 99.0)
115+
neu = min(round(neu, 2), 99.0)
116116

117117
distribution = SentimentDistribution(positive=pos, negative=neg, neutral=neu)
118118
pairs = {"positive": pos, "negative": neg, "neutral": neu}

0 commit comments

Comments
 (0)