Basitha commited on
Commit
cc20761
·
verified ·
1 Parent(s): 4c269e9

Update researchsimulation/InteractiveInterviewChatbot.py

Browse files
researchsimulation/InteractiveInterviewChatbot.py CHANGED
@@ -413,17 +413,15 @@ def validate_generic_answer(agent_name, agent_question, generic_answer, user_pro
413
  logging.exception("[validate_generic_answer] Exception during validation")
414
  return False
415
 
416
- def validate_styled_answer(agent_name, agent_question, styled_answer, user_profile, processor_llm, interview_transcript_text):
417
  """
418
- Validates whether the styled answer matches the user's typical speaking style using prior interview transcript and communication profile.
419
  Returns True if stylistically aligned, False otherwise.
420
  """
421
  logging.info("[validate_styled_answer] Entry")
422
  try:
423
- # Use transcript-based style matching logic
424
  is_valid = matches_user_speaking_style(
425
  answer=styled_answer,
426
- transcript_text=interview_transcript_text,
427
  processor_llm=processor_llm,
428
  user_profile=user_profile,
429
  agent_question=agent_question
@@ -434,6 +432,7 @@ def validate_styled_answer(agent_name, agent_question, styled_answer, user_profi
434
  logging.exception("[validate_styled_answer] Exception during style validation")
435
  return False
436
 
 
437
  # --- Updated ask_interview_question Function ---
438
  def ask_interview_question(respondent_agents_dict, last_active_agent, question, processor_llm):
439
  logging.info("[ask_interview_question] Entry")
@@ -497,7 +496,7 @@ def ask_interview_question(respondent_agents_dict, last_active_agent, question,
497
  tailored_attempts += 1
498
  continue
499
 
500
- if validate_styled_answer(agent_name, agent_question, styled, user_profile, processor_llm, interview_transcript_text):
501
  tailored_answer = styled
502
  break
503
 
 
413
  logging.exception("[validate_generic_answer] Exception during validation")
414
  return False
415
 
416
+ def validate_styled_answer(agent_name, agent_question, styled_answer, user_profile, processor_llm):
417
  """
418
+ Validates whether the styled answer matches the user's typical speaking style using communication profile.
419
  Returns True if stylistically aligned, False otherwise.
420
  """
421
  logging.info("[validate_styled_answer] Entry")
422
  try:
 
423
  is_valid = matches_user_speaking_style(
424
  answer=styled_answer,
 
425
  processor_llm=processor_llm,
426
  user_profile=user_profile,
427
  agent_question=agent_question
 
432
  logging.exception("[validate_styled_answer] Exception during style validation")
433
  return False
434
 
435
+
436
  # --- Updated ask_interview_question Function ---
437
  def ask_interview_question(respondent_agents_dict, last_active_agent, question, processor_llm):
438
  logging.info("[ask_interview_question] Entry")
 
496
  tailored_attempts += 1
497
  continue
498
 
499
+ if validate_styled_answer(agent_name, agent_question, styled_answer, user_profile, processor_llm):
500
  tailored_answer = styled
501
  break
502