Add extra documentation

This commit is contained in:
Andres Caicedo
2023-04-03 14:10:02 +02:00
parent 8e2074f483
commit 765210f0cd
7 changed files with 18 additions and 3 deletions

View File

@@ -3,7 +3,9 @@ import data
class AIConfig:
"""Class to store the AI's name, role, and goals."""
def __init__(self, ai_name="", ai_role="", ai_goals=[]):
"""Initialize the AIConfig class"""
self.ai_name = ai_name
self.ai_role = ai_role
self.ai_goals = ai_goals
@@ -13,7 +15,7 @@ class AIConfig:
@classmethod
def load(cls, config_file=SAVE_FILE):
# Load variables from yaml file if it exists
"""Load variables from yaml file if it exists, otherwise use defaults."""
try:
with open(config_file) as file:
config_params = yaml.load(file, Loader=yaml.FullLoader)
@@ -27,11 +29,13 @@ 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