Fix age calculation: inject today's date, add Korean/international age
- Prepend today's date to system prompt on every call so LLM uses correct year - Calculate both Korean age (현재연도-출생연도+1) and 만 나이 with exact birthday handling - Support full date (생년월일) and year-only (생년) profile values - Update remember_user_info to encourage storing full birth date - Strengthen get_current_date tool description for age-related queries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ from langchain_core.tools import tool
|
||||
|
||||
@tool
|
||||
def get_current_date() -> str:
|
||||
"""오늘 날짜를 반환합니다. 날짜·기간 관련 질문에 사용하세요."""
|
||||
"""오늘 날짜를 반환합니다. 나이 계산, 날짜 비교 등 현재 날짜가 필요할 때 반드시 먼저 호출하세요."""
|
||||
return date.today().isoformat()
|
||||
|
||||
|
||||
@@ -48,8 +48,9 @@ def make_memory_tools(profile_repo, user_id: str = "default"):
|
||||
@tool
|
||||
def remember_user_info(key: str, value: str) -> str:
|
||||
"""사용자 정보를 영구 저장합니다. 다음 대화에도 기억해야 할 정보를 저장하세요.
|
||||
- 아이 나이는 반드시 '생년(출생연도)'으로 저장하세요. 나이는 매년 바뀌지만 생년은 영구적입니다.
|
||||
예: key='첫째_이름' value='신도율', key='첫째_생년' value='2020'
|
||||
- 아이 생년월일은 전체 날짜로 저장하세요. 날짜를 모르면 연도만이라도 저장하세요.
|
||||
예: key='첫째_이름' value='신도율', key='첫째_생년월일' value='2020년 6월 19일'
|
||||
연도만 알 경우: key='첫째_생년' value='2020'
|
||||
- 기타 key 예시: 재정_목표, 거주지, 직업, 자녀수"""
|
||||
profile_repo.remember(key, value, user_id=user_id)
|
||||
return f"'{key}' 정보를 기억했습니다: {value}"
|
||||
|
||||
Reference in New Issue
Block a user