Skip to content

feat(backend): enrich RAG sources with legal citations and chunk identifiers#47

Merged
youneedpython merged 1 commit into
devfrom
feat/backend-rag-source-structure
Jan 23, 2026
Merged

feat(backend): enrich RAG sources with legal citations and chunk identifiers#47
youneedpython merged 1 commit into
devfrom
feat/backend-rag-source-structure

Conversation

@youneedpython
Copy link
Copy Markdown
Owner

📌 개요

Pinecone 기반 RAG 파이프라인에서 LLM 응답의 출처(sources)를
파일명 중심 구조에서 법령·조항 기반 구조로 확장하여,
Frontend에서 신뢰도 높은 출처 UI를 구현할 수 있도록 개선합니다.


🔧 주요 변경 사항

  • RAG 검색 결과의 sources 구조 고도화
    • citation (법령명 · 조항 표기)
    • law_title, law_short
    • article_no, article_title, clause_no, item_no
    • chunk_id (source + doc_sha + chunk_index 기반 재구성)
    • snippet (출처 요약용 텍스트)
  • 동일 법령/조항 기준으로 sources 중복 제거(deduplication)
  • 기존 LLM context 형식([1], [2] 인용 표기) 유지

🎯 변경 목적

  • RAG 응답의 근거를 사용자가 이해 가능한 법령·조항 단위로 제공
  • 답변 본문 인용 번호와 출처 정보 간 연결성 강화
  • Frontend 출처 패널 및 citation UI 구현을 위한 데이터 구조 완성

🔍 검증 결과

  • 로컬 환경에서 RAG 응답 정상 동작 확인
  • Network 응답에서 sources 필드에 법령 메타데이터 정상 포함
  • chunk_id 값이 빈 문자열이 아닌 정상 값으로 생성됨
  • 기존 기능에 대한 breaking change 없음

📝 비고

  • 변경 범위는 backend chain_builder 레이어로 한정됨
  • retriever, embedding, LLM 설정에는 영향 없음

@youneedpython youneedpython self-assigned this Jan 23, 2026
@youneedpython youneedpython merged commit 8d9ddd2 into dev Jan 23, 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