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
+1
View File
@@ -140,6 +140,7 @@ class Container(containers.DeclarativeContainer):
rag_show_sources=providers.Callable(lambda c: c.rag_show_sources, config),
langgraph_verbose=providers.Callable(lambda c: c.langgraph_verbose, config),
think_verbose=providers.Callable(lambda c: c.think_verbose, config),
query_rewrite_enabled=providers.Callable(lambda c: c.query_rewrite_enabled, config),
user_profile_repository=user_profile_repository,
conversation_repository=conversation_repository,
)