Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
samholt committed Apr 20, 2024
1 parent 2cd6576 commit e0e7e57
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion examples/generate_codebase_playable_snake.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from l2mac import generate_codebase

codebase: dict = generate_codebase("Create a beautiful playable python snake game with pygame")
codebase: dict = generate_codebase(
"Create a beautiful playable python snake game with pygame. Make the snake move a step size of 10 each key press, and generate the food on this same step size grid too.",
steps=2,
)

print(codebase) # it will print the codebase (repo) complete with all the files as a dictionary
4 changes: 2 additions & 2 deletions l2mac/l2mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def reset(self):
self.message_hash = hash_messages([])

self.log_folder_path = f"{self.config.setup.log_path.split('.txt')[0]}_{self.env.env_name}_{self.env.seed}/"
self.folder_path = f"workspace/{self.project_name}_{self.config.setup.log_path.split('_')[0].split('/')[1]}/"
self.folder_path = f"workspace/{self.project_name + '_' if self.project_name else ''}{self.config.setup.log_path.split('_')[0].split('/')[1]}/"
Path(self.folder_path).mkdir(parents=True, exist_ok=True)
Path(self.log_folder_path).mkdir(parents=True, exist_ok=True)
write_files_from_dict(self.file_dict, base_dir=f"{self.folder_path}")
Expand Down Expand Up @@ -212,7 +212,7 @@ def get_function_names_as_str(self):

def get_file_names(self):
# Simple implementation, for now, can be improved.
return self.get_file_names()
return list(self.file_dict.keys())

def run(self, steps: int = 10):
return self._run(steps=steps)
Expand Down
6 changes: 6 additions & 0 deletions l2mac/prompts/load_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class L2MACPrompts(BaseModel):
system: str
first_message: str
reflect_on_prompt_program: str
test_writing_advice: str
control_unit_execute_instruction: str
control_unit_exhaust_context_window: str
control_unit_instruction_complete_summarize_output: str
control_unit_instruction_erroring_fix_the_code: str
control_unit_cycle_message_to_check_if_instruction_complete: str


def get_l2mac_prompts(prompts_file_path: Optional[str], domain: Domain) -> L2MACPrompts:
Expand Down

0 comments on commit e0e7e57

Please sign in to comment.