Skip to content

Commit 851f3d4

Browse files
authored
Added html parametrization for miniwob
1 parent 29ba313 commit 851f3d4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/agentlab/agents/debug_agent.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,25 @@ def __post_init__(self):
2323
self.action_set_args = bgym.DEFAULT_BENCHMARKS[
2424
"miniwob_tiny_test"
2525
]().high_level_action_set_args
26+
self.use_html = False
2627

2728
def set_benchmark(self, benchmark: bgym.Benchmark, demo_mode):
29+
if benchmark.name.startswith("miniwob"):
30+
self.use_html = True
2831
self.action_set_args = benchmark.high_level_action_set_args
2932

3033
def make_agent(self):
31-
return DebugAgent(self.action_set_args)
34+
return DebugAgent(self.action_set_args, use_html=self.use_html)
3235

3336

3437
class DebugAgent(Agent):
3538
def __init__(
3639
self,
3740
action_set_args,
41+
use_html=False,
3842
):
3943
self.action_set = action_set_args.make_action_set()
44+
self.use_html = use_html
4045

4146
def obs_preprocessor(self, obs):
4247
obs = deepcopy(obs)
@@ -72,7 +77,8 @@ def get_action(self, obs):
7277

7378
# print(obs["pruned_html"])
7479
print("\n")
75-
action = input(obs["axtree_txt"] + "\n")
80+
observation = obs["pruned_html"] if self.use_html else obs["axtree_txt"]
81+
action = input(observation + "\n")
7682
agent_info = AgentInfo(
7783
think="nope",
7884
chat_messages=[],

0 commit comments

Comments
 (0)