IDEA-8: GraphRAG — NetworkX 기반 지식 그래프

- td_knowledge_graph 테이블 (user_id, subject, relation, object 트리플)
- GraphService: MultiDiGraph 인메모리 캐시 + MySQL 영속화
- add_relation / query_entity LangChain 도구
- call_model에 그래프 요약 자동 주입 (시스템 프롬프트)
- GRAPH_ENABLED=true 환경변수로 활성화
- requirements.txt에 networkx>=3.0 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sal
2026-06-04 10:08:39 +09:00
parent 0b50444e43
commit a05d2f474e
10 changed files with 170 additions and 6 deletions
+3
View File
@@ -64,6 +64,9 @@ class Config(BaseSettings):
vision_model_id: str = "mlx-community/Qwen2.5-VL-7B-Instruct-4bit"
vision_max_tokens: int = 512
# 지식 그래프 (IDEA-8) — GraphRAG
graph_enabled: bool = False
# CRAG — 검색 결과 없을 때 web_search 자동 fallback (IDEA-5)
crag_enabled: bool = False