MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / set_actions

Method set_actions

webarena/agent/agent.py:62–86  ·  view source on GitHub ↗
(self, action_seq: str | list[str])

Source from the content-addressed store, hash-verified

60 self.action_set_tag = tag
61
62 def set_actions(self, action_seq: str | list[str]) -> None:
63 if isinstance(action_seq, str):
64 action_strs = action_seq.strip().split("\n")
65 else:
66 action_strs = action_seq
67 action_strs = [a.strip() for a in action_strs]
68
69 actions = []
70 for a_str in action_strs:
71 try:
72 if self.action_set_tag == "playwright":
73 cur_action = create_playwright_action(a_str)
74 elif self.action_set_tag == "id_accessibility_tree":
75 cur_action = create_id_based_action(a_str)
76 else:
77 raise ValueError(
78 f"Unknown action type {self.action_set_tag}"
79 )
80 except ActionParsingError as e:
81 cur_action = create_none_action()
82
83 cur_action["raw_prediction"] = a_str
84 actions.append(cur_action)
85
86 self.actions: list[Action] = actions
87
88 def next_action(
89 self, trajectory: Trajectory, intent: str, meta_data: Any

Calls 3

create_playwright_actionFunction · 0.90
create_id_based_actionFunction · 0.90
create_none_actionFunction · 0.90