Skip to content

Commit

Permalink
big changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alckasoc committed Jan 27, 2025
1 parent 7564262 commit 03dc444
Show file tree
Hide file tree
Showing 4 changed files with 428 additions and 106 deletions.
12 changes: 8 additions & 4 deletions agential/agents/expel/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
(1) Search[entity], which searches the exact entity on Wikipedia and returns the first paragraph if it exists. If not, it will return some similar entities to search.
(2) Lookup[keyword], which returns the next sentence containing keyword in the last passage successfully found by Search.
(3) Finish[answer], which returns the answer and finishes the task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task. If all sources are not verified, make the best estimate based on the information available.
Avoid spending excessive steps verifying sources if an answer can be inferred confidently. Accuracy and completeness should balance within the step limit.
Here are some examples:
{examples}
Expand Down Expand Up @@ -191,7 +192,8 @@
(1) Search[entity], which searches the exact entity on Wikipedia and returns the first paragraph if it exists. If not, it will return some similar entities to search.
(2) Lookup[keyword], which returns the next sentence containing keyword in the last passage successfully found by Search.
(3) Finish[answer], which returns the answer and finishes the task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task. If all sources are not verified, make the best estimate based on the information available.
Avoid spending excessive steps verifying sources if an answer can be inferred confidently. Accuracy and completeness should balance within the step limit.
Here are some examples:
{examples}
Expand Down Expand Up @@ -300,7 +302,8 @@
(1) Search[entity], which searches the exact entity on Wikipedia and returns the first paragraph if it exists. If not, it will return some similar entities to search.
(2) Lookup[keyword], which returns the next sentence containing keyword in the last passage successfully found by Search.
(3) Finish[answer], which returns the answer and finishes the task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task. If all sources are not verified, make the best estimate based on the information available.
Avoid spending excessive steps verifying sources if an answer can be inferred confidently. Accuracy and completeness should balance within the step limit.
Here are some examples:
{examples}
Expand Down Expand Up @@ -397,7 +400,8 @@
(1) Search[entity], which searches the exact entity on Wikipedia and returns the first paragraph if it exists. If not, it will return some similar entities to search.
(2) Lookup[keyword], which returns the next sentence containing keyword in the last passage successfully found by Search.
(3) Finish[answer], which returns the answer and finishes the task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task.
You have a maximum of {max_steps} steps. By step {max_steps}, you **must** use the `Finish[answer]` action to provide the final answer. Failure to do so will result in an incomplete task. If all sources are not verified, make the best estimate based on the information available.
Avoid spending excessive steps verifying sources if an answer can be inferred confidently. Accuracy and completeness should balance within the step limit.
Here are some examples:
{examples}
Expand Down
3 changes: 2 additions & 1 deletion agential/benchmarks/computer_use/webvoyager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ def get_web_element_rect(browser, fix_color=True):
else:
format_ele_text.append(f'[{web_ele_id}]: "{label_text}";')

Check warning on line 197 in agential/benchmarks/computer_use/webvoyager/utils.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/utils.py#L197

Added line #L197 was not covered by tests

format_ele_text = "\t".join(format_ele_text)
format_ele_text = "\n".join([s.replace("\n", "\\n") for s in format_ele_text])

Check warning on line 199 in agential/benchmarks/computer_use/webvoyager/utils.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/utils.py#L199

Added line #L199 was not covered by tests

return rects, [web_ele["element"] for web_ele in items_raw], format_ele_text

Check warning on line 201 in agential/benchmarks/computer_use/webvoyager/utils.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/utils.py#L201

Added line #L201 was not covered by tests


Expand Down
191 changes: 164 additions & 27 deletions agential/benchmarks/computer_use/webvoyager/webvoyager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from collections import deque
from typing import Any, Dict, Tuple, Union
import warnings

Check warning on line 10 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L8-L10

Added lines #L8 - L10 were not covered by tests

from openai import OpenAI
from selenium import webdriver
Expand Down Expand Up @@ -154,15 +155,90 @@ def exec_action_click(web_ele, driver_task):
time.sleep(3)

Check warning on line 155 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L152-L155

Added lines #L152 - L155 were not covered by tests


def validate_action_key(action_key: str) -> None:

Check warning on line 158 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L158

Added line #L158 was not covered by tests
"""
Validates the action_key to ensure it matches one of the allowed keys.
Raises a ValueError with a descriptive message if the validation fails.
"""
valid_keys = {"click", "type", "scroll", "wait", "goback", "google", "answer"}
if action_key.lower() not in valid_keys:
raise ValueError(f"Invalid action_key '{action_key}'. Allowed actions are: {', '.join(valid_keys)}.")

Check warning on line 165 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L163-L165

Added lines #L163 - L165 were not covered by tests


def validate_params(action_key: str, params: Union[Tuple, Dict[str, str]]) -> None:

Check warning on line 168 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L168

Added line #L168 was not covered by tests
"""
Validates the parameters for a given action_key based on strict formatting.
Raises a ValueError with a descriptive message if the validation fails.
"""

# Actions with no parameters.
if action_key in {"wait", "goback", "google"}:
if params is None or (isinstance(params, tuple) and len(params) == 0):
return
raise ValueError(f"Action '{action_key}' expects (,) as parameters, but got: {params}")

Check warning on line 178 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L175-L178

Added lines #L175 - L178 were not covered by tests

# Actions with specific patterns.
if action_key == "click":
if isinstance(params, tuple) and len(params) == 1 and params[0].isdigit():
return
raise ValueError(

Check warning on line 184 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L181-L184

Added lines #L181 - L184 were not covered by tests
f"Invalid parameters for action '{action_key}'. Received params: {params}. "
f"Expected a single numerical label as a tuple, e.g., ('42',)."
)

if action_key == "type":
if isinstance(params, dict) and "number" in params and "content" in params:
number_valid = params["number"].isdigit()
content_valid = isinstance(params["content"], str) and len(params["content"]) > 0
if number_valid and content_valid:
return
error_details = []
if not number_valid:
error_details.append("Invalid 'number' in parameters (should be a numerical id).")
if not content_valid:
error_details.append("Invalid 'content' in parameters (should be a non-empty string).")
raise ValueError(f"Invalid parameters for 'type': {params}. {' '.join(error_details)}")
raise ValueError(f"Invalid parameters for 'type'. Expected format: {{'number': 'numerical_id', 'content': 'content'}}.")

Check warning on line 201 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L189-L201

Added lines #L189 - L201 were not covered by tests

if action_key == "scroll":
if isinstance(params, dict) and "number" in params and "direction" in params:
number_valid = params["number"] == "WINDOW" or params["number"].isdigit()
direction_valid = params["direction"].lower() in {"up", "down"}
if number_valid and direction_valid:
return
error_details = []
if not number_valid:
error_details.append("Invalid 'number' in parameters (should be a numerical id or 'WINDOW').")
if not direction_valid:
error_details.append("Invalid 'direction' in parameters (should be 'up' or 'down').")
raise ValueError(f"Invalid parameters for 'scroll': {params}. {' '.join(error_details)}")
raise ValueError(f"Invalid parameters for 'scroll'. Expected format: {{'number': '[numerical_id|WINDOW]', 'direction': '[up|down]'}}.")

Check warning on line 215 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L203-L215

Added lines #L203 - L215 were not covered by tests

if action_key == "answer":
if isinstance(params, tuple) and len(params) == 1 and isinstance(params[0], str) and len(params[0]) > 0:
return
raise ValueError(

Check warning on line 220 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L217-L220

Added lines #L217 - L220 were not covered by tests
f"Invalid parameters for action '{action_key}'. Received params: {params}. "
f"Expected a tuple containing a single non-empty content string, e.g., ('This is the answer.',)."
)

# If no validation logic exists for an action_key, raise an error.
raise ValueError(

Check warning on line 226 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L226

Added line #L226 was not covered by tests
f"Validation failed for action '{action_key}'. This action is not recognized or does not have a defined validation logic. "
f"Received parameters: {params}. "
f"Please ensure the action_key is one of the supported actions (e.g., 'click', 'type', 'scroll', 'wait', 'goback', 'google', 'answer') "
f"and that its parameters follow the expected format."
)

class WebVoyager(BaseComputerUseBenchmark):
def __init__(

Check warning on line 234 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L233-L234

Added lines #L233 - L234 were not covered by tests
self,
openai_client: OpenAI,
openai_model: str,
download_dir: str,
headless: bool,
force_device_scale: bool,
max_iter: int = 5,
headless: bool = False,
force_device_scale: bool = False,
text_only: bool = False,
fix_box_color: bool = False,
window_width: int = 1024,
Expand All @@ -176,21 +252,21 @@ def __init__(
self.openai_client = openai_client
self.openai_model = openai_model
self.download_dir = download_dir
self.max_iter = max_iter
if not os.path.exists(download_dir):
os.makedirs(download_dir, exist_ok=True)
self.options = driver_config(

Check warning on line 258 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L251-L258

Added lines #L251 - L258 were not covered by tests
download_dir=self.download_dir,
headless=headless,
force_device_scale=force_device_scale,
)
self.max_iter = max_iter
self.text_only = text_only
self.fix_box_color = fix_box_color
self.window_width = window_width
self.window_height = window_height
self.max_num_imgs = max_num_imgs
self.eval_model_kwargs = eval_model_kwargs

Check warning on line 268 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L263-L268

Added lines #L263 - L268 were not covered by tests

self.pattern = r"Thought:|Action:|Observation:"

# State.
self.answer = ""
self.finished = False
Expand Down Expand Up @@ -256,19 +332,63 @@ def reset(self, task: Dict[str, Any]) -> Any:
self._prev_result = None
self.img_buffer = deque(maxlen=self.max_num_imgs)

Check warning on line 333 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L328-L333

Added lines #L328 - L333 were not covered by tests

screenshot_data = self.driver_task.get_screenshot_as_png()
encoded_image = base64.b64encode(screenshot_data).decode("utf-8")

Check warning on line 336 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L335-L336

Added lines #L335 - L336 were not covered by tests

web_eles_text = None
ac_tree = None
try:
if not self.text_only:
rects, _, web_eles_text = get_web_element_rect(

Check warning on line 342 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L338-L342

Added lines #L338 - L342 were not covered by tests
self.driver_task, fix_color=self.fix_box_color
)
else:
ac_tree, _ = get_webarena_accessibility_tree(self.driver_task)
except Exception:
if not self.text_only:
raise RuntimeError("Driver error when adding set-of-mark.")

Check warning on line 349 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L346-L349

Added lines #L346 - L349 were not covered by tests
else:
raise RuntimeError("Driver error when obtaining accessibility tree.")

Check warning on line 351 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L351

Added line #L351 was not covered by tests

encoded_image_som = None
if not self.text_only:
screenshot_data = self.driver_task.get_screenshot_as_png()
encoded_image_som = base64.b64encode(screenshot_data).decode("utf-8")

Check warning on line 356 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L353-L356

Added lines #L353 - L356 were not covered by tests

if (not self.text_only) and rects:
for rect_ele in rects:
self.driver_task.execute_script("arguments[0].remove()", rect_ele)

Check warning on line 360 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L358-L360

Added lines #L358 - L360 were not covered by tests

obs = {

Check warning on line 362 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L362

Added line #L362 was not covered by tests
"screenshot": encoded_image,
"screenshot_som": encoded_image_som,
"som": web_eles_text,
"accessibility_tree": ac_tree,
"fail": "",
"pdf": "",
"warn": "",
}

result = (obs, 0, False, {})
self._prev_result = result
self.img_buffer.append(encoded_image)

Check warning on line 374 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L372-L374

Added lines #L372 - L374 were not covered by tests

return result

Check warning on line 376 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L376

Added line #L376 was not covered by tests

def step(self, action_key: str, params: Union[Tuple, Dict[str, str]]) -> Any:
if not self.task and not self.driver_task:
raise ValueError("Please reset the environment first.")

Check warning on line 380 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L378-L380

Added lines #L378 - L380 were not covered by tests

# TODO: robust error handling of action_key and info

# at each iter, it stores the:
# - acc tree
# - screenshot
# - pdf file
# - interact_messages.json

# Validate action_key and params.
validate_action_key(action_key)
validate_params(action_key, params)

Check warning on line 384 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L383-L384

Added lines #L383 - L384 were not covered by tests

if self.it >= self.max_iter or self.finished:
if self.it >= self.max_iter:
warnings.warn("Environment is done: Maximum iterations reached")
elif self.finished:
warnings.warn("Environment is done: Task completed with an answer")

Check warning on line 390 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L386-L390

Added lines #L386 - L390 were not covered by tests

return self._prev_result

Check warning on line 392 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L392

Added line #L392 was not covered by tests

reward = 0
Expand All @@ -292,9 +412,6 @@ def step(self, action_key: str, params: Union[Tuple, Dict[str, str]]) -> Any:
else:
raise RuntimeError("Driver error when obtaining accessibility tree.")

Check warning on line 413 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L413

Added line #L413 was not covered by tests

screenshot_data = self.driver_task.get_screenshot_as_png()
encoded_image = base64.b64encode(screenshot_data).decode("utf-8")

if (not self.text_only) and rects:
for rect_ele in rects:
self.driver_task.execute_script("arguments[0].remove()", rect_ele)

Check warning on line 417 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L415-L417

Added lines #L415 - L417 were not covered by tests
Expand Down Expand Up @@ -408,6 +525,7 @@ def step(self, action_key: str, params: Union[Tuple, Dict[str, str]]) -> Any:
elif action_key == "answer":
self.answer = params["content"]
self.finished = True
reward = self.evaluate()

Check warning on line 528 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L519-L528

Added lines #L519 - L528 were not covered by tests
else:
raise NotImplementedError
except Exception as e:
Expand All @@ -417,30 +535,49 @@ def step(self, action_key: str, params: Union[Tuple, Dict[str, str]]) -> Any:

self.it += 1

Check warning on line 536 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L536

Added line #L536 was not covered by tests

screenshot_data = self.driver_task.get_screenshot_as_png()
encoded_image = base64.b64encode(screenshot_data).decode("utf-8")

Check warning on line 539 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L538-L539

Added lines #L538 - L539 were not covered by tests

try:
if not self.text_only:
rects, web_eles, web_eles_text = get_web_element_rect(

Check warning on line 543 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L541-L543

Added lines #L541 - L543 were not covered by tests
self.driver_task, fix_color=self.fix_box_color
)
else:
ac_tree, obs_info = get_webarena_accessibility_tree(self.driver_task)

Check warning on line 547 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L547

Added line #L547 was not covered by tests

except Exception:
if not self.text_only:
raise RuntimeError("Driver error when adding set-of-mark.")

Check warning on line 551 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L549-L551

Added lines #L549 - L551 were not covered by tests
else:
raise RuntimeError("Driver error when obtaining accessibility tree.")

Check warning on line 553 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L553

Added line #L553 was not covered by tests

screenshot_data = self.driver_task.get_screenshot_as_png()
encoded_image_som = base64.b64encode(screenshot_data).decode("utf-8")

Check warning on line 556 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L555-L556

Added lines #L555 - L556 were not covered by tests

if (not self.text_only) and rects:
for rect_ele in rects:
self.driver_task.execute_script("arguments[0].remove()", rect_ele)

Check warning on line 560 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L558-L560

Added lines #L558 - L560 were not covered by tests

obs = {

Check warning on line 562 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L562

Added line #L562 was not covered by tests
"screenshot": encoded_image,
"screenshot_som": encoded_image_som,
"som": web_eles_text,
"accessibility_tree": ac_tree,
"fail": fail_obs,
"pdf": pdf_obs,
"warn": warn_obs,
}
done = self.it >= self.max_iter or self.finished

info = {}
if not self.text_only:
info["rects"] = rects
info["web_elements"] = web_eles
info["web_elements_text"] = web_eles_text
else:
info["accessibility_tree"] = ac_tree
info["obs_info"] = obs_info
done = self.it >= self.max_iter or self.finished

Check warning on line 572 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L572

Added line #L572 was not covered by tests

result = (obs, reward, done, info) # TODO: fix reward
result = (obs, reward, done, {})

Check warning on line 574 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L574

Added line #L574 was not covered by tests

self._prev_result = result
self.img_buffer.append(encoded_image)

Check warning on line 577 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L576-L577

Added lines #L576 - L577 were not covered by tests

return result

Check warning on line 579 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L579

Added line #L579 was not covered by tests

def render(self, mode="human") -> None:

Check warning on line 581 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L581

Added line #L581 was not covered by tests
"""Render the environment. No-op since rendering is not required."""
pass

Check warning on line 583 in agential/benchmarks/computer_use/webvoyager/webvoyager.py

View check run for this annotation

Codecov / codecov/patch

agential/benchmarks/computer_use/webvoyager/webvoyager.py#L583

Added line #L583 was not covered by tests
Expand Down
Loading

0 comments on commit 03dc444

Please sign in to comment.