Add flag to disable is_dangerous import checking
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.
Hey @jfelten. Feel free to generate the PR!
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?
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.
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 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.
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.
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 Do you think this works with llama3.2?
@kuldeepluvani haven't tried it! You wanna give it a shot?
@kuldeepluvani haven't tried it! You wanna give it a shot?
Yeah, I will try this out and will keep you guys posted.