Skip to content

Feat/vector store backends#212

Merged
seyoung4503 merged 12 commits intomasterfrom
feat/vector-store-backends
Feb 28, 2026
Merged

Feat/vector store backends#212
seyoung4503 merged 12 commits intomasterfrom
feat/vector-store-backends

Conversation

@seyoung4503
Copy link
Collaborator

#️⃣ Issue Number

  • TBD

📝 요약(Summary)

  • VectorRetriever, FAISSVectorStore, PGVectorStore를 추가하여 벡터 기반 스키마 검색 백엔드를
    구현한다.
  • BM25 기반 KeywordRetriever와 벡터 검색을 Reciprocal Rank Fusion(RRF)으로 결합하는 HybridRetriever
    HybridNL2SQL 플로우를 추가한다.
  • PDFLoader, RecursiveCharacterChunker, SemanticChunker 등 Document Indexing Pipeline을 구축하고,
    IndexBuilder를 제거하며 from_chunks() API로 단순화한다.

💬 To Reviewers (선택)

  • RRF 병합 로직 (hybrid.py): 1/(k + rank) 공식으로 BM25/Vector 결과를 병합합니다. k=60
    기본값이 이 도메인에서도 적절한지 의견 부탁드립니다.
  • FAISSVectorStore append-only 제한 (faiss_.py): 동일 chunk_id를 두 번 upsert하면 중복 엔트리가
    생깁니다. 현재는 인스턴스를 재생성하여 재인덱싱하는 방식인데, 별도 삭제 인터페이스가 필요한지 검토
    부탁드립니다.
  • Port Protocol 명시적 상속 (ports.py): LLMPort(Protocol) 형태로 모든 Port가 Protocol
    명시적으로 상속하도록 변경했습니다. 기존 런타임 동작에는 영향이 없으나 타입 검사 일관성을 위한
    변경입니다.

PR Checklist

  • 변경 사항에 대한 테스트 작성 (FAISSVectorStore 8개, PGVectorStore 6개, VectorRetriever 16개,
    HybridRetriever 포함)
  • 기존 테스트 전체 통과 확인 (pytest tests/)
  • 공개 API __init__.py 업데이트 (FAISSVectorStore, PGVectorStore, HybridRetriever,
    HybridNL2SQL export)
  • 문서 업데이트 (docs/tutorials/, docs/vectorstore/)

reference) How to Code Review

  • 따봉(👍): 리뷰어가 리뷰이의 코드에서 칭찬의 의견을 남기고 싶을 때 사용합니다.
  • 느낌표(❗): 리뷰어가 리뷰이에게 필수적으로 코드 수정을 요청할 때 사용합니다.
  • 물음표 (❓): 리뷰어가 리뷰이에게 의견을 물어보고 싶을 때 사용합니다.
  • 알약 (💊): 리뷰어가 리뷰이의 코드에서 개선된 방법을 제안하지만 그것의 반영이 필수까지는 아닐 때 사용합니다.

  IndexFlatIP + L2 normalization for cosine similarity.
  Lazy index init on first upsert(). save/load via .faiss + .meta files.
  True upsert via ON CONFLICT DO UPDATE. Automatic table creation
  on first upsert(). Cosine similarity via pgvector <=> operator.
  Covers upsert/search, cosine score, save/load roundtrip,
  and error cases. Auto-skipped if faiss-cpu is not installed.
  Covers upsert/search, idempotent upsert, score range, and
  auto table creation. Skipped if TEST_POSTGRES_URL is not set.
…ir Protocol

  All integration and component classes now declare their Port contract
  via explicit inheritance instead of relying on structural subtyping alone.

  - AnthropicLLM, OpenAILLM → LLMPort
  - SQLAlchemyDB → DBPort
  - OpenAIEmbedding → EmbeddingPort
  - InMemoryVectorStore, FAISSVectorStore, PGVectorStore → VectorStorePort
  - MarkdownLoader, PlainTextLoader, PDFLoader → DocumentLoaderPort
  - SemanticChunker → DocumentChunkerPort
…ations

  - NullHook, MemoryHook → TraceHook
  - RecursiveCharacterChunker → DocumentChunkerPort
  - pgvector_: return early in upsert() when vectors list is empty
  - chunker: return early in _split() when separators list is empty
  - directory_: catch per-file load errors with warnings.warn
    so one bad file does not abort the entire directory load
  Hard-coded 1024 could truncate long SQL responses.
  Default raised to 4096; users can override per instance.
@seyoung4503 seyoung4503 merged commit 6412aa9 into master Feb 28, 2026
2 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