RohanB67 commited on
Commit
8a40051
Β·
verified Β·
1 Parent(s): 13394a2

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +21 -21
agents.py CHANGED
@@ -7,11 +7,11 @@ Multi-agent swarm debate engine with real-time SSE callbacks.
7
  enabling live streaming to the browser via SSE.
8
 
9
  Agent roster:
10
- Alpha β€” meta-llama/Llama-3.1-8B-Instruct (cerebras) β€” Skeptic
11
- Beta β€” Qwen/Qwen2.5-7B-Instruct (together) β€” Literalist
12
- Gamma β€” HuggingFaceH4/zephyr-7b-beta (featherless) β€” Connector
13
- Delta β€” deepseek-ai/DeepSeek-R1 (sambanova) β€” Deep Reasoner
14
- Epsilon β€” llama-3.3-70b-versatile (groq) β€” Synthesizer
15
  """
16
 
17
  import concurrent.futures
@@ -25,32 +25,32 @@ AGENTS = [
25
  "client_type": "groq",
26
  "color": "red",
27
  "personality": (
28
- "You are Agent Alpha β€” a ruthless Skeptic. "
29
- "Challenge every claim aggressively. Demand evidence. "
30
- "Point out what is NOT in the sources. Be blunt and relentless."
31
  )
32
  },
33
  {
34
  "name": "Beta",
35
- "model": "deepseek-r1-distill-llama-70b",
36
  "provider": "groq",
37
  "client_type": "groq",
38
  "color": "yellow",
39
  "personality": (
40
- "You are Agent Beta β€” a Deep Reasoner. "
41
- "Think step by step. Show your chain of thought explicitly. "
42
  "Identify hidden assumptions and logical gaps the other agents miss. "
43
  "Precision and thoroughness over speed."
44
  )
45
  },
46
  {
47
  "name": "Gamma",
48
- "model": "gemma2-9b-it",
49
  "provider": "groq",
50
  "client_type": "groq",
51
  "color": "green",
52
  "personality": (
53
- "You are Agent Gamma β€” a Pattern Connector. "
54
  "Find non-obvious connections between different sources. "
55
  "Look for relationships and synthesis opportunities others miss. "
56
  "Think laterally and creatively."
@@ -58,12 +58,12 @@ AGENTS = [
58
  },
59
  {
60
  "name": "Delta",
61
- "model": "qwen-qwq-32b",
62
  "provider": "groq",
63
  "client_type": "groq",
64
  "color": "purple",
65
  "personality": (
66
- "You are Agent Delta β€” a strict Literalist. "
67
  "Accept ONLY what is explicitly stated in the source text. "
68
  "Reject all inferences and extrapolations. "
69
  "If it is not literally written in the excerpts, it does not exist."
@@ -71,12 +71,12 @@ AGENTS = [
71
  },
72
  {
73
  "name": "Epsilon",
74
- "model": "llama-3.1-8b-instant",
75
  "provider": "groq",
76
  "client_type": "groq",
77
  "color": "blue",
78
  "personality": (
79
- "You are Agent Epsilon β€” the Synthesizer. "
80
  "Read all agents arguments, identify where they agree and disagree, "
81
  "and produce a final authoritative answer incorporating the strongest points. "
82
  "Be decisive. Cite sources clearly."
@@ -90,7 +90,7 @@ TIMEOUT_SECONDS = 30
90
  CONTEXT_LIMIT = 3000 # chars fed to synthesizer to avoid 413
91
 
92
  DOMAIN_GUARD = """
93
- SCOPE: EpiRAG β€” strictly epidemic modeling, network science, mathematical epidemiology.
94
  Do NOT answer anything outside this domain. If off-topic, say so and stop.
95
  """
96
 
@@ -206,7 +206,7 @@ def run_debate(question, context, groq_key, hf_token, callback=None):
206
  agent_colors = {a["name"]: a["color"] for a in AGENTS}
207
  debate_rounds = []
208
 
209
- # ── Round 1 ───────────────────────────────────────────────────────────────
210
  emit({"type": "round_start", "round": 1})
211
  round1 = {}
212
 
@@ -233,7 +233,7 @@ def run_debate(question, context, groq_key, hf_token, callback=None):
233
  current = round1
234
  rounds_run = 1
235
 
236
- # ── Rounds 2+ ───────────���─────────────────────────────────────────────────
237
  while not consensus and rounds_run < MAX_ROUNDS:
238
  rounds_run += 1
239
  emit({"type": "round_start", "round": rounds_run})
@@ -261,7 +261,7 @@ def run_debate(question, context, groq_key, hf_token, callback=None):
261
  current = next_round
262
  consensus = _converged(next_round)
263
 
264
- # ── Synthesis ──────────────────────────────────────────────────────────────
265
  emit({"type": "synthesizing"})
266
  # Truncate context for synthesis to avoid 413 token limit errors
267
  ctx_trunc = context[:4000] if len(context) > 4000 else context
 
7
  enabling live streaming to the browser via SSE.
8
 
9
  Agent roster:
10
+ Alpha - meta-llama/Llama-3.1-8B-Instruct (cerebras) - Skeptic
11
+ Beta - Qwen/Qwen2.5-7B-Instruct (together) - Literalist
12
+ Gamma - HuggingFaceH4/zephyr-7b-beta (featherless) - Connector
13
+ Delta - deepseek-ai/DeepSeek-R1 (sambanova) - Deep Reasoner
14
+ Epsilon - llama-3.3-70b-versatile (groq) - Synthesizer
15
  """
16
 
17
  import concurrent.futures
 
25
  "client_type": "groq",
26
  "color": "red",
27
  "personality": (
28
+ "You are Agent Alpha - a ruthless Skeptic. "
29
+ "Challenge every claim aggressively. Demand evidence from the sources. "
30
+ "Point out what is NOT supported. Be blunt and relentless."
31
  )
32
  },
33
  {
34
  "name": "Beta",
35
+ "model": "openai/gpt-oss-120b",
36
  "provider": "groq",
37
  "client_type": "groq",
38
  "color": "yellow",
39
  "personality": (
40
+ "You are Agent Beta - a Deep Reasoner. "
41
+ "Think step by step. Show your chain of thought. "
42
  "Identify hidden assumptions and logical gaps the other agents miss. "
43
  "Precision and thoroughness over speed."
44
  )
45
  },
46
  {
47
  "name": "Gamma",
48
+ "model": "meta-llama/llama-4-scout-17b-16e-instruct",
49
  "provider": "groq",
50
  "client_type": "groq",
51
  "color": "green",
52
  "personality": (
53
+ "You are Agent Gamma - a Pattern Connector. "
54
  "Find non-obvious connections between different sources. "
55
  "Look for relationships and synthesis opportunities others miss. "
56
  "Think laterally and creatively."
 
58
  },
59
  {
60
  "name": "Delta",
61
+ "model": "qwen/qwen3-32b",
62
  "provider": "groq",
63
  "client_type": "groq",
64
  "color": "purple",
65
  "personality": (
66
+ "You are Agent Delta - a strict Literalist. "
67
  "Accept ONLY what is explicitly stated in the source text. "
68
  "Reject all inferences and extrapolations. "
69
  "If it is not literally written in the excerpts, it does not exist."
 
71
  },
72
  {
73
  "name": "Epsilon",
74
+ "model": "openai/gpt-oss-20b",
75
  "provider": "groq",
76
  "client_type": "groq",
77
  "color": "blue",
78
  "personality": (
79
+ "You are Agent Epsilon - the Synthesizer. "
80
  "Read all agents arguments, identify where they agree and disagree, "
81
  "and produce a final authoritative answer incorporating the strongest points. "
82
  "Be decisive. Cite sources clearly."
 
90
  CONTEXT_LIMIT = 3000 # chars fed to synthesizer to avoid 413
91
 
92
  DOMAIN_GUARD = """
93
+ SCOPE: EpiRAG - strictly epidemic modeling, network science, mathematical epidemiology.
94
  Do NOT answer anything outside this domain. If off-topic, say so and stop.
95
  """
96
 
 
206
  agent_colors = {a["name"]: a["color"] for a in AGENTS}
207
  debate_rounds = []
208
 
209
+ # -- Round 1 ----------------------------
210
  emit({"type": "round_start", "round": 1})
211
  round1 = {}
212
 
 
233
  current = round1
234
  rounds_run = 1
235
 
236
+ # -- Rounds 2+ ----------------------------
237
  while not consensus and rounds_run < MAX_ROUNDS:
238
  rounds_run += 1
239
  emit({"type": "round_start", "round": rounds_run})
 
261
  current = next_round
262
  consensus = _converged(next_round)
263
 
264
+ # -- Synthesis ----------------------------
265
  emit({"type": "synthesizing"})
266
  # Truncate context for synthesis to avoid 413 token limit errors
267
  ctx_trunc = context[:4000] if len(context) > 4000 else context