Make vision analysis detailed for downstream AI consumption
- Expanded system prompt with structured 6-point analysis - Increased max_output_tokens from 300 to 1000 - Description now covers game, actions, UI, camera, overlays, text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
32
analyzer.py
32
analyzer.py
@@ -4,19 +4,29 @@ from google import genai
|
||||
from google.genai import types
|
||||
|
||||
SYSTEM_PROMPT_RU = (
|
||||
"Ты анализируешь кадры с Twitch-стрима. "
|
||||
"Кратко опиши что происходит на экране: игра, действия стримера, "
|
||||
"интерфейс, чат, оверлеи. Будь лаконичен (2-3 предложения). "
|
||||
"Если ничего не изменилось по сравнению с предыдущим описанием, "
|
||||
"скажи 'Без изменений' и уточни только новые детали."
|
||||
"Ты анализируешь кадры с Twitch-стрима. Дай подробное описание всего, что видишь на экране:\n"
|
||||
"1. Какая игра/приложение на экране, жанр, сеттинг\n"
|
||||
"2. Что конкретно происходит: действия персонажа, ситуация в игре, этап (меню, геймплей, катсцена, лобби)\n"
|
||||
"3. Элементы интерфейса: HUD, здоровье, инвентарь, мини-карта, счёт, таймеры\n"
|
||||
"4. Камера стримера: что видно, эмоции, жесты (если есть)\n"
|
||||
"5. Оверлеи: донаты, алерты, виджеты, чат\n"
|
||||
"6. Текст на экране: любой читаемый текст, названия, никнеймы\n"
|
||||
"Пиши развёрнуто (5-10 предложений). Описание должно быть достаточно детальным, "
|
||||
"чтобы другая AI-модель могла полностью понять контекст происходящего без просмотра изображения.\n"
|
||||
"Если сцена похожа на предыдущую, опиши только изменения, но подробно."
|
||||
)
|
||||
|
||||
SYSTEM_PROMPT_EN = (
|
||||
"You are analyzing frames from a Twitch stream. "
|
||||
"Briefly describe what's happening on screen: game, streamer actions, "
|
||||
"UI, chat, overlays. Be concise (2-3 sentences). "
|
||||
"If nothing changed compared to the previous description, "
|
||||
"say 'No changes' and only note new details."
|
||||
"You are analyzing frames from a Twitch stream. Give a detailed description of everything on screen:\n"
|
||||
"1. What game/application is shown, genre, setting\n"
|
||||
"2. What exactly is happening: character actions, game situation, stage (menu, gameplay, cutscene, lobby)\n"
|
||||
"3. UI elements: HUD, health, inventory, minimap, score, timers\n"
|
||||
"4. Streamer camera: what's visible, emotions, gestures (if present)\n"
|
||||
"5. Overlays: donations, alerts, widgets, chat\n"
|
||||
"6. On-screen text: any readable text, names, nicknames\n"
|
||||
"Write in detail (5-10 sentences). The description must be detailed enough "
|
||||
"for another AI model to fully understand the context without seeing the image.\n"
|
||||
"If the scene is similar to the previous one, describe only the changes, but in detail."
|
||||
)
|
||||
|
||||
|
||||
@@ -67,7 +77,7 @@ class VisionAnalyzer:
|
||||
contents=contents,
|
||||
config=types.GenerateContentConfig(
|
||||
system_instruction=self.system_prompt,
|
||||
max_output_tokens=300,
|
||||
max_output_tokens=1000,
|
||||
temperature=0.3,
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user