docs: 의도 분류 LLM-first(v2) 전환 워크로그 — 키워드 27% → LLM 94%

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
happybell80 2026-03-23 03:22:13 +09:00
parent 923bef1117
commit 95bcdbdaf1

View File

@ -0,0 +1,61 @@
---
type: worklog
tags: [worklog, rb8001, intent, llm, pydantic, intent-classifier]
work_date: 2026-03-23
---
# 260323 의도 분류 LLM-first(v2) 전환
## 배경
- 기존 의도 분류(v1): 키워드 정규식 FastPath → Naive Bayes → LLM 순차
- 202개 질문 테스트 결과: 키워드 **27%** 정확도
- 사용자 질문이 키워드에 안 걸리면 UNKNOWN → 일반 LLM 경로로 빠짐
## 변경
### 새 의도 분류기: `intent_classifier.py`
- **LLM-first**: 키워드 없이 LLM이 바로 의도 판단
- **Pydantic 검증**: `IntentResult(intent, confidence, slots, reasoning, needs_clarify)`
- **JSON 강제**: `response_format={"type": "json_object"}`
- **SKILL_REGISTRY**: OpenClaw 스타일 스킬 목록 (트리거 + 예시)
- **키워드 폴백**: LLM 실패 시에만 기존 DecisionEngine 사용
### 스킬 레지스트리 (10개 의도)
| intent | 설명 |
|--------|------|
| self_inspect | 시간, 코드 탐색, 드래프트, 대화 이력 |
| companyx_rag | Company X 내부 문서 |
| web_search | 날씨, 주가, 환율, 실시간 정보 |
| calendar_event | 일정 등록 |
| calendar_query | 일정 조회 |
| email_read | 이메일 읽기 |
| email_send | 이메일 발송 |
| news_fetch | 뉴스 |
| greeting | 인사 |
| general_chat | 일반 대화 |
### 환경변수
- `INTENT_ENGINE=v2` → LLM-first (현재 활성)
- `INTENT_ENGINE=graph` → 기존 IntentGraph (폴백/롤백)
## 테스트 결과 (202개 질문)
| 방식 | 정확도 |
|------|--------|
| OLD (키워드) | 27% (56/202) |
| **NEW (LLM)** | **94% (191/202)** |
## 커밋
- `5f18a9a`: intent_classifier.py 신규
- `ac3e617`: message_service v2 전환 + INTENT_ENGINE=v2
## 관련 파일
- `rb8001/app/services/brain/intent_classifier.py`
- `rb8001/app/services/message_service.py`
- `rb8001/docker-compose.yml`