Implement Phase 19: Query Rewriting via LangGraph node

- query_rewrite 노드 추가 (agent → query_rewrite → tools 순서)
- route_after_agent: search_documents 호출 시에만 query_rewrite 라우팅, 그 외 직접 tools
  - tools_condition(prebuilt) 제거 → 커스텀 라우팅 함수로 대체
- query_rewrite_node: 구어체 쿼리를 키워드 중심 문장으로 변환
  - 이전 대화 2턴 컨텍스트로 대명사·지시어 해소
  - enable_thinking=False 바인딩으로 불필요한 사고 과정 제거
  - __query_rewrite 커스텀 이벤트 emit → RAG_VERBOSE 시 변환 결과 출력
- QUERY_REWRITE_ENABLED=true 로 활성화 (기본값 false)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sal
2026-05-29 17:55:13 +09:00
parent 86370f6c1e
commit e4c56a9b6c
5 changed files with 97 additions and 14 deletions
+3
View File
@@ -45,6 +45,9 @@ class Config(BaseSettings):
# Hybrid Search (Phase 18) — BM25 + Vector
hybrid_search_enabled: bool = False
sparse_model_id: str = "Qdrant/bm25" # fastembed sparse 모델 (언어 무관 BM25)
# Query Rewriting (Phase 19) — 구어체 질문을 검색 최적화 쿼리로 변환
query_rewrite_enabled: bool = False
rag_verbose: bool = False
rag_show_sources: bool = False
langgraph_verbose: bool = False