diff --git a/troubleshooting/20251002_emotion_top-p_improvement.md b/troubleshooting/20251002_emotion_top-p_improvement.md index 661c549..b7ca1ce 100644 --- a/troubleshooting/20251002_emotion_top-p_improvement.md +++ b/troubleshooting/20251002_emotion_top-p_improvement.md @@ -55,17 +55,29 @@ fear 45% + sadness 30% = 75% (> 70%) ### 3. 구현 계획 -#### emotion_llm.py 수정 -- analyze_user_emotion() 반환값 확장 -- EmotionState에 복합 감정 필드 추가 또는 별도 반환 +#### 핵심 파일 위치 +- emotion/base.py:19-50 (EmotionState 구조) +- emotion_llm.py:26-98 (analyze_user_emotion) +- llm_service.py:86-94 (프롬프트 조절) +- database.py:172-177 (DB 저장) -#### llm_service.py 수정 +#### emotion_llm.py:26-98 수정 +- Top-p 70% 로직 추가 +- 복합 감정 리스트 반환 (EmotionState 확장 또는 별도) + +#### llm_service.py:86-94 수정 +- 단일/복합 감정 구분 - 복합 감정별 system_instruction 매핑 -- 단일/복합 감정 구분 로직 + - fear+sadness: "조심스럽고 따뜻하게" + - anger+disgust: "침착하고 객관적으로" -#### DB 스키마 검토 -- top_label → top_emotions (array) -- top_p → cumulative_p (누적 확률) +#### database.py:172-177 수정 +- top_label (VARCHAR) → top_emotions (JSONB array) +- top_p (FLOAT) → cumulative_p (FLOAT) + +#### EmotionState 확장 검토 +- 현재: emotion_dist, entropy, dominant, confidence +- 추가 필요: top_emotions (List[str]), cumulative_p (float) ## 참고 문헌 - Top-p Sampling: https://en.wikipedia.org/wiki/Top-p_sampling