fix: improve grouped dormitory facility search#36
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a conditional search mechanism for dormitory-related queries, implementing a per-dormitory search strategy when specific keywords are detected in the user's question. The feedback focuses on cleaning up the implementation by removing debug print statements, externalizing hardcoded trigger keywords to constants or settings for better maintainability, and removing redundant hardcoded parameters that match default values in the search function.
Comment on lines
+439
to
+451
| print("===== GROUPED SEARCH DEBUG =====") | ||
| print("question:", question) | ||
| print("chunks_count:", len(chunks)) | ||
| for index, chunk in enumerate(chunks, start=1): | ||
| print( | ||
| index, | ||
| chunk.get("document_id"), | ||
| chunk.get("dormitory"), | ||
| chunk.get("similarity"), | ||
| chunk.get("source"), | ||
| (chunk.get("content") or "")[:300], | ||
| ) | ||
| print("================================") |
Contributor
Comment on lines
+896
to
+909
| dormitory_specific_triggers = [ | ||
| "휴게실", | ||
| "다리미", | ||
| "편의점", | ||
| "전자레인지", | ||
| "전자렌지", | ||
| "정수기", | ||
| "세탁실", | ||
| "탕비실", | ||
| "수용인원", | ||
| "몇명", | ||
| "몇명수용", | ||
| "호실수", | ||
| ] |
Contributor
Comment on lines
+925
to
+933
| dormitory_chunks = search_hybrid_chunks( | ||
| db=db, | ||
| query_text=question, | ||
| query_embedding=query_embedding, | ||
| dormitory=dormitory, | ||
| top_k=top_k_per_dormitory, | ||
| candidate_k=20, | ||
| keyword_weight=0.3, | ||
| ) |
Contributor
There was a problem hiding this comment.
candidate_k와 keyword_weight 값이 하드코딩되어 있습니다. 이 값들은 search_hybrid_chunks 함수의 기본값과 동일하므로 생략 가능하며, 만약 명시적으로 관리하고 싶다면 Settings나 공통 상수를 사용하여 중복을 피하는 것이 좋습니다.
dormitory_chunks = search_hybrid_chunks(
db=db,
query_text=question,
query_embedding=query_embedding,
dormitory=dormitory,
top_k=top_k_per_dormitory,
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
유형
변경 사항
dormitory = null상태에서 생활관별 시설 질문을 처리할 때, 전체 검색 top_k 안에 특정 생활관 정보가 누락되는 문제를 개선했습니다.수정 배경
휴게실에 뭐 있어?처럼 생활관을 특정하지 않은 질문에서 제1, 제3학생생활관 정보는 검색되었지만 제2학생생활관 정보가 top_k 밖으로 밀려 답변에서 누락되는 문제가 있었습니다.테스트
휴게실에 뭐 있어?+dormitory = null다리미 있어?+dormitory = null기숙사 수용 인원 어느 정도야?+dormitory = null기대 효과