alexmec commited on
Commit
a9f90bf
Β·
verified Β·
1 Parent(s): 07c42cc

Upload folder using huggingface_hub

Browse files
apps/app.py CHANGED
@@ -53,8 +53,8 @@ class FantasyDraftApp:
53
  self.current_draft = None
54
  self.draft_output = ""
55
 
56
- # Use basic multiagent draft
57
- draft_generator = run_interactive_mock_draft()
58
 
59
  for output in draft_generator:
60
  if isinstance(output, tuple):
 
53
  self.current_draft = None
54
  self.draft_output = ""
55
 
56
+ # Use basic multiagent draft with custom prompts
57
+ draft_generator = run_interactive_mock_draft(custom_prompts=self.custom_prompts)
58
 
59
  for output in draft_generator:
60
  if isinstance(output, tuple):
apps/multiagent_draft.py CHANGED
@@ -21,12 +21,19 @@ USE_ENHANCED = False
21
  class DraftAgent:
22
  """Base class for draft agents with specific strategies."""
23
 
24
- def __init__(self, team_name: str, strategy: str, color: str, icon: str):
25
  self.team_name = team_name
26
  self.strategy = strategy
27
  self.color = color
28
  self.icon = icon
29
- self.agent = FantasyDraftAgent()
 
 
 
 
 
 
 
30
  self.picks = []
31
  self.conversation_memory = []
32
 
@@ -90,8 +97,8 @@ Don't be polite - show confidence and give as good as you get."""
90
  class ZeroRBAgent(DraftAgent):
91
  """Agent that follows Zero RB strategy."""
92
 
93
- def __init__(self, team_name: str):
94
- super().__init__(team_name, "Zero RB Strategy", "#E3F2FD", "πŸ“˜")
95
  self.person_emoji = "πŸ€“" # Analytical nerd
96
 
97
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
@@ -168,8 +175,8 @@ Use terms like "value", "steal", "while others reached" - not raw numbers."""
168
  class BPAAgent(DraftAgent):
169
  """Agent that follows Best Player Available strategy."""
170
 
171
- def __init__(self, team_name: str):
172
- super().__init__(team_name, "Best Player Available", "#E8F5E9", "πŸ“—")
173
  self.person_emoji = "πŸ§‘β€πŸ’Ό" # Business-like, calculated
174
 
175
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
@@ -215,8 +222,8 @@ Don't use raw ADP numbers - use terms like "best available", "top-ranked", "obvi
215
  class RobustRBAgent(DraftAgent):
216
  """Agent that follows Robust RB strategy."""
217
 
218
- def __init__(self, team_name: str):
219
- super().__init__(team_name, "Robust RB Strategy", "#FFF3E0", "πŸ“™")
220
  self.person_emoji = "πŸ§”" # Old-school, traditional
221
 
222
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
@@ -291,8 +298,8 @@ Focus on your "foundation" and "championship formula" - avoid raw rankings."""
291
  class UpsideAgent(DraftAgent):
292
  """Agent that hunts for upside/breakout players."""
293
 
294
- def __init__(self, team_name: str):
295
- super().__init__(team_name, "Upside Hunter", "#FFFDE7", "πŸ““")
296
  self.person_emoji = "🀠" # Risk-taking cowboy
297
 
298
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
@@ -358,8 +365,8 @@ Use exciting terms like "breakout", "league-winner", "explosive" - not rankings.
358
  class UserAdvisorAgent(DraftAgent):
359
  """Agent that advises the user during their picks."""
360
 
361
- def __init__(self):
362
- super().__init__("Your Advisor", "Strategic Advisor", "#FFEBEE", "πŸ“•")
363
  self.person_emoji = "πŸ§™" # Wise advisor
364
  self.user_picks = []
365
 
@@ -453,18 +460,20 @@ class CommissionerAgent:
453
  class MultiAgentMockDraft:
454
  """Orchestrates the multi-agent mock draft."""
455
 
456
- def __init__(self, user_pick_position: int = 4):
457
- # Initialize agents
 
 
458
  self.agents = {
459
- 1: ZeroRBAgent("Team 1"),
460
- 2: BPAAgent("Team 2"),
461
- 3: RobustRBAgent("Team 3"),
462
- 5: UpsideAgent("Team 5")
463
  }
464
 
465
  # Add Team 6 as BPA if it's not the user position
466
  if 6 != user_pick_position:
467
- self.agents[6] = BPAAgent("Team 6")
468
  self.agents[6].person_emoji = "πŸ‘¨β€πŸ«" # Professor, methodical
469
 
470
  self.user_position = user_pick_position
 
21
  class DraftAgent:
22
  """Base class for draft agents with specific strategies."""
23
 
24
+ def __init__(self, team_name: str, strategy: str, color: str, icon: str, custom_instructions: Optional[str] = None):
25
  self.team_name = team_name
26
  self.strategy = strategy
27
  self.color = color
28
  self.icon = icon
29
+ self.custom_instructions = custom_instructions
30
+
31
+ # Create agent with custom instructions if provided
32
+ if custom_instructions:
33
+ self.agent = FantasyDraftAgent(custom_instructions=custom_instructions)
34
+ else:
35
+ self.agent = FantasyDraftAgent()
36
+
37
  self.picks = []
38
  self.conversation_memory = []
39
 
 
97
  class ZeroRBAgent(DraftAgent):
98
  """Agent that follows Zero RB strategy."""
99
 
100
+ def __init__(self, team_name: str, custom_instructions: Optional[str] = None):
101
+ super().__init__(team_name, "Zero RB Strategy", "#E3F2FD", "πŸ“˜", custom_instructions)
102
  self.person_emoji = "πŸ€“" # Analytical nerd
103
 
104
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
 
175
  class BPAAgent(DraftAgent):
176
  """Agent that follows Best Player Available strategy."""
177
 
178
+ def __init__(self, team_name: str, custom_instructions: Optional[str] = None):
179
+ super().__init__(team_name, "Best Player Available", "#E8F5E9", "πŸ“—", custom_instructions)
180
  self.person_emoji = "πŸ§‘β€πŸ’Ό" # Business-like, calculated
181
 
182
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
 
222
  class RobustRBAgent(DraftAgent):
223
  """Agent that follows Robust RB strategy."""
224
 
225
+ def __init__(self, team_name: str, custom_instructions: Optional[str] = None):
226
+ super().__init__(team_name, "Robust RB Strategy", "#FFF3E0", "πŸ“™", custom_instructions)
227
  self.person_emoji = "πŸ§”" # Old-school, traditional
228
 
229
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
 
298
  class UpsideAgent(DraftAgent):
299
  """Agent that hunts for upside/breakout players."""
300
 
301
+ def __init__(self, team_name: str, custom_instructions: Optional[str] = None):
302
+ super().__init__(team_name, "Upside Hunter", "#FFFDE7", "πŸ““", custom_instructions)
303
  self.person_emoji = "🀠" # Risk-taking cowboy
304
 
305
  def make_pick(self, available_players: List[str], draft_board: Dict) -> Tuple[str, str]:
 
365
  class UserAdvisorAgent(DraftAgent):
366
  """Agent that advises the user during their picks."""
367
 
368
+ def __init__(self, custom_instructions: Optional[str] = None):
369
+ super().__init__("Your Advisor", "Strategic Advisor", "#FFEBEE", "πŸ“•", custom_instructions)
370
  self.person_emoji = "πŸ§™" # Wise advisor
371
  self.user_picks = []
372
 
 
460
  class MultiAgentMockDraft:
461
  """Orchestrates the multi-agent mock draft."""
462
 
463
+ def __init__(self, user_pick_position: int = 4, custom_prompts: Optional[Dict[int, str]] = None):
464
+ # Initialize agents with custom prompts if provided
465
+ self.custom_prompts = custom_prompts or {}
466
+
467
  self.agents = {
468
+ 1: ZeroRBAgent("Team 1", self.custom_prompts.get(1)),
469
+ 2: BPAAgent("Team 2", self.custom_prompts.get(2)),
470
+ 3: RobustRBAgent("Team 3", self.custom_prompts.get(3)),
471
+ 5: UpsideAgent("Team 5", self.custom_prompts.get(5))
472
  }
473
 
474
  # Add Team 6 as BPA if it's not the user position
475
  if 6 != user_pick_position:
476
+ self.agents[6] = BPAAgent("Team 6", self.custom_prompts.get(6))
477
  self.agents[6].person_emoji = "πŸ‘¨β€πŸ«" # Professor, methodical
478
 
479
  self.user_position = user_pick_position
apps/multiagent_scenarios.py CHANGED
@@ -151,13 +151,13 @@ def create_mock_draft_visualization(draft: MultiAgentMockDraft,
151
  return output
152
 
153
 
154
- def run_interactive_mock_draft():
155
  """Run an interactive mock draft demo that yields formatted output."""
156
 
157
  try:
158
  # Initialize the draft
159
  print("Initializing MultiAgentMockDraft...")
160
- draft = MultiAgentMockDraft(user_pick_position=4)
161
  print("Draft initialized successfully")
162
 
163
  # Skip introductions and go straight to commissioner welcome
 
151
  return output
152
 
153
 
154
+ def run_interactive_mock_draft(custom_prompts=None):
155
  """Run an interactive mock draft demo that yields formatted output."""
156
 
157
  try:
158
  # Initialize the draft
159
  print("Initializing MultiAgentMockDraft...")
160
+ draft = MultiAgentMockDraft(user_pick_position=4, custom_prompts=custom_prompts)
161
  print("Draft initialized successfully")
162
 
163
  # Skip introductions and go straight to commissioner welcome
core/agent.py CHANGED
@@ -24,10 +24,11 @@ if not os.getenv("OPENAI_API_KEY"):
24
 
25
 
26
  class FantasyDraftAgent:
27
- def __init__(self, framework: str = "tinyagent", model_id: str = "gpt-4o-mini"):
28
  """Initialize the Fantasy Draft Agent."""
29
  self.framework = framework
30
  self.model_id = model_id
 
31
 
32
  # Draft state management
33
  self.draft_state = {
@@ -89,6 +90,10 @@ class FantasyDraftAgent:
89
 
90
  def _get_instructions(self) -> str:
91
  """Get the agent's system instructions."""
 
 
 
 
92
  return """You are an expert fantasy football draft assistant with deep knowledge of:
93
  - Player values, tiers, and ADP (Average Draft Position)
94
  - Draft strategy (Zero RB, Hero RB, Robust RB, etc.)
 
24
 
25
 
26
  class FantasyDraftAgent:
27
+ def __init__(self, framework: str = "tinyagent", model_id: str = "gpt-4o-mini", custom_instructions: Optional[str] = None):
28
  """Initialize the Fantasy Draft Agent."""
29
  self.framework = framework
30
  self.model_id = model_id
31
+ self.custom_instructions = custom_instructions
32
 
33
  # Draft state management
34
  self.draft_state = {
 
90
 
91
  def _get_instructions(self) -> str:
92
  """Get the agent's system instructions."""
93
+ # Use custom instructions if provided, otherwise use default
94
+ if self.custom_instructions:
95
+ return self.custom_instructions
96
+
97
  return """You are an expert fantasy football draft assistant with deep knowledge of:
98
  - Player values, tiers, and ADP (Average Draft Position)
99
  - Draft strategy (Zero RB, Hero RB, Robust RB, etc.)