browserpilot icon indicating copy to clipboard operation
browserpilot copied to clipboard

Add flag to disable is_dangerous import checking

Open jfelten opened this issue 1 year ago • 10 comments

I'd like the ability to disable the is dangerous check as needed through a flag: https://github.com/handrew/browserpilot/blob/b414a3c78b40df8e4aaacc022176b6fbfdc8f1e9/browserpilot/agents/gpt_selenium_agent.py#L149

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.

jfelten avatar Nov 12 '24 07:11 jfelten

Hey @jfelten. Feel free to generate the PR!

handrew avatar Nov 12 '24 16:11 handrew

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?

handrew avatar Nov 12 '24 16:11 handrew

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 avatar Nov 13 '24 05:11 jfelten

I created https://github.com/handrew/browserpilot/pull/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?

jfelten avatar Nov 13 '24 19:11 jfelten

@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.

handrew avatar Nov 14 '24 02:11 handrew

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.

jfelten avatar Nov 14 '24 02:11 jfelten

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.

handrew avatar Nov 21 '24 04:11 handrew

@handrew Do you think this works with llama3.2?

kuldeepluvani avatar Dec 21 '24 06:12 kuldeepluvani

@kuldeepluvani haven't tried it! You wanna give it a shot?

handrew avatar Dec 21 '24 06:12 handrew

@kuldeepluvani haven't tried it! You wanna give it a shot?

Yeah, I will try this out and will keep you guys posted.

kuldeepluvani avatar Jan 08 '25 18:01 kuldeepluvani