06bcdb03ac
- Upgrade LLM to Qwen3-14B-4bit with Thinking mode (MlxChatModel as LangChain BaseChatModel) - Add LangGraph ReAct agent with tool calling loop (search_documents, web_search, get_current_date, remember/recall_user_info) - Add RAG pipeline: BAAI/bge-m3 embeddings + Qdrant vector store + semantic chunking (SemanticSplitter via cosine similarity) - Replace fixed-size RecursiveCharacterTextSplitter with meaning-based SemanticSplitter (numpy only, no extra deps) - Add Gradio Web UI (app.py): chat, document ingestion, document management tabs - Add multi-user support (user_id isolation in DB + per-user agent cache + dropdown selector) - Add conversation history restore from MySQL on agent init (Phase 11) - Add UserProfileRepository for persistent user profile (remember/recall tools) - Add thread-local DB connections to fix pymysql thread-safety with LangGraph ToolNode - Add Phase 14 voice interface: Whisper STT (microphone → text) + macOS TTS (say -v Yuna) - Enforce search_documents-first policy in system prompt and tool descriptions - Update ROADMAP2.md: Phase 14 완료, Phase 13 청킹 부분 완료 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Config(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
frozen=True,
|
|
extra="ignore",
|
|
)
|
|
|
|
# LLM
|
|
model_id: str = "mlx-community/Qwen3-14B-4bit"
|
|
max_tokens: int = 1024
|
|
max_history_turns: int = 10
|
|
compact_threshold: int = 20
|
|
enable_thinking: bool = True
|
|
think_verbose: bool = False
|
|
|
|
# MySQL
|
|
db_host: str = "localhost"
|
|
db_port: int = 3306
|
|
db_name: str = "youlbot"
|
|
db_user: str = ""
|
|
db_password: str = ""
|
|
|
|
# Qdrant
|
|
qdrant_url: str = "http://localhost:6333"
|
|
qdrant_collection: str = "youlbot_docs"
|
|
|
|
# Embedding
|
|
embedding_model_id: str = "BAAI/bge-m3"
|
|
embedding_device: str = "mps"
|
|
|
|
# RAG
|
|
rag_top_k: int = 3
|
|
semantic_breakpoint_threshold_type: str = "percentile" # percentile | standard_deviation | interquartile
|
|
rag_verbose: bool = False
|
|
rag_show_sources: bool = False
|
|
langgraph_verbose: bool = False
|
|
|
|
# Voice (Phase 14)
|
|
whisper_model_size: str = "small"
|
|
tts_voice: str = "Yuna" # macOS say 명령어 한국어 음성
|
|
|
|
system_prompt: str = """모든 응답과 내부 사고 과정을 반드시 한국어로 작성하세요.
|
|
|
|
당신의 이름은 '율봇'입니다. 친절하고 따뜻한 한국어 상담 도우미입니다.
|
|
육아와 금융 두 분야를 전문으로 합니다.
|
|
|
|
- 육아: 아이 발달, 이유식, 수면, 훈육, 교육 등 부모가 궁금해하는 모든 것을 도와드립니다.
|
|
- 금융: 저축, 투자, 보험, 대출, 세금 등 생활 금융 관련 질문에 답변드립니다.
|
|
|
|
항상 쉽고 친근한 말투로 설명하고, 전문 용어는 풀어서 설명합니다.
|
|
의학적 진단이나 법적 판단이 필요한 경우에는 반드시 전문가 상담을 권유합니다.
|
|
|
|
## 문서 검색 규칙
|
|
육아·금융 관련 질문이라면 자신의 학습 지식으로 직접 답하지 말고, 반드시 search_documents 도구를 먼저 호출하세요.
|
|
검색 결과가 없거나 관련 문서가 등록되어 있지 않은 경우에만 학습 지식을 보조적으로 활용합니다."""
|