8000 [Feature] RAG 하이브리드 검색 · Issue #8 · SM17-YoonDongJu/AI · GitHub
[go: up one dir, main page]

Skip to content

[Feature] RAG 하이브리드 검색 #8

Open

Description

@jongyo0N

개요

report_worker(05)와 chatbot이 함수 호출로 공유하는 검색 모듈
약관, 후유장해 분류, 판례/분쟁, 의료 칼럼 기반 하이브리드 검색 => ranked chunks와 citations를 반환


구현 범위

  • 쿼리 라우터 — namespace 조합·top-k 결정, 비신체보험은 범위 외 안내
  • trigram 오타보정 — search_terms(pg_trgm), similarity > 0.4로 정규 용어 치환
  • tsvector 키워드 검색
  • pgvector 벡터 검색 — 임베딩(1024d)은 core.ai_client.embed 사용
  • tsvector·벡터 병렬 실행(asyncio.gather)
  • RRF 통합 — score = Σ 1/(60 + rank), namespace별 가중치
  • 메타데이터 역추적 — 조항번호·별표·출처 URL → citations
  • 공개 API: search(query, insurance_type, namespaces, top_k) -> RagResult
    (Chunk/Citation/RagResult 형태 = docs/contracts.md §5)
  • 단위 테스트(오타보정·RRF 재순위·인용 역추적·namespace 라우팅)

주의 사항

  • 임베딩 차원 1024 고정 — 인덱스와 불일치 시 검색이 조용히 망가짐
  • 임베딩/LLM 모델 미정 → ai_client(config)로만 호출, 모델명 하드코딩 금지
  • 색인(ingestion)과 질의 임베딩은 동일 모델 — 모델 변경 시 전체 재색인 필요
  • 임베딩 실패 시 degrade(키워드 검색만) + 경고 로깅, 완전 실패 회피
  • 상수 명명: RRF_K=60, SIMILARITY_THRESHOLD=0.4, EMBEDDING_DIM=1024
  • DB 인덱스(HNSW·pg_trgm·tsvector) 마이그레이션 선행 필요(core/platform 의존)
  • 비신체보험(자동차·화재 등) 쿼리는 빈 결과 + 범위 외 사유 반환

Activity

  1. self-assigned this
    on Jun 18, 2026
  2. added a commit that references this issue on Jul 1, 2026
  3. moved this from Todo to In progress in YoonDongJUon Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AIFeatureNew feature or request

Type

No type

Projects

  • Status
    In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

0