Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to disable is_dangerous import checking #17

Open
jfelten opened this issue Nov 12, 2024 · 7 comments
Open

Add flag to disable is_dangerous import checking #17

jfelten opened this issue Nov 12, 2024 · 7 comments

Comments

@jfelten
Copy link

jfelten commented Nov 12, 2024

I'd like the ability to disable the is dangerous check as needed through a flag:

def _check_danger(self, action_str):

My use case returns json, and generates an import statement that forces the code to exit:

Action: from json import dumps

If you are ok with this I can generate a PR.

@handrew
Copy link
Owner

handrew commented Nov 12, 2024

Hey @jfelten. Feel free to generate the PR!

@handrew
Copy link
Owner

handrew commented Nov 12, 2024

By the way, I didn't know people still used BrowserPilot. I haven't tested it for gpt-4o or gpt-4o-mini. Does it work okay for it?

@jfelten
Copy link
Author

jfelten commented Nov 13, 2024

Thanks, @handrew. Yes, it seems to work well with gpt-4. This is good work, and I am surprised more people aren't using browserpilot. I will generate a Pull Request.

@jfelten
Copy link
Author

jfelten commented Nov 13, 2024

I created #18. Unfortunately, I cannot get the example.py to run. Chrome webdriver crashes:

poetry run python3.12 examples.py selenium --chromedriver_path ./chromedriver  ./prompts/examples/buffalo_wikipedia.yaml

I noticed the same behavior on the main branch. I did verify that the published python package is working. It is using gpt-3.5-turbo not gpt-4 like I thought.

Can you verify the code on main is correct and that my updating dependencies isn't breaking stuff?

@handrew
Copy link
Owner

handrew commented Nov 14, 2024

@jfelten It also did not work for me. I just pushed a fix for it. The problem was the stop keyword arg. gpt-4o seems to like to give answers prefixed with backticks. It works for me now.

@jfelten
Copy link
Author

jfelten commented Nov 14, 2024

Thanks! It works with gpt-4 now, but gpt-3.5-turbo now throws an error:

INFO:browserpilot.agents.compilers.instruction_compiler:OpenAI error. Likely a rate limit error, API error, or timeout: Error code: 400 - {'error': {'message': "'$.stop' is invalid. Please check the API reference: https://platform.openai.com/docs/api-reference.", 'type': 'invalid_request_error', 'param': None, 'code': None}}. 

Might want to mention gpt-3.5-turbo in the docs is no longer supported, and/or throw an exception if it is specified. I will finish up testing my PR and mark it as ready to merge.

@handrew
Copy link
Owner

handrew commented Nov 21, 2024

Hmm @jfelten, now that I'm looking at your original issue, I think there might be a cleaner fix than disabling the danger check.

Is it important for you to be able to import arbitrary libraries or code? Or do you just want to dump to JSON? If the latter, then I think a cleaner way to accomplish that is to simply add a new function call / capability to the prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants