[Feat] RAG 프롬프트 조립 PromptBuilder + Ollama 로컬 세팅 - #66
Conversation
RAG 답변 생성에 쓸 로컬 LLM(qwen2.5:3b)을 Ollama로 구동하기 위해 docker-compose에 서비스를 등록하고 application.yml에 접속 주소 기본값을 추가한다.
검색 후보(VectorSearchCandidate) 목록과 질문 텍스트를 받아, 출처 라벨([1], [2]...)과 환각 방지 지시문이 포함된 LLM 프롬프트 문자열을 조립한다. search_results/document_chunks 재조회 없이 SearchFacade가 이미 만든 후보 목록을 그대로 재사용한다.
정상 케이스(라벨 순서/문서정보 포함), 페이지 번호 없는 경우, 지시문/질문 항상 포함 3개 케이스를 검증한다.
로컬 DB 실행 방법만 있던 README에 embedding-server, ollama 서비스의 build/run 순서와 헬스체크 확인법을 추가한다.
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough로컬 Ollama 서비스와 접속 설정이 추가되고, 검색 후보를 출처 라벨이 포함된 RAG 프롬프트로 변환하는 ChangesRAG 로컬 실행과 프롬프트 조립
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/main/java/com/opensource/docgrid/domain/rag/service/PromptBuilder.java (1)
24-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win순차 처리 단계에 번호 주석을 보강하세요.
이 메서드는 지시문 초기화 → 후보 인용 조립 → 질문 추가의 순차 흐름이므로 각 단계에 간결한
1.,2.,3.주석을 추가해 구현 의도를 유지하세요.As per path instructions, Java 순차 실행 흐름에는 관련 단계 번호 주석을 추가해야 합니다.
🤖 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 `@src/main/java/com/opensource/docgrid/domain/rag/service/PromptBuilder.java` around lines 24 - 31, In PromptBuilder.build, add concise sequential comments marking the three execution stages: 1. instruction initialization, 2. candidate citation assembly, and 3. query appending. Keep the existing logic and ordering unchanged.Source: Path instructions
🤖 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 `@docker-compose.yml`:
- Around line 67-68: Update the Ollama port mapping in the compose configuration
to bind host port 11434 exclusively to the loopback interface, using the
existing ports entry. Preserve container port 11434 while changing the host
binding to 127.0.0.1; do not expose it on all host interfaces.
In `@docs/design/kangcheolung-`#65-rag-prompt-builder.md:
- Line 34: 문서의 두 fenced code block에 언어 식별자가 없어 MD040 경고가 발생합니다. 해당 Markdown 코드
블록을 모두 언어 식별자 text를 사용하는 fenced block으로 변경해 문서 lint를 통과시키세요.
- Around line 245-249: Revise the “원인 분석” and “판단 및 대응 방향” sections to avoid
concluding from a single greeting that the behavior is an inherent qwen2.5:3b
characteristic. Explicitly state the uncertainty and possible causes, including
language instructions, generation settings, and model behavior, then defer the
conclusion until reproduction with an actual Korean RAG prompt; retain the
existing milestone assessment without asserting an unverified root cause.
---
Nitpick comments:
In `@src/main/java/com/opensource/docgrid/domain/rag/service/PromptBuilder.java`:
- Around line 24-31: In PromptBuilder.build, add concise sequential comments
marking the three execution stages: 1. instruction initialization, 2. candidate
citation assembly, and 3. query appending. Keep the existing logic and ordering
unchanged.
🪄 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: ebb204f4-bd53-49b3-8dec-ab21bb054b07
📒 Files selected for processing (7)
.env.exampleREADME.mddocker-compose.ymldocs/design/kangcheolung-#65-rag-prompt-builder.mdsrc/main/java/com/opensource/docgrid/domain/rag/service/PromptBuilder.javasrc/main/resources/application.ymlsrc/test/java/com/opensource/docgrid/domain/rag/service/PromptBuilderTest.java
- Ollama HTTP API가 인증 없는 로컬 개발용 엔드포인트라 127.0.0.1로만 바인딩하도록 수정 - 설계 문서 흐름도 코드 블록에 언어 식별자(text) 추가 (MD040 lint 대응) - 언어 섞임 현상 원인 분석 문구를 단정적 결론에서 미확정/재검증 필요로 수정
🔍️작업 내용
✨ 상세 설명
RAG 블록 Issue 1(F-RAG-01) 구현입니다.
VectorSearchCandidate) 목록을 출처 라벨([1], [2]...) 포함 프롬프트로 조립하는PromptBuilder구현search_results/document_chunks재조회 없이SearchFacade가 만든 후보 리스트를 그대로 재사용설계 배경과 로컬 검증 로그는
docs/design/kangcheolung-#65-rag-prompt-builder.md참고해주세요.🛠️추후 리팩토링 및 고도화 계획
📸 스크린샷 (선택)
💬 리뷰 요구사항
Summary by CodeRabbit
새 기능
문서 및 설정
테스트