Skip to content

[고객지원 챗봇 만들기] 이영수 제출합니다#6

Open
youngsu5582 wants to merge 11 commits into
cho-log:mainfrom
youngsu5582:youngsu5582
Open

[고객지원 챗봇 만들기] 이영수 제출합니다#6
youngsu5582 wants to merge 11 commits into
cho-log:mainfrom
youngsu5582:youngsu5582

Conversation

@youngsu5582
Copy link
Copy Markdown
Contributor

챗봇 구현후 제출합니다!

정확도를 어렵지 않게 개선할 수 있을거라 생각했는데 생각보다 어렵네요..
코드 퀄리티나 객체지향적은 크게 고려하지 않고, 외적인 부분들에 관심이 가서 접근해봤습니다.

  • 토큰 출력량을 실제 $ 로 변환해서 계산
  • 테스트 방법 추가 및 병렬 실행 스크립트

질문

  • 평가의 기준을 LLM 이 LLM 응답을 다시 평가 하게 한 내용이 궁금합니다!

평소에, 아직까지 LLM 은 80% 정도의 퀄리티를 응답해준다고 생각합니다.
80%의 응답을 80%로 평가해주면 60% 의 퀄리티에 기대를 할 거 같은데 제가 RAG 나 더 정교한 방법을 몰라서 그런건지 궁금합니다.

  • 해당 챗봇의 기대

제가 생각한 해당 챗봇에게 기대한 것은 상담원의 업무 완화였습니다.
그러기 위해선, 숫자에 대해선 틀리지 않는 정확한 응답 + 거짓 응답 을 하지 않는걸 생각했습니다.

코치님들이 생각하는 챗봇의 목적이나 기대치가 궁금합니다!


오랜만에 미션 하는거 같아서 재밌었습니다🙇‍♂️

- DTO 및 Controller 선언
- 서비스 로직은 TODO
- 개발 편의성 위한 lombok 추가
- local profile 용 gitignore 추가
- spring ai 통한 기능 구현
- litellm github 기반 비용 JSON 로드해서 사용
- spring ai 표준 기반 처리(캐시 비용 처리X)
- 시스템 프롬프트 + layer1, layer2 데이터 주입
- 진행 결과 progress md 로 정리
- 정확도 다소 상승(Easy 는 일정치 도달)
- SimpleVectorStore 통한 로컬 세팅
- chunk 400 + temperature 0.2 로 설정
- 도메인 숫자 및 정책에 대해 검증하는 스크립트 추가
- 이를 통한 관련 내용 progress.md 에 작성
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a Retrieval-Augmented Generation (RAG) system for a FAQ chatbot, including vector store configuration, pricing calculation logic, and evaluation scripts. Key changes include the addition of VectorStoreConfig for document indexing, FrequentlyQuestionChatApiService for handling RAG-based queries, and a new strict_evaluate.py script for deterministic evaluation using regex patterns. Feedback focuses on several implementation issues: loaded knowledge base resources are currently missing from the system prompt in ChatClientConfig, an unnecessary argument is passed to the prompt() method in the chat service, and excessive logging of document chunks during startup should be reduced. Additionally, the evaluation script's default server URL port should be updated to match the standard application port.

Comment on lines +44 to +46
var faq = concatResources(faqResources, "faq");
var policies = concatResources(policyResources, "policies");
var examples = concatResources(exampleResources, "examples");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

faq, policies, examples 변수들을 통해 지식 베이스 리소스를 로드하고 있지만, 실제 ChatClient 빈을 생성할 때는 사용되지 않고 있습니다. Javadoc(17-22행)에서는 이 내용들을 시스템 프롬프트에 임베드한다고 설명하고 있으나, 현재 코드에서는 systemTemplate만 설정되어 있습니다. 이로 인해 RAG를 사용하지 않는 chat 메서드 등에서 정확한 답변을 제공하기 어려울 수 있습니다. 시스템 프롬프트 템플릿에 해당 변수들을 포함하도록 수정이 필요합니다.

.map(d -> "## " + d.getMetadata().get("source") + "\n" + d.getText())
.collect(Collectors.joining("\n\n---\n\n"));

var response = chatClient.prompt(context)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

chatClient.prompt(context) 호출 시 전달되는 context 인자는 불필요합니다. 바로 다음 라인에서 .user(...)를 통해 사용자 메시지 템플릿을 새로 정의하고 있으며, Spring AI의 ChatClient는 마지막에 설정된 사용자 메시지를 사용하기 때문입니다. prompt()를 인자 없이 호출하여 의도를 명확히 하는 것이 좋습니다.

Suggested change
var response = chatClient.prompt(context)
var response = chatClient.prompt()

Comment on lines +45 to +50
chunks.forEach(chunk -> {
if (chunk.getText() != null) {
log.info("chunk ID: {}, TEXT: {}", chunk.getId(),
chunk.getText().substring(0, Math.min(80, chunk.getText().length())).replace("\n", " "));
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

애플리케이션 시작 시 모든 청크의 내용을 info 레벨 로그로 출력하고 있습니다. 문서량이 많아질 경우 로그 양이 방대해져 시작 속도와 가독성에 영향을 줄 수 있습니다. 확인용 로그라면 debug 레벨로 변경하거나 제거하는 것을 권장합니다.

Comment thread data/strict_evaluate.py
import requests

DATA_DIR = Path(__file__).parent
SERVER_URL = "http://localhost:11240/api/chat"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

서버 URL의 포트 번호가 11240으로 설정되어 있습니다. 프로젝트의 기본 설정인 8080과 일치하지 않아, 다른 환경에서 스크립트를 실행할 때 연결 오류가 발생할 수 있습니다. 범용성을 위해 기본 포트인 8080으로 수정하는 것이 좋습니다.

Suggested change
SERVER_URL = "http://localhost:11240/api/chat"
SERVER_URL = "http://localhost:8080/api/chat"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant