Supastrikas-004 commited on
Commit
233811e
·
verified ·
1 Parent(s): a095974

Update synthetic_data.py

Browse files
Files changed (1) hide show
  1. synthetic_data.py +32 -11
synthetic_data.py CHANGED
@@ -1,11 +1,32 @@
1
- import pandas as pd
2
- import random
3
-
4
- def generate_synthetic_dataset(num_agents=5, num_samples=20):
5
- data = []
6
- for agent in range(num_agents):
7
- for i in range(num_samples):
8
- instr = f"Task {i}: Summarize topic {random.randint(1,10)}"
9
- resp = f"This is a response to {instr}. Agent {agent} provides details."
10
- data.append({"agent": f"Agent_{agent}", "instruction": instr, "response": resp})
11
- return pd.DataFrame(data)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # synthetic_data.py
2
+ import pandas as pd
3
+ import random
4
+
5
+ def generate_synthetic_dataset(num_agents=4, num_samples=20):
6
+ data = []
7
+ tasks = ["qa", "summarization", "reasoning"]
8
+ for a in range(num_agents):
9
+ agent_name = f"Agent_{a}"
10
+ for i in range(num_samples):
11
+ task = random.choice(tasks)
12
+ if task == "qa":
13
+ prompt = f"What is the capital of country {i}?"
14
+ reference = "Paris is the capital of France." if i % 2 == 0 else "Rome is the capital of Italy."
15
+ response = reference if random.random() > 0.2 else "I think it's Berlin."
16
+ elif task == "summarization":
17
+ prompt = "Summarize: 'The sun is a star that provides light and heat to the Earth.'"
18
+ reference = "The sun provides light and heat essential for life on Earth."
19
+ response = "The sun provides light and heat for Earth."
20
+ else:
21
+ prompt = "Explain why the sky is blue."
22
+ reference = "Rayleigh scattering causes shorter blue wavelengths to scatter more, making the sky appear blue."
23
+ response = reference if random.random() > 0.3 else "It is because of reflection."
24
+
25
+ data.append({
26
+ "prompt": prompt,
27
+ "response": response,
28
+ "task": task,
29
+ "agent": agent_name,
30
+ "reference": reference
31
+ })
32
+ return pd.DataFrame(data)