jdesiree commited on
Commit
b13216b
·
verified ·
1 Parent(s): 20ee050

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +51 -1
agents.py CHANGED
@@ -461,7 +461,57 @@ Assessment:
461
  logger.error(f"Agent 4 error: {e}")
462
  return False, False
463
 
464
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  # ============================================================================
466
  # THINKING AGENTS (Preprocessing Layer)
467
  # ============================================================================
 
461
  logger.error(f"Agent 4 error: {e}")
462
  return False, False
463
 
464
+ def process(
465
+ self,
466
+ user_input: str,
467
+ tool_used: bool = False,
468
+ conversation_history: Optional[List[Dict]] = None
469
+ ) -> Tuple[str, str]:
470
+ """
471
+ Unified process method - runs all 4 routing agents sequentially.
472
+
473
+ Returns:
474
+ Tuple[str, str]: (response_prompts, thinking_prompts)
475
+ """
476
+ if conversation_history is None:
477
+ conversation_history = []
478
+
479
+ response_prompts = []
480
+ thinking_prompts = []
481
+
482
+ # Agent 1: Practice Questions
483
+ if self.agent_1_practice_question(user_input, conversation_history):
484
+ response_prompts.append("STRUCTURE_PRACTICE_QUESTIONS")
485
+
486
+ # Agent 2: Discovery Mode
487
+ is_vague, low_understanding = self.agent_2_discovery_mode(user_input, conversation_history)
488
+ if is_vague:
489
+ response_prompts.append("VAUGE_INPUT")
490
+ if low_understanding:
491
+ response_prompts.append("USER_UNDERSTANDING")
492
+
493
+ # Agent 3: Follow-up Assessment
494
+ if self.agent_3_followup_assessment(user_input, conversation_history):
495
+ response_prompts.append("PRACTICE_QUESTION_FOLLOWUP")
496
+
497
+ # Agent 4: Teaching Mode
498
+ needs_teaching, needs_practice = self.agent_4_teaching_mode(user_input, conversation_history)
499
+ if needs_teaching:
500
+ response_prompts.append("GUIDING_TEACHING")
501
+
502
+ # Always add base formatting
503
+ response_prompts.extend(["GENERAL_FORMATTING", "LATEX_FORMATTING"])
504
+
505
+ # Tool enhancement if used
506
+ if tool_used:
507
+ response_prompts.append("TOOL_USE_ENHANCEMENT")
508
+
509
+ # Return as newline-separated strings
510
+ response_prompts_str = "\n".join(response_prompts)
511
+ thinking_prompts_str = "" # Thinking prompts decided elsewhere
512
+
513
+ return response_prompts_str, thinking_prompts_str
514
+
515
  # ============================================================================
516
  # THINKING AGENTS (Preprocessing Layer)
517
  # ============================================================================