fix: 품질개선 계획 보완 — P0-3 옵션 확정, P1-4 실패 대안, P1-5 fallback 확인

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
happybell80 2026-03-21 16:07:28 +09:00
parent 5cc4e5aa08
commit d526b48d23

View File

@ -39,22 +39,25 @@
### P0-3: RRF 점수 정규화 (skill-rag-file)
- 파일: `app/services/postgres_vector_store.py``_merge_rrf()`
- 옵션 A: RRF 점수를 0~1로 정규화 — `rrf_normalized = rrf_raw / max_rrf_raw`
- 옵션 B: hybrid 모드에서 relevance_score를 `max(vector_score, rrf_score)`로 설정
- 옵션 C: hybrid용 threshold를 별도 파라미터로 분리 (기본 0.005)
- 권장: **옵션 A** — 정렬과 필터링이 일관됨
- **채택: 옵션 A** — RRF 점수를 0~1로 정규화: `rrf_normalized = rrf_raw / max_rrf_raw`
- 정렬과 필터링이 일관되고, threshold 0.35와 스케일이 맞음
- `relevance_score`에 정규화 값을 넣으므로 grounding_service의 정렬도 정상 동작
### P1-4: 초과 청크 재분할 (23 DB + 24 skill-rag-file)
- 현황: 3,204 청크 중 694건(22%)이 1,200자 초과
- 탐지: `SELECT document_id, chunk_index, length(chunk_text) FROM team_document_chunk WHERE length(chunk_text) > 1200 AND team_id = '79441171-...'`
- 해당 문서를 chunk_size=1000, overlap=200 기준으로 재인덱싱
- 스크립트: `skill-rag-file/scripts/reindex_oversized_chunks.py`
- **검증**: 재분할 후 옐로펀치 MOU(doc_id `b7116f6a`)가 "옐로펀치 컴퍼니엑스 협약" 쿼리로 top-5 진입하는지 실측
- **실패 시 대안**: 재분할로도 top-5 미진입이면 keyword prefix 매칭(P0-1)이 보완하므로 벡터 단독 해결에 집착하지 않음. keyword가 해당 문서를 잡으면 RRF 합산으로 순위 상승
### P1-5: grounding 라우팅 완화 (rb8001)
- 파일: `app/services/companyx_grounding_service.py``should_handle_companyx_grounding()`
- 변경: `team_id == COMPANYX_TEAM_ID`이면 `_looks_like_companyx_grounding_question()` 체크를 건너뛰고 항상 grounding 시도
- 주의: grounding 실패 시 일반 경로로 fallback하는 기존 흐름 유지 필요
- **fallback 확인**: 현재 `try_companyx_grounding()``None`을 반환하면 `message_service.py`가 일반 의도 분류로 진행 (라인 81-93). 이 흐름은 변경하지 않음
- 따라서 grounding 검색 결과 0건이면 기존처럼 일반 챗봇 경로로 자연 fallback
## 실행 순서