Orchestrates the human-centric aspects of the interview:
class HumanityManager:
def __init__(self, model):
self.model = model
self.analyzer = HumanityAnalyzer(model)Key responsibilities:
- Processes responses through multiple humanity dimensions
- Enhances questions based on emotional state
- Manages interview flow adaptively
- Tracks emotional and cognitive patterns
Deep analysis of human responses:
class HumanityAnalyzer:
def analyze_emotional_content(self, response: str) -> Dict:
# Analyzes:
# - Emotional weight (0-1)
# - Trauma indicators
# - Emotional cues
# - Key emotions
# - Support needsKey analysis dimensions:
-
Emotional Analysis
- Emotional intensity
- Trauma detection
- Support needs
- Emotional complexity
-
Cognitive Analysis
- Mental load
- Processing patterns
- Fatigue indicators
- Complexity handling
-
Engagement Analysis
- Participation level
- Response patterns
- Topic investment
- Interaction quality
Main orchestrator managing the interview process:
class InterviewBot:
def __init__(self):
self.humanity = HumanityManager(self.model)
self.state = self.get_default_state()Key features:
-
State Management
def get_default_state(self) -> State: return { "humanity": { "emotional": {...}, "cognitive": {...}, "engagement": {...}, "formality": {...}, "persona": {...} } }
-
Response Processing
def process_response(self, state: Dict) -> Dict: # 1. Factor analysis coverage = self.analyze_response(state["user_message"], current_topic) # 2. Emotional analysis processed_state = self.humanity.process_response(state, state["user_message"])
-
Intent Analysis
def analyze_intent(self, state: State) -> State: # Detects intents like: # - direct_response # - refuses_question # - asking_purpose # - seeking_clarification # - expressing_concern
- Trauma Detection
if any(word in message_lower for word in critical_words):
processed_state["humanity"]["emotional"].update({
"emotional_weight": 0.9,
"trauma_indicators": True,
"requires_support": True
})- Response Enhancement
def _build_enhancement_prompt(self, question: str, state: Dict) -> str:
# Enhances based on:
# - Emotional state
# - Cognitive load
# - Engagement level
# - Formality needs- Question Generation
def _generate_base_question(self, state: Dict) -> Dict:
# Adapts based on:
# - Uncovered factors
# - Emotional context
# - Previous responses
# - Support needs- Topic Management
def check_topic_progress(self, state: Dict) -> Dict:
# Tracks:
# - Questions per topic
# - Coverage progress
# - Value assessment
# - Topic exhaustionclass EmotionalAnalysis(BaseModel):
emotional_weight: float
trauma_indicators: bool
emotional_cues: List[str]
key_emotions: List[str]
requires_support: bool
emotional_complexity: floatdef assess_cognitive_load(self, response: str) -> Dict:
return {
"current_load": float,
"complexity_indicators": List[str],
"processing_patterns": Dict,
"mental_effort_level": float,
"fatigue_indicators": int
}def calculate_engagement(self, response: str) -> Dict:
return {
"dimensions": {
"elaboration": float,
"investment": float,
"emotional": float,
"interactive": float,
# ...more dimensions
},
"engagement_patterns": Dict
}- Critical Content Detection
critical_words = ['smrt', 'sebevražd', 'zemřel', 'zemřela', 'zabil', 'zabila']- Support Triggers
if emotional["requires_support"]:
# Trigger supportive response
# Adjust approach
# Monitor emotional state- Topic Refusal Handling
def handle_topic_refusal(self, state: Dict) -> Dict:
# Respects boundaries
# Marks topics as sensitive
# Adjusts approach
# Moves to safer topicsThis system is fucking smart because it:
- Deeply analyzes human emotional states
- Adapts in real-time to emotional needs
- Handles trauma and sensitive topics carefully
- Maintains professional research context while being emotionally intelligent
- Uses multiple dimensions of human analysis for better understanding
Let me know if you need more details about any specific component!