| 51 | |
| 52 | |
| 53 | def config() -> argparse.Namespace: |
| 54 | parser = argparse.ArgumentParser(description="Run single-step evaluation on the benchmark") |
| 55 | |
| 56 | parser.add_argument( |
| 57 | "--data_from_hub", |
| 58 | action="store_true", |
| 59 | help="Whether to load the dataset from the hub", |
| 60 | ) |
| 61 | parser.add_argument( |
| 62 | "--slow_mo", |
| 63 | type=int, |
| 64 | default=0, |
| 65 | help="Slow down the browser by the specified amount", |
| 66 | ) |
| 67 | parser.add_argument("--action_set_tag", default="som", help="Action type") |
| 68 | parser.add_argument( |
| 69 | "--observation_type", |
| 70 | choices=[ |
| 71 | "accessibility_tree", |
| 72 | "accessibility_tree_with_captioner", |
| 73 | "html", |
| 74 | "image", |
| 75 | "image_som", |
| 76 | ], |
| 77 | default="image_som", |
| 78 | help="Observation type", |
| 79 | ) |
| 80 | parser.add_argument( |
| 81 | "--current_viewport_only", |
| 82 | action="store_true", |
| 83 | help="Only use the current viewport for the observation", |
| 84 | ) |
| 85 | parser.add_argument("--viewport_width", type=int, default=1280) |
| 86 | parser.add_argument("--viewport_height", type=int, default=2048) |
| 87 | parser.add_argument("--save_trace_enabled", action="store_true") |
| 88 | parser.add_argument("--sleep_after_execution", type=float, default=0.0) |
| 89 | |
| 90 | parser.add_argument("--max_steps", type=int, default=30) |
| 91 | |
| 92 | # agent config |
| 93 | parser.add_argument("--agent_type", type=str, default="prompt") |
| 94 | parser.add_argument( |
| 95 | "--instruction_path", |
| 96 | type=str, |
| 97 | default="agent/prompts/jsons/p_som_cot_id_actree_3s.json", |
| 98 | ) |
| 99 | parser.add_argument( |
| 100 | "--parsing_failure_th", |
| 101 | help="When consecutive parsing failures exceed this threshold, the agent will terminate early.", |
| 102 | type=int, |
| 103 | default=3, |
| 104 | ) |
| 105 | parser.add_argument( |
| 106 | "--repeating_action_failure_th", |
| 107 | help="When consecutive repeated actions exceed this threshold, the agent will terminate early.", |
| 108 | type=int, |
| 109 | default=5, |
| 110 | ) |