Skip to content

fix: improve chatbot schedule and contact responses - #151

Merged
Yu-JeSeung merged 2 commits into
mainfrom
fix/chatbot-response-accuracy
Jul 29, 2026
Merged

fix: improve chatbot schedule and contact responses#151
Yu-JeSeung merged 2 commits into
mainfrom
fix/chatbot-response-accuracy

Conversation

@Yu-JeSeung

@Yu-JeSeung Yu-JeSeung commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🎯 배경

  • 학사일정 응답 제목에 사용자 질의가 그대로 붙어 부자연스러운 문장이 생성됐습니다.
  • 연락처 인덱스가 잘못된 단위명을 저장하면서 응답이 기 연락처로 시작하는 문제가 발생했습니다.
  • 호텔과, 호탤과와 같은 학과 축약어 및 오타 질의에서 호텔관광학과가 아닌 연락처가 반환됐습니다.

🔍 주요 내용

  • 학사일정 질의의 요청 표현을 제거해 자연스러운 응답 제목을 생성하도록 개선했습니다.
  • 유효하지 않은 연락처 단위명이 인덱스에 포함되지 않도록 추출 조건을 강화했습니다.
  • 학과 축약어와 한글 자모 단위 오타를 고려한 연락처 매칭을 추가했습니다.
  • 공식 학과 페이지에서 추출한 연락처가 우선되도록 점수를 보정했습니다.
  • 일정 응답 제목과 연락처 매칭에 대한 회귀 검사를 추가했습니다.

변경 요약

학사일정 응답 제목을 자연스럽게 정리하고, 연락처 검색의 부서명·약어·오타 매칭 정확도를 개선했습니다. 관련 회귀 테스트도 추가했습니다.

주요 변경점

  • 일정 질의의 “언제”, “알려줘” 등의 표현을 제목에서 제거
  • 학사일정 제목을 학사일정 안내 형식으로 표준화
  • 잘못된 연락처 단위 후보 필터링 강화
  • 부서 약어와 한글 자모 단위 오타 매칭 지원
  • 공식 학과 페이지 기반 검색 결과에 가점 적용
  • 일정 제목 및 연락처 매칭 회귀 테스트 추가

주의/리스크

  • 유사도 기반 매칭 변경으로 연락처 검색 결과 순위가 달라질 수 있습니다.

다음 액션

  • 실제 부서 약어·오타 및 일정 질의를 대상으로 회귀 테스트를 확인해주세요.

@Yu-JeSeung Yu-JeSeung self-assigned this Jul 29, 2026
@Yu-JeSeung Yu-JeSeung added fix run-rag-check check rag eval labels Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

일정 질의 헤딩 정규화와 일정 라우팅 검증이 강화되었습니다. 연락처 단위 후보 필터와 문자열 유사도 기반 점수 계산이 추가되었고, 약어·오타 매칭 품질 검증이 확장되었습니다.

Changes

일정 헤딩 정규화

Layer / File(s) Summary
일정 헤딩 정규화 및 라우팅 검증
LLM/OSS/formatter.py, tests/regression/chatbot/check_chatbot_tool_routing.py
질의형 종결 표현을 제거하고 학사일정 안내를 표준 반환하며, 일정 도구 응답의 헤딩·목록 형식을 검증합니다.

연락처 단위 매칭

Layer / File(s) Summary
연락처 후보 필터링
LLM/sub_model/index_utils.py
연락처 단위 금지 키워드 목록과 hint fallback 후보 채택 조건을 변경합니다.
단위 유사도 점수 계산
LLM/sub_model/query_index.py, tests/regression/chatbot/check_query_index_metadata_quality.py
단위 표현의 정규화·자모 유사도 점수와 source marker 가점을 연락처 후보 순위에 반영하고, 약어·오타 매칭 임계값 검증을 추가합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed 제목이 학사일정과 연락처 응답 개선이라는 PR의 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed 배경과 주요 내용이 모두 포함되어 있으며, 템플릿의 관련 이슈 섹션만 비어 있지만 전체적으로는 충분히 완성되었습니다.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/chatbot-response-accuracy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
tests/regression/chatbot/check_query_index_metadata_quality.py (1)

386-390: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

실제 연락처 답변 경로도 회귀 테스트하세요.

현재 검증은 private helper인 _unit_term_score의 숫자 결과만 확인합니다. 새로 변경된 score_row의 제목·본문·source marker 가중치와 metadata_direct_answer의 최종 후보 선택은 테스트되지 않으므로, 약어와 오타 질의가 실제 전화번호/이메일 및 올바른 URL을 반환하는지 직접 검증하는 케이스를 추가하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/regression/chatbot/check_query_index_metadata_quality.py` around lines
386 - 390, Replace the `_unit_term_score`-only assertions in the regression test
with end-to-end cases through `metadata_direct_answer`, using the abbreviation
and typo queries. Verify each result returns the expected phone number/email and
correct URL, thereby exercising `score_row` title, body, and source-marker
weighting and final candidate selection.
tests/regression/chatbot/check_chatbot_tool_routing.py (1)

70-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

추가된 헤딩 정규화 분기를 모두 회귀 테스트해 주세요.

현재는 언제야?알려줘만 검증합니다. 언제, 알려주세요, 보여줘, 보여주세요, 학사 일정, 일정 케이스도 테이블 기반 테스트로 추가하면 정규식 변경으로 인한 회귀를 방지할 수 있습니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/regression/chatbot/check_chatbot_tool_routing.py` around lines 70 - 75,
테스트의 도구 라우팅 검증을 테이블 기반으로 확장하세요. `tools.run_mode_tools`를 사용하는 회귀 테스트에 `언제야?`,
`언제`, `알려줘`, `알려주세요`, `보여줘`, `보여주세요`, `학사 일정`, `일정` 입력을 모두 추가하고, 각 입력이 기대하는 정규화된
헤딩으로 시작하는지 검증해 정규식 분기를 포괄적으로 확인하세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@LLM/OSS/formatter.py`:
- Around line 68-76: 정규식 기반 텍스트 정리 로직에서 `언제요`, `언제에요` 및 관련 종결 표현과 선택적 물음표를 제거하도록
종료 패턴을 확장하세요. 기존 표현과 기본 헤딩 변환 동작은 유지하고, `개강 언제요?`, `개강 언제에요?`가 올바른 헤딩으로 정규화되는 회귀
테스트를 추가하세요.

---

Nitpick comments:
In `@tests/regression/chatbot/check_chatbot_tool_routing.py`:
- Around line 70-75: 테스트의 도구 라우팅 검증을 테이블 기반으로 확장하세요. `tools.run_mode_tools`를
사용하는 회귀 테스트에 `언제야?`, `언제`, `알려줘`, `알려주세요`, `보여줘`, `보여주세요`, `학사 일정`, `일정` 입력을 모두
추가하고, 각 입력이 기대하는 정규화된 헤딩으로 시작하는지 검증해 정규식 분기를 포괄적으로 확인하세요.

In `@tests/regression/chatbot/check_query_index_metadata_quality.py`:
- Around line 386-390: Replace the `_unit_term_score`-only assertions in the
regression test with end-to-end cases through `metadata_direct_answer`, using
the abbreviation and typo queries. Verify each result returns the expected phone
number/email and correct URL, thereby exercising `score_row` title, body, and
source-marker weighting and final candidate selection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 52d2d034-daf2-4962-b251-c13e9c21fd99

📥 Commits

Reviewing files that changed from the base of the PR and between a6f696d and 51d3fa0.

📒 Files selected for processing (5)
  • LLM/OSS/formatter.py
  • LLM/sub_model/index_utils.py
  • LLM/sub_model/query_index.py
  • tests/regression/chatbot/check_chatbot_tool_routing.py
  • tests/regression/chatbot/check_query_index_metadata_quality.py

Comment thread LLM/OSS/formatter.py
Comment on lines +68 to +76
text = re.sub(
r"\s*(?:언제(?:야|예요|인가요)?|알려\s*줘|알려\s*주세요|보여\s*줘|보여\s*주세요)$",
"",
text,
).strip()
if not text:
return "학사일정 안내"
if text in {"학사일정", "학사 일정", "일정"}:
return "학사일정 안내"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

언제요 계열 종결 표현도 제거해 주세요.

현재 정규식은 개강 언제요?개강 언제에요?를 제거하지 못해 개강 언제요 일정 같은 잘못된 헤딩을 생성합니다. , 에요 등 지원할 표현을 추가하고 회귀 테스트로 고정해 주세요.

권장 수정
-        r"\s*(?:언제(?:야|예요|인가요)?|알려\s*줘|알려\s*주세요|보여\s*줘|보여\s*주세요)$",
+        r"\s*(?:언제(?:야|요|예요|에요|인가요|죠)?|알려\s*줘|알려\s*주세요|보여\s*줘|보여\s*주세요)$",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
text = re.sub(
r"\s*(?:언제(?:야|예요|인가요)?|알려\s*줘|알려\s*주세요|보여\s*줘|보여\s*주세요)$",
"",
text,
).strip()
if not text:
return "학사일정 안내"
if text in {"학사일정", "학사 일정", "일정"}:
return "학사일정 안내"
text = re.sub(
r"\s*(?:언제(?:야|요|예요|에요|인가요|죠)?|알려\s*줘|알려\s*주세요|보여\s*줘|보여\s*주세요)$",
"",
text,
).strip()
if not text:
return "학사일정 안내"
if text in {"학사일정", "학사 일정", "일정"}:
return "학사일정 안내"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@LLM/OSS/formatter.py` around lines 68 - 76, 정규식 기반 텍스트 정리 로직에서 `언제요`, `언제에요`
및 관련 종결 표현과 선택적 물음표를 제거하도록 종료 패턴을 확장하세요. 기존 표현과 기본 헤딩 변환 동작은 유지하고, `개강 언제요?`,
`개강 언제에요?`가 올바른 헤딩으로 정규화되는 회귀 테스트를 추가하세요.

@Yu-JeSeung
Yu-JeSeung merged commit a49c35e into main Jul 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix run-rag-check check rag eval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant