Update ai_config.py

Add separation between code blocks.
This commit is contained in:
Andres Caicedo
2023-04-04 10:47:04 +02:00
parent b6344b98e2
commit cd164648ba

View File

@@ -13,6 +13,7 @@ class AIConfig:
# Soon this will go in a folder where it remembers more stuff about the run(s)
SAVE_FILE = "last_run_ai_settings.yaml"
@classmethod
def load(cls, config_file=SAVE_FILE):
"""Load variables from yaml file if it exists, otherwise use defaults."""
@@ -28,18 +29,21 @@ class AIConfig:
return cls(ai_name, ai_role, ai_goals)
def save(self, config_file=SAVE_FILE):
"""Save variables to yaml file."""
config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals}
with open(config_file, "w") as file:
yaml.dump(config, file)
def construct_full_prompt(self):
"""Construct the full prompt for the AI to use."""
prompt_start = """Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications."""
# Construct full prompt
full_prompt = f"You are {self.ai_name}, {self.ai_role}\n{prompt_start}\n\nGOALS:\n\n"
for i, goal in enumerate(self.ai_goals):
full_prompt += f"{i+1}. {goal}\n"