|
| 1 | +--- |
| 2 | +title: Simular Browser |
| 3 | +layout: home |
| 4 | +nav_order: 1 |
| 5 | +description: "Simular Browser Python API documentation." |
| 6 | +permalink: /simularBrowser |
| 7 | +--- |
| 8 | + |
| 9 | +# Simular Browser Python API documentation |
| 10 | + |
| 11 | +# Setup and configuration |
| 12 | + |
| 13 | +## __init__() |
| 14 | +```python |
| 15 | +def __init__(self, |
| 16 | + path: str, |
| 17 | + anthropic_key: str = '', |
| 18 | + planner_model: str = 'claude-3-5-sonnet', |
| 19 | + planner_mode: str = 'system_1_2'): |
| 20 | +``` |
| 21 | + |
| 22 | +## Parameters |
| 23 | + |
| 24 | +### path |
| 25 | +Absolute path to the Simular Browser executable. |
| 26 | + |
| 27 | +### anthropic_key |
| 28 | +Anthropic API key. |
| 29 | + |
| 30 | +### planner_model |
| 31 | +Model for the planner. |
| 32 | +Selection: "claude-3-5-sonnet" |
| 33 | + |
| 34 | +### planner_mode |
| 35 | +Mode to use for the planner. |
| 36 | +``` |
| 37 | +"system_1": runs a planner that produces one-shot instructions |
| 38 | +"system_2": runs a planner that operates step-by-step exploration |
| 39 | +"system_1_2": runs system 1, then system 2 if system 1 fails |
| 40 | +"agent_s1": runs Agent S1: hierarchical planning with exploration |
| 41 | +``` |
| 42 | + |
| 43 | + |
| 44 | +## Return Value |
| 45 | +None |
| 46 | + |
| 47 | +## Discussion |
| 48 | +Examples: |
| 49 | + |
| 50 | +- Instruction: Initialize Simular Browser for default configuration |
| 51 | +```python |
| 52 | +simular = SimularBrowser(path="path/to/simular") |
| 53 | +``` |
| 54 | +- Instruction: Initialize Simular Browser with custom configuration |
| 55 | +```python |
| 56 | +simular = SimularBrowser(path="path/to/simular", anthropic_key="anthropic_key", planner_model="claude-3-5-sonnet", planner_mode="system_1_2") |
| 57 | +``` |
| 58 | + |
| 59 | +# Simular Browser API |
| 60 | + |
| 61 | +## is_app_running() |
| 62 | +```python |
| 63 | +def is_app_running(self) -> bool: |
| 64 | +``` |
| 65 | + |
| 66 | +## Parameter |
| 67 | +None |
| 68 | + |
| 69 | +## Return Value |
| 70 | +True if the app is running, False otherwise. |
| 71 | + |
| 72 | +## Discussion |
| 73 | +Examples: |
| 74 | + |
| 75 | +- Instruction: Check if Simular Browser is running |
| 76 | +```python |
| 77 | +simular = SimularBrowser(path="path/to/simular") |
| 78 | +is_running = simular.is_app_running() # True if running, False otherwise |
| 79 | +``` |
| 80 | + |
| 81 | + |
| 82 | +## launch_app() |
| 83 | +```python |
| 84 | +def launch_app(self) -> None: |
| 85 | +``` |
| 86 | + |
| 87 | +## Parameter |
| 88 | +None |
| 89 | + |
| 90 | +## Return Value |
| 91 | +None |
| 92 | + |
| 93 | +## Discussion |
| 94 | +Examples: |
| 95 | + |
| 96 | +- Instruction: Launch Simular Browser |
| 97 | +```python |
| 98 | +simular = SimularBrowser(path="path/to/simular") |
| 99 | +simular.launch_app() |
| 100 | +``` |
| 101 | + |
| 102 | +## run() |
| 103 | +```python |
| 104 | +def run(self, query, timeout=None, reset: bool = False) -> dict: |
| 105 | +``` |
| 106 | + |
| 107 | +## Parameters |
| 108 | + |
| 109 | +### query |
| 110 | +Query to run in Simular Browser. |
| 111 | + |
| 112 | +### timeout |
| 113 | +Timeout for this query. |
| 114 | + |
| 115 | +### reset |
| 116 | +Reset the app before running the query. |
| 117 | + |
| 118 | +## Return Value |
| 119 | +Dictionary containing the response from Simular Browser: |
| 120 | + |
| 121 | +```python |
| 122 | +output = { |
| 123 | + "responses": self.responses, |
| 124 | + "images": self.images, |
| 125 | + "info": self.info |
| 126 | +} |
| 127 | + |
| 128 | +- responses: List of text responses from Simular Browser. |
| 129 | +- images: List of image responses from Simular Browser. |
| 130 | +- info: Information about this run from Simular Browser. |
| 131 | + |
| 132 | +``` |
| 133 | + |
| 134 | +## Discussion |
| 135 | + |
| 136 | +Examples: |
| 137 | + |
| 138 | +- Instruction: Run a query in Simular Browser |
| 139 | +```python |
| 140 | +simular = SimularBrowser(path="path/to/simular") |
| 141 | +output = simular.run("What is the capital of France?") |
| 142 | +``` |
| 143 | + |
| 144 | +- Instruction: Run a query in Simular Browser with a timeout |
| 145 | +```python |
| 146 | +simular = SimularBrowser(path="path/to/simular") |
| 147 | +output = simular.run("What is the capital of France?", timeout=60) |
| 148 | +``` |
| 149 | + |
| 150 | +##TODO: |
| 151 | +- Multi-tab parallel execution |
0 commit comments