mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Update ai_config.py
Add separation between code blocks.
This commit is contained in:
@@ -13,6 +13,7 @@ class AIConfig:
|
|||||||
# Soon this will go in a folder where it remembers more stuff about the run(s)
|
# Soon this will go in a folder where it remembers more stuff about the run(s)
|
||||||
SAVE_FILE = "last_run_ai_settings.yaml"
|
SAVE_FILE = "last_run_ai_settings.yaml"
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, config_file=SAVE_FILE):
|
def load(cls, config_file=SAVE_FILE):
|
||||||
"""Load variables from yaml file if it exists, otherwise use defaults."""
|
"""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)
|
return cls(ai_name, ai_role, ai_goals)
|
||||||
|
|
||||||
|
|
||||||
def save(self, config_file=SAVE_FILE):
|
def save(self, config_file=SAVE_FILE):
|
||||||
"""Save variables to yaml file."""
|
"""Save variables to yaml file."""
|
||||||
config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals}
|
config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals}
|
||||||
with open(config_file, "w") as file:
|
with open(config_file, "w") as file:
|
||||||
yaml.dump(config, file)
|
yaml.dump(config, file)
|
||||||
|
|
||||||
|
|
||||||
def construct_full_prompt(self):
|
def construct_full_prompt(self):
|
||||||
"""Construct the full prompt for the AI to use."""
|
"""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."""
|
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
|
# Construct full prompt
|
||||||
full_prompt = f"You are {self.ai_name}, {self.ai_role}\n{prompt_start}\n\nGOALS:\n\n"
|
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):
|
for i, goal in enumerate(self.ai_goals):
|
||||||
full_prompt += f"{i+1}. {goal}\n"
|
full_prompt += f"{i+1}. {goal}\n"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user