Skip to content

feat(backend): integrate pinecone-based RAG pipeline#41

Merged
youneedpython merged 1 commit into
devfrom
feat/backend-rag-pinecone
Jan 16, 2026
Merged

feat(backend): integrate pinecone-based RAG pipeline#41
youneedpython merged 1 commit into
devfrom
feat/backend-rag-pinecone

Conversation

@youneedpython
Copy link
Copy Markdown
Owner

✨ 변경 사항 요약

본 PR에서는 백엔드 챗 API에 Pinecone 기반의
Retrieval-Augmented Generation(RAG) 파이프라인을 통합했습니다.

기존의 LLM 단독 응답 구조에서 벗어나,
사용자 질문에 대해 Pinecone VectorDB에 저장된 법률 문서 조각을 검색한 뒤
해당 문서를 근거로 답변을 생성하도록 개선했습니다.


🧠 주요 변경 내용

  • Pinecone VectorDB를 사용하는 Retriever 서비스 추가
  • 다음 요소를 결합한 RAG 체인 구현
    • DB에 저장된 대화 히스토리
    • Pinecone에서 검색된 관련 문서 컨텍스트
    • LLM 기반 답변 생성
  • 체인은 stateless 구조를 유지하여 캐싱 및 확장성 고려
  • RAG 관련 설정을 app/core/config.py에서 일원화하여 환경별 관리 가능하도록 구성

🏗️ 아키텍처 설계 포인트

  • 기존 문서 인덱싱 파이프라인(scripts/indexing)은 변경 없음
  • 대화 히스토리는 기존과 동일하게 DB를 단일 진실의 원천으로 사용
  • Retrieval은 요청 시점의 사용자 질문을 기준으로 수행
  • dev / prod 환경 분리를 고려한 구조로 설계

🚀 dev 환경 검증 방법

  1. dev Elastic Beanstalk 환경에 배포
  2. 전세사기·임대차 관련 질문으로 chat API 호출
  3. CloudWatch 로그에서 다음 메시지 확인
    • Retrieved N documents from Pinecone
  4. 문서 기반 설명이 반영된 응답 생성 여부 확인

🔮 후속 작업 (본 PR 범위 외)

  • API 응답에 검색된 문서 출처(sources) 노출
  • 후속 질문에 대한 Retrieval 품질 개선(질문 재작성 등)
  • RAG 파라미터(top_k, 컨텍스트 길이) 튜닝

@youneedpython youneedpython self-assigned this Jan 16, 2026
@youneedpython youneedpython merged commit 964bacb into dev Jan 16, 2026
3 checks passed
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