From 4b2544c88b6f43effd382902ec78f74dd339f806 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Thu, 2 Oct 2025 16:57:20 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Top-p=20=EA=B5=AC=ED=98=84=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=B6=94=EA=B0=80=20-=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98,=20=EC=A4=84=EB=B2=88=ED=98=B8,=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EA=B3=84=ED=9A=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 핵심 파일 4개 위치:줄번호 명시 - EmotionState 확장 검토 - DB 스키마 변경 계획 - 복합 감정 매핑 예시 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../20251002_emotion_top-p_improvement.md | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) 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