Bromateは、Webブラウザーの対話を自動化するためのエージェントワークフローの機能を探る実験プロジェクトです。
臭素酸塩は、大規模な言語モデル(LLMS)、特にGoogleのGeminiの力を活用して、自然言語で表現されたユーザー要求を理解し、Webブラウジングタスクを自動化する一連のアクションに変換します。
ブラウザのコントロールとインタラクションにSeleniumを利用して、Webブラウザー環境内で複雑なワークフローを自動化するシームレスな方法を提供します。
Bromateを使用する前に、Gemini APIのGoogleからAPIキーを取得する必要があります。これらの手順に従ってキーを取得できます。
開発中にAPIキーを.envに設定します:
プロジェクトリポジトリの.envファイルにAPIキーを設定できます。
GOOGLE_API_KEY=YOUR_API_KEYシェルにecho $GOOGLE_API_KEYを入力して、キーが構成されているかどうかを確認できます。
BromateはPypiで入手でき、PIPを使用して簡単にインストールできます。
pip install bromate臭素酸塩を使用するには、自動化するタスクを説明する自然言語クエリを提供できます。その後、臭素酸塩はエージェント(Gemini)と対話してクエリを解釈し、Selenium WebDriverによって実行される一連のアクションを生成します。
例1:MLOPSコミュニティニュースレターを購読する:
Bromate「https://mlops.community Webサイトを開きます。「参加」リンクをクリックします。
例2:Python言語の最新バージョンを見つける:
bromate - interaction.stay_open = false -agent.name "gemini-1.5-pro-latest" "python.orgに移動します。ダウンロードページをクリックします。将来のpythonリリースのためにpepリンクをクリックします。リリーススケジュールの要約。」
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)Bromateはループで動作し、GeminiエージェントおよびSelenium WebDriverと継続的に相互作用して、ブラウザタスクを自動化します。これがコアの動作の内訳です:
1。初期化:
src/bromate/actions.pyファイルで定義されています。例は次のとおりです。get :ブラウザで特定のURLを開きます。click :CSSセレクターによって識別された要素をクリックします。write :要素にテキストを入力します。back :前のページに戻ります。done :自動化タスクの終了を通知します。2。アクション選択と実行:
3。フィードバックループ:
doneアクションの実行を決定するまで続き、タスクが完全であることを示し、最大数の相互作用に到達します。この反復プロセスにより、臭素酸塩はブラウザ環境の変化に動的に適応し、自然言語の指示に基づいて複雑な自動化タスクを実行できます。
Bromateの開発ワークフローは、Pyinvokeを使用して管理されています。 tasks/フォルダーには、プロジェクトを管理するためのさまざまなタスクが含まれています。
臭素酸塩はMITライセンスに基づいてライセンスされています。詳細については、ライセンスファイルを参照してください。