Changed generation prompts
Browse files- remote_llm.py +8 -10
- settings.py +6 -1
remote_llm.py
CHANGED
@@ -17,8 +17,6 @@ from rate_limit import rate_limit_bypass
|
|
17 |
from settings import app_settings
|
18 |
from transcribe import get_full_transcript, parse_audio
|
19 |
|
20 |
-
SEGMENT_TIME = 1500
|
21 |
-
|
22 |
|
23 |
@rate_limit_bypass(sleep_time=20)
|
24 |
def summarize_groq(client: Groq, text: str):
|
@@ -27,20 +25,20 @@ def summarize_groq(client: Groq, text: str):
|
|
27 |
messages=[
|
28 |
{
|
29 |
"role": "system",
|
30 |
-
"content":
|
31 |
-
" a concise title that reflects the content. "
|
32 |
-
"Wrap the title with **markdown bold notation**. "
|
33 |
-
"Write the summary as if you are continuing a conversation without needing "
|
34 |
-
"to signal a beginning. Answer only in russian."
|
35 |
-
"Here is the transcript: "
|
36 |
},
|
37 |
{
|
38 |
"role": "user",
|
39 |
-
"content":
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
],
|
42 |
temperature=app_settings.temperature,
|
43 |
-
max_tokens=
|
44 |
top_p=1,
|
45 |
stream=False,
|
46 |
stop=None,
|
|
|
17 |
from settings import app_settings
|
18 |
from transcribe import get_full_transcript, parse_audio
|
19 |
|
|
|
|
|
20 |
|
21 |
@rate_limit_bypass(sleep_time=20)
|
22 |
def summarize_groq(client: Groq, text: str):
|
|
|
25 |
messages=[
|
26 |
{
|
27 |
"role": "system",
|
28 |
+
"content": app_settings.system_prompt,
|
|
|
|
|
|
|
|
|
|
|
29 |
},
|
30 |
{
|
31 |
"role": "user",
|
32 |
+
"content": f"Кратко перескажи видео по транскрипции, "
|
33 |
+
f"как будто это только часть видео. "
|
34 |
+
f"Используй оформление и ненумерованные пункты. "
|
35 |
+
f"Оформи название блока через **Название**"
|
36 |
+
f"Не пиши о том, что это краткое изложение. "
|
37 |
+
f"Вот транскрипция: {text}",
|
38 |
}
|
39 |
],
|
40 |
temperature=app_settings.temperature,
|
41 |
+
max_tokens=app_settings.max_tokens,
|
42 |
top_p=1,
|
43 |
stream=False,
|
44 |
stop=None,
|
settings.py
CHANGED
@@ -15,10 +15,15 @@ class LogLevel(str, enum.Enum):
|
|
15 |
|
16 |
|
17 |
class Settings(BaseSettings):
|
18 |
-
temperature: float =
|
19 |
model: str = "llama3-8b-8192"
|
20 |
log_level: LogLevel = LogLevel.INFO
|
21 |
segment_time: int = 1500
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
app_settings = Settings()
|
|
|
15 |
|
16 |
|
17 |
class Settings(BaseSettings):
|
18 |
+
temperature: float = 0.2
|
19 |
model: str = "llama3-8b-8192"
|
20 |
log_level: LogLevel = LogLevel.INFO
|
21 |
segment_time: int = 1500
|
22 |
+
max_tokens: int = 375
|
23 |
+
system_prompt: str = ("You are a helpful, respectful and honest assistant."
|
24 |
+
"You task will be to summarize video transcripts. "
|
25 |
+
"You will receive them in parts, so don't indicate beggining."
|
26 |
+
"Answer only in russian.")
|
27 |
|
28 |
|
29 |
app_settings = Settings()
|