-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[feat] text similarity 추가 및 LLM 서버 API 연결, MySQL Full text Index 추가 #39
Merged
Conversation
This file contains 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
# for free
to join this conversation on GitHub.
Already have an account?
# 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.
혼자 작업하다보니.. branch 생명주기가 너무 길다.. 작업량도 너무 많이 넣었다. 반성..
Elasticsearch를 사용하는 것이 나을지 MySQL의 Full Text Index를 사용하는 것이 나을지 고민했습니다.
프로젝트 | 텍스트 유사도 검색 어떻게 구현할까?(1) - Elasticsearch를 안 쓴 이유와 MySQL Full Text Index 해당 블로그는 이에 대해 고민한 내용을 정리한 문서입니다.
어떤 방식으로 한글 문장의 유사도를 측정해야할지 고민했고, Cosine Similarity와 TF-IDF를 어떤 방식으로 적용할지 고민했스빈다.
프로젝트 | 텍스트 유사도 검색 어떻게 구현할까?(2) - Cosine Similarity과 TF-IDF 해당 블로그는 이에 대해 고민한 내용을 정리한 문서입니다.
고민했던 내용을 실제로 적용했습니다.
✅ 작업 내용
텍스트 유사도 로직을 질문간의 유사도를 확인하는데 적용했습니다.
질문의 토큰(문장 어구 분리(명사만))을 분리합니다.
해당 토큰으로 MySQL에서 Full Text Index Search를 진행합니다.
가져와진 질문이 없는경우 바로 LLM서버에 질문을 요청합니다.
질문이 있는 경우에는, 해당 질문들과 들어온 질문의 유사도를 검사하고, 0.95를 넘는 경우 가장 유사도가 높은 질문의 대답을 응답합니다.
위의 조건을 만족하는 질문이 없는 경우엔 LLM서버에 질문을 요청합니다.
위의 작업을 위해
MySQL Full Text Search - QueryDSL을 적용했습니다
LLM 서버와의 통신 - WebClient 적용
WebClient를 mocking하여 Test하기 위해 MockServer를 도입했습니다.
QuestionService 각 조건에 따른 Test를 분기하여 작업했습니다.
🤔 고민 했던 부분