Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions agents/recode/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,20 @@ def reset(self, running_config: dict, init_info: dict=None) -> None:

def _load_resources(self):
resources_path = Path("agents/recode/resources/prompts") / self.env_name
self.available_actions = open(resources_path / "actions.txt", "r").read()
with open(resources_path / "actions.txt", "r") as f:
self.available_actions = f.read()

fewshots_path = Path("agents/recode/resources/fewshots") / self.env_name
if self.env_name == "alfworld":
self.fewshots = open(fewshots_path / f"{self.task_type}.txt", "r").read()
with open(fewshots_path / f"{self.task_type}.txt", "r") as f:
self.fewshots = f.read()
elif self.env_name == "webshop":
self.fewshots = open(fewshots_path / "base.txt", "r").read()
with open(fewshots_path / "base.txt", "r") as f:
self.fewshots = f.read()
# self.fewshots = "(No Examples)"
elif self.env_name == "sciworld":
self.fewshots = open(fewshots_path / "base.txt", "r").read()
with open(fewshots_path / "base.txt", "r") as f:
self.fewshots = f.read()
else:
raise ValueError(f"Unsupported environment in _load_resources: {self.env_name}")

Expand Down