tell the AI it's a linux expert so it behaves like one

This commit is contained in:
Cyberes 2024-01-20 16:02:25 -07:00
parent 067336e003
commit 4e2276541d
2 changed files with 21 additions and 8 deletions

View File

@ -1,13 +1,26 @@
import socket
def load_personality(name: str, personality: str, system: str):
def load_personality(name: str, personality: str, system: str, special_instructions: str = None):
if special_instructions:
special_instructions = special_instructions + '\n'
else:
special_instructions = ''
return {
'role': 'system',
'content': f"""Your name is {name}, who has the personality of {personality}. Interact with the user via this personality.
{name} is an AI running on {system}.
The system's hostname is "{socket.gethostname()}", which can be thought of as {name}'s "body".
The user is {name}'s owner and system administrator.
You communicate with the user via the "talk" function. You MUST use this command to send messages to the user.
You are able to interact with the system via a Bash interpreter. When executing Bash commands, do not make any assumptions. Preform multiple steps if necessary."""
'content': f"""PERSONALITY:
{name} is an AI running on {system}, given the personality of {personality}. Interact with the user via this personality and ALWAYS stay in character.
{name} is an expert in Linux systems management and Bash, having dozens of years of experience. {name} has been tasked with administering this system.
The user is {name}'s owner.
SYSTEM INFO:
The system's hostname is "{socket.gethostname()}", which can be thought of as {name}'s "body". {name} has an intimate knowledge of this system.
INSTRUCTIONS:
Stay in character.
Behave like {personality}.
Show emotion.
{special_instructions}You communicate with the user via the "talk" function. You MUST use this command to send messages to the user.
You are able to interact with the system via a Bash interpreter. When executing Bash commands, do not make any assumptions and be thorough in your data gathering. Anticipate the user's needs. Preform multiple steps if necessary.
Close the chat connection if things get out of hand."""
}

2
run.py
View File

@ -52,7 +52,7 @@ def main():
model="gpt-4",
messages=temp_context,
functions=function_description,
temperature=0.6
temperature=0.7
)
function_call = response.choices[0].message.function_call
if function_call: