Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify CWD and timestamp to AI #1607

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,34 @@ def default_system_message(self):
system_message = "<SYSTEM_CAPABILITY>\n"

try:
system_message += f"* You are an AI assistant with access to a machine running on {'Mac OS' if platform.system() == 'Darwin' else platform.system()} with internet access.\n"
system_message += (
"* You are an AI assistant with access to a machine running on "
f"{'Mac OS' if platform.system() == 'Darwin' else platform.system()} with internet access.\n"
)
except:
print("Error adding system capability for platform")

try:
# This is updated for each message
system_message += (
f"* The current date is {datetime.today().strftime('%A, %B %d, %Y')}.\n"
f"* The current time is {datetime.today().strftime('%A, %B %d, %Y at %I:%M:%S %p')}.\n"
)
except:
print("Error adding system capability for date")

try:
cwd_line = f"* The user's cwd is {os.getcwd()}"
try:
cwd_line += f" and username is {os.getlogin()}"
except:
print("Error adding system capability for username")
system_message += cwd_line + "\n"
# This is not updated as the chat progresses, and does not necessarily match CWD within tools.
system_message += (
f'* Launched from "{os.getcwd()}" (but tool environments may have their own cwd).\n'
)
except:
print("Error adding system capability for cwd")

try:
system_message += f'* The username is "{os.getlogin()}".\n'
except:
print("Error adding system capability for username")

system_message += "</SYSTEM_CAPABILITY>"

# Add web search capability if enabled
Expand Down
Loading