O bromato é um projeto experimental que explora os recursos dos fluxos de trabalho do agente para automatizar as interações do navegador da Web.
O bromato aproveita o poder dos grandes modelos de idiomas (LLMS), especificamente o gemini do Google, para entender as solicitações de usuário expressas na linguagem natural e traduzi -las em uma série de ações que automatizam tarefas de navegação na Web.
Ele utiliza o selênio para controle e interação do navegador, oferecendo uma maneira perfeita de automatizar fluxos de trabalho complexos em um ambiente de navegador da Web.
Antes de usar o bromato, você precisa obter uma chave da API do Google para a API Gemini. Você pode obter uma chave seguindo estas etapas:
Definindo a chave da API em .env durante o desenvolvimento:
Você pode definir a chave da API em um arquivo .env no repositório do projeto:
GOOGLE_API_KEY=YOUR_API_KEY Você pode verificar se a chave está configurada digitando echo $GOOGLE_API_KEY em seu shell.
O bromato está disponível no Pypi e pode ser facilmente instalado usando PIP:
pip install bromatePara usar o bromato, você pode fornecer uma consulta de linguagem natural que descreve a tarefa que deseja automatizar. O bromato interagirá com o agente (Gêmeos) para interpretar a consulta e gerar uma sequência de ações a serem executadas pelo selenium webdriver.
Exemplo 1: Inscreva -se no boletim informativo do MLOPS:
bromato "Abra o site https://mlops.community. Clique no link 'JONE'. Escreva o endereço 'Hello@mlops'"
Exemplo 2: Encontre a versão mais recente do idioma Python:
bromato--interaction.stay_open = false --agent.name "gemini-1.5-pro-latest" "vai para python.org. Clique na página de downloads. Clique no link PEP para o futuro lançamento do Python. Resumindo as datas do cronograma de lançamento"
bromate -h
usage: bromate [-h] [--agent JSON] [--agent.api_key {SecretStr,null}] [--agent.name str] [--agent.temperature float] [--agent.candidate_count int]
[--agent.max_output_tokens int] [--agent.system_instructions str] [--action JSON] [--action.sleep_time float] [--driver JSON]
[--driver.name {Chrome,Firefox}] [--driver.keep_alive bool] [--driver.maximize_window bool] [--execution JSON] [--execution.stop_actions list[str]]
[--execution.default_message str] [--interaction JSON] [--interaction.stay_open bool] [--interaction.interactive bool] [--interaction.max_interactions int]
QUERY
Execute actions on web browser from a user query in natural language.
positional arguments:
QUERY User query in natural language
options:
-h , --help show this help message and exit
agent options:
Configuration of the agent
--agent JSON set agent from JSON string
--agent.api_key {SecretStr,null}
API key of the agent platform (Google) (default: ********** )
--agent.name str Name of the agent to use (default: gemini-1.5-flash-latest)
--agent.temperature float
Temperature of the agent (default: 0.0)
--agent.candidate_count int
Number of candidates to generate (default: 1)
--agent.max_output_tokens int
Maximum output tokens to generate (default: 1000)
--agent.system_instructions str
System instructions for the agent (default: You are a browser automation system. Your goal is to understand the user request and execute actions
on its browser using the tools at your disposal. After each step, you will receive a screenshot and the page source of the current browser
window.)
action options:
Configuration for all actions
--action JSON set action from JSON string
--action.sleep_time float
Time to sleep after loading a page (default: 0.5)
driver options:
Configuration of the web driver
--driver JSON set driver from JSON string
--driver.name {Chrome,Firefox}
Name of the driver to use (default: Chrome)
--driver.keep_alive bool
Keep the browser open at the end of the execution (default: True)
--driver.maximize_window bool
Maximize the browser window at the start of the execution (default: True)
execution options:
Configuration of the execution
--execution JSON set execution from JSON string
--execution.stop_actions list[str]
Name of actions that can stop the execution (default: [ ' done ' ])
--execution.default_message str
Default message to send to the agent when no input is provided by the user (default: Continue the execution if necessary or call the done tool if
you are done)
interaction options:
Configuration of the interaction
--interaction JSON set interaction from JSON string
--interaction.stay_open bool
Keep the browser open before exiting (default: True)
--interaction.interactive bool
Ask for user input after every action (default: False)
--interaction.max_interactions int
Maximum number of interactions for the agent (default: 5)O bromato opera em um loop, interagindo continuamente com o agente Gemini e o Selênio Webdriver para automatizar as tarefas do navegador. Aqui está um colapso do comportamento central:
1. Inicialização:
src/bromate/actions.py . Exemplos incluem:get : Abra um URL específico no navegador.click : Clique em um elemento identificado por um seletor CSS.write : insira o texto em um elemento.back : Navegue de volta para a página anterior.done : sinalize o final da tarefa de automação.2. Seleção e execução de ação:
3. Loop de feedback:
done , indicando que a tarefa está concluída ou um número máximo de interações é atingido.Esse processo iterativo permite que o Bromate se adapte dinamicamente às mudanças no ambiente do navegador e execute tarefas de automação complexas com base nas instruções de linguagem natural.
O fluxo de trabalho de desenvolvimento do Bromate é gerenciado usando o Pyinvoke. As tasks/ pasta contém várias tarefas para gerenciar o projeto:
O bromato é licenciado sob a licença do MIT. Consulte o arquivo de licença para obter mais detalhes.