Skip to content

Commit

Permalink
Construct system message with try excepts
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Nov 15, 2024
1 parent 8514f0d commit 69c6302
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions interpreter_1/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,31 @@ def from_profile(cls, path):
return cls(Profile.from_file(path))

def default_system_message(self):
system_message = f"""<SYSTEM_CAPABILITY>
* You are an AI assistant with access to a machine running on {"Mac OS" if platform.system() == "Darwin" else platform.system()} with internet access.
* The current date is {datetime.today().strftime('%A, %B %d, %Y')}.
* The user's cwd is {os.getcwd()} and username is {os.getlogin()}.
</SYSTEM_CAPABILITY>"""
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"
except:
print("Error adding system capability for platform")

try:
system_message += (
f"* The current date is {datetime.today().strftime('%A, %B %d, %Y')}.\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"
except:
print("Error adding system capability for cwd")

system_message += "</SYSTEM_CAPABILITY>"

# Add web search capability if enabled
if (
Expand Down

0 comments on commit 69c6302

Please sign in to comment.