Skip to content

Commit 0c76ea7

Browse files
committed
0.2.53 add an option to disable danger checking
1 parent e2c12c6 commit 0c76ea7

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ This repo was inspired by the work of [Yihui He](https://github.com/yihui-he/Act
164164
- Demo/test something where it has to ask the LLM to synthesize something it reads online.
165165
- 🚨 Figured out how to feed the content of the HTML page into the GPT-3 context window and have it reliably pick out specific elements from it, that would be great!
166166

167-
## 🚨 Disclaimer 🚨
167+
## 🚨 Disclaimer
168168

169-
This package runs code output from the OpenAI API in Python using `exec`. 🚨 **This is not considered a safe convention** 🚨. Accordingly, you should be extra careful when using this package. The standard disclaimer follows.
169+
This package runs code output from the OpenAI API in Python using `exec`. **This is not considered a safe convention**. Accordingly, you should be extra careful when using this package. The standard disclaimer follows.
170170

171171
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
172172

browserpilot/agents/compilers/instruction_compiler.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def __init__(
8787
base_prompt=BASE_PROMPT,
8888
model="gpt-4o-mini",
8989
use_compiled=True,
90-
disable_danger_check=False,
9190
):
9291
"""Initialize the compiler. The compiler handles the sequencing of
9392
each set of instructions which are injected into the base prompt.
@@ -126,7 +125,6 @@ def __init__(
126125
self.functions = {} # Set in _parse_instructions_into_queue.
127126
self.finished_instructions = []
128127
self.history = [] # Keep track of the history of actions.
129-
self.disable_danger_check = disable_danger_check
130128

131129
# Set the instructions.
132130
self.instructions = instructions # Overriden in set_instructions.
@@ -339,9 +337,6 @@ def get_action_output(self, instructions):
339337
prompt = self.base_prompt.format(instructions=instructions)
340338
completion = self.get_completion(prompt).strip()
341339
action_output = completion.strip()
342-
print(self.disable_danger_check)
343-
lines = [line for line in action_output.split("\n") if (self.disable_danger_check is False or not line.startswith("import "))]
344-
action_output = "\n".join(lines)
345340
return {
346341
"instruction": instructions,
347342
"action_output": action_output,

browserpilot/agents/gpt_selenium_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def __init__(
8484
instructions should be saved.
8585
close_after_completion (bool): Whether to close the browser after
8686
the instructions have been executed.
87+
remote_url (str): URL of the Selenium Grid target.
88+
disable_danger_check (bool): Whether to disable the danger check.
8789
"""
8890
"""Helpful instance variables."""
8991
assert (
@@ -111,7 +113,6 @@ def __init__(
111113
self.instruction_compiler = InstructionCompiler(
112114
instructions=instructions,
113115
model=self.model_for_instructions,
114-
disable_danger_check = self.disable_danger_check,
115116
)
116117

117118
"""Set up the memory."""
@@ -152,7 +153,7 @@ def __init__(
152153
def _check_danger(self, action_str):
153154
"""Check that the action is not dangerous. If so, just quit."""
154155
if (self.disable_danger_check is True):
155-
logger.warning("Code Danger checking is disabled")
156+
logger.warning("Caution! We are not checking for dangerous actions returned by the LLM.")
156157
return
157158
if (self._is_potentially_dangerous(action_str)):
158159
logger.warning("Action is potentially dangerous. Exiting.")

0 commit comments

Comments
 (0)