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