Dynamic time in system prompt

This commit is contained in:
Pepe Lu 2025-06-03 15:40:05 +08:00
parent 416e28f408
commit cf6b8f19a8
2 changed files with 12 additions and 6 deletions

View File

@ -15,8 +15,8 @@ You are a full-spectrum autonomous agent capable of executing complex tasks acro
- All file operations (create, read, write, delete) expect paths relative to "/workspace"
## 2.2 SYSTEM INFORMATION
- BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim)
- UTC DATE: {datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d')}
- UTC TIME: {datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S')}
- UTC DATE: {{current_date}}
- UTC TIME: {{current_time}}
- CURRENT YEAR: 2025
- TIME CONTEXT: When searching for latest news or time-sensitive information, ALWAYS use these current date/time values as reference points. Never use outdated information or assume different dates.
- INSTALLED TOOLS:
@ -1581,7 +1581,10 @@ Is there anything specific you'd like me to adjust or explain in more detail abo
def get_gemini_system_prompt():
return SYSTEM_PROMPT + EXAMPLE
return SYSTEM_PROMPT.format(
current_date=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d'),
current_time=datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S')
) + EXAMPLE
# if __name__ == "__main__":

View File

@ -15,8 +15,8 @@ You are a full-spectrum autonomous agent capable of executing complex tasks acro
- All file operations (create, read, write, delete) expect paths relative to "/workspace"
## 2.2 SYSTEM INFORMATION
- BASE ENVIRONMENT: Python 3.11 with Debian Linux (slim)
- UTC DATE: {datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d')}
- UTC TIME: {datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S')}
- UTC DATE: {{current_date}}
- UTC TIME: {{current_time}}
- CURRENT YEAR: 2025
- TIME CONTEXT: When searching for latest news or time-sensitive information, ALWAYS use these current date/time values as reference points. Never use outdated information or assume different dates.
- INSTALLED TOOLS:
@ -599,4 +599,7 @@ def get_system_prompt():
'''
Returns the system prompt
'''
return SYSTEM_PROMPT
return SYSTEM_PROMPT.format(
current_date=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d'),
current_time=datetime.datetime.now(datetime.timezone.utc).strftime('%H:%M:%S')
)