Spaces:
Running

axeronis commited on
Commit
5bd59d7
·
1 Parent(s): de3fd85

fix: AISummary defaults to prevent Pydantic validation errors

Browse files
Files changed (1) hide show
  1. backend/app/models/ai_summary.py +16 -9
backend/app/models/ai_summary.py CHANGED
@@ -23,51 +23,58 @@ class AISummary(BaseModel):
23
  )
24
 
25
  # Core BANT fields with confidence
26
- intent: str = Field(description="Main goal or objective of the user (НА РУССКОМ)")
27
- intent_confidence: float = Field(description="Confidence in intent extraction (0.0-1.0)")
28
 
29
- budget: str = Field(description="Financial capacity or budget constraint (НА РУССКОМ)")
30
- budget_confidence: float = Field(description="Confidence in budget assessment")
31
 
32
- timeline: str = Field(description="Urgency or timeframe for the request (НА РУССКОМ)")
33
- timeline_confidence: float = Field(description="Confidence in timeline extraction")
34
 
35
- authority: str = Field(description="Decision-making power or role in the buying process (НА РУССКОМ)")
36
- authority_confidence: float = Field(description="Confidence in authority assessment")
37
 
38
  # Analysis fields
39
  pain_points: List[str] = Field(
 
40
  description="List of problems, needs, or challenges expressed by the user (НА РУССКОМ). "
41
  "ТОЛЬКО из РЕАЛЬНЫХ слов клиента! Если нет данных → ['Будет уточнено']. "
42
  "Формат: список из 2-5 конкретных боли"
43
  )
44
 
45
  psychotype: str = Field(
 
46
  description="DISC personality profile inferred from communication style. "
47
  "Must be one of: 'Dominant', 'Influential', 'Steady', 'Conscientious', or 'Unknown'"
48
  )
49
- psychotype_confidence: float = Field(description="Confidence in psychotype detection")
50
 
51
  heat_score: int = Field(
 
52
  description="Probability of closing the deal, 0-100. Based on BANT, engagement, and buying signals"
53
  )
54
 
55
  objections: List[str] = Field(
 
56
  description="Barriers or concerns preventing the sale (НА РУССКОМ). "
57
  "ТОЛЬКО если клиент ДЕЙСТВИТЕЛЬНО возражал! Если нет → ['Не обнаружено']"
58
  )
59
 
60
  hidden_signals: str = Field(
 
61
  description="Implicit context or subtext read between the lines (НА РУССКОМ). "
62
  "Здесь ИНФЕРЕНС РАЗРЕШЕН (например: клиент пишет коротко → возможно не заинтересован)"
63
  )
64
 
65
  recommendation: str = Field(
 
66
  description="Strategic advice for the human sales manager on next steps (НА РУССКОМ). "
67
  "Что должен сделать менеджер ДАЛЕЕ? Будьте конкретны"
68
  )
69
 
70
  draft_reply: str = Field(
 
71
  description="Suggested response message text, adapted to psychotype (НА РУССКОМ). "
72
  "Профессиональный ответ для продолжения диалога, соответствующий психотипу клиента"
73
  )
 
23
  )
24
 
25
  # Core BANT fields with confidence
26
+ intent: str = Field(default="Не определено", description="Main goal or objective of the user (НА РУССКОМ)")
27
+ intent_confidence: float = Field(default=0.5, description="Confidence in intent extraction (0.0-1.0)")
28
 
29
+ budget: str = Field(default="Не выявлено", description="Financial capacity or budget constraint (НА РУССКОМ)")
30
+ budget_confidence: float = Field(default=0.5, description="Confidence in budget assessment")
31
 
32
+ timeline: str = Field(default="Не выявлено", description="Urgency or timeframe for the request (НА РУССКОМ)")
33
+ timeline_confidence: float = Field(default=0.5, description="Confidence in timeline extraction")
34
 
35
+ authority: str = Field(default="Не выявлено", description="Decision-making power or role in the buying process (НА РУССКОМ)")
36
+ authority_confidence: float = Field(default=0.5, description="Confidence in authority assessment")
37
 
38
  # Analysis fields
39
  pain_points: List[str] = Field(
40
+ default_factory=list,
41
  description="List of problems, needs, or challenges expressed by the user (НА РУССКОМ). "
42
  "ТОЛЬКО из РЕАЛЬНЫХ слов клиента! Если нет данных → ['Будет уточнено']. "
43
  "Формат: список из 2-5 конкретных боли"
44
  )
45
 
46
  psychotype: str = Field(
47
+ default="Unknown",
48
  description="DISC personality profile inferred from communication style. "
49
  "Must be one of: 'Dominant', 'Influential', 'Steady', 'Conscientious', or 'Unknown'"
50
  )
51
+ psychotype_confidence: float = Field(default=0.5, description="Confidence in psychotype detection")
52
 
53
  heat_score: int = Field(
54
+ default=50,
55
  description="Probability of closing the deal, 0-100. Based on BANT, engagement, and buying signals"
56
  )
57
 
58
  objections: List[str] = Field(
59
+ default_factory=list,
60
  description="Barriers or concerns preventing the sale (НА РУССКОМ). "
61
  "ТОЛЬКО если клиент ДЕЙСТВИТЕЛЬНО возражал! Если нет → ['Не обнаружено']"
62
  )
63
 
64
  hidden_signals: str = Field(
65
+ default="Не обнаружено",
66
  description="Implicit context or subtext read between the lines (НА РУССКОМ). "
67
  "Здесь ИНФЕРЕНС РАЗРЕШЕН (например: клиент пишет коротко → возможно не заинтересован)"
68
  )
69
 
70
  recommendation: str = Field(
71
+ default="Продолжить диалог",
72
  description="Strategic advice for the human sales manager on next steps (НА РУССКОМ). "
73
  "Что должен сделать менеджер ДАЛЕЕ? Будьте конкретны"
74
  )
75
 
76
  draft_reply: str = Field(
77
+ default="",
78
  description="Suggested response message text, adapted to psychotype (НА РУССКОМ). "
79
  "Профессиональный ответ для продолжения диалога, соответствующий психотипу клиента"
80
  )