forked from MakazhanAlpamys/Soup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconversation.py
More file actions
39 lines (33 loc) · 1.26 KB
/
Copy pathconversation.py
File metadata and controls
39 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Multi-turn conversation template for synthetic data generation."""
SYSTEM_PROMPT = (
"You are a conversational training data generator. Generate diverse, natural "
"multi-turn dialogues between a user and an AI assistant."
)
def build_prompt(
count: int,
fmt: str,
format_spec: str,
turns: int = 4,
topic: str = "general knowledge",
) -> str:
"""Build the generation prompt for multi-turn conversations.
Args:
count: Number of examples to generate.
fmt: Output format (alpaca/sharegpt/chatml).
format_spec: Format specification string.
turns: Number of conversation turns (2-10).
topic: Conversation topic.
Returns:
Complete generation prompt string.
"""
turns = max(2, min(10, turns))
return (
f"You are a training data generator. Generate exactly {count} diverse, "
f"high-quality multi-turn conversations.\n\n"
f"Topic: {topic}\n"
f"Turns per conversation: {turns} (user and assistant messages)\n\n"
f"Each conversation should feel natural with follow-up questions "
f"and contextual responses.\n\n"
f"Format: {format_spec}\n\n"
f"Return ONLY a JSON array of {count} examples. No markdown, no explanation."
)