Bromate هو مشروع تجريبي يستكشف قدرات سير عمل الوكيل لأتمتة تفاعلات متصفح الويب.
يقوم Bromate بالاستفادة من قوة نماذج اللغة الكبيرة (LLMS) ، وتحديداً من Gemini من Google ، لفهم طلبات المستخدم المعبر عنها باللغة الطبيعية وترجمتها إلى سلسلة من الإجراءات التي تتم أتمتة مهام تصفح الويب.
إنه يستخدم السيلينيوم للتحكم في المتصفح والتفاعل ، مما يوفر طريقة سلسة لأتمتة سير العمل المعقدة داخل بيئة متصفح الويب.
قبل استخدام Bromate ، تحتاج إلى الحصول على مفتاح API من Google في Gemini API. يمكنك الحصول على مفتاح باتباع هذه الخطوات:
وضع مفتاح API في .env أثناء التطوير:
يمكنك تعيين مفتاح API في ملف .env في مستودع المشروع:
GOOGLE_API_KEY=YOUR_API_KEY يمكنك التحقق مما إذا كان المفتاح تم تكوينه عن طريق كتابة echo $GOOGLE_API_KEY في قذيتك.
Bromate متاح على PYPI ويمكن تثبيته بسهولة باستخدام PIP:
pip install bromateلاستخدام Bromate ، يمكنك توفير استعلام لغة طبيعي يصف المهمة التي تريد أتمتة. سوف يتفاعل Bromate بعد ذلك مع الوكيل (Gemini) لتفسير الاستعلام وإنشاء سلسلة من الإجراءات التي سيتم تنفيذها بواسطة Selenium WebDriver.
مثال 1: اشترك في النشرة الإخبارية لمجتمع MLOPS:
bromate "افتح موقع https://mlops.sommunity. انقر على الرابط" Join ". اكتب العنوان" Hello@mlops ""
مثال 2: ابحث عن أحدث إصدار من لغة Python:
Bromate-interaction.stay_open = false-agent.name "Gemini-1.5-Pro-Latest" "انتقل إلى Python.org. انقر فوق صفحة التنزيلات. انقر على رابط PEP لإصدار Python المستقبلي. قم بتلخيص تواريخ الجدول".
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 في حلقة ، تتفاعل بشكل مستمر مع عامل الجوزاء و Selenium WebDriver لأتمتة مهام المتصفح. إليك تفاصيل السلوك الأساسي:
1. التهيئة:
src/bromate/actions.py . تشمل الأمثلة:get : فتح عنوان URL محدد في المتصفح.click : انقر فوق عنصر تم تحديده بواسطة محدد CSS.write : أدخل النص في عنصر.back : انتقل مرة أخرى إلى الصفحة السابقة.done : إشارة إلى نهاية مهمة الأتمتة.2. اختيار العمل والتنفيذ:
3. حلقة التغذية المرتدة:
done ، مما يشير إلى اكتمال المهمة ، أو يتم الوصول إلى عدد أقصى من التفاعلات.تتيح هذه العملية التكرارية برومات بالتكيف ديناميكيًا مع التغييرات في بيئة المتصفح وأداء مهام الأتمتة المعقدة بناءً على تعليمات اللغة الطبيعية.
تتم إدارة سير عمل التنمية من Bromate باستخدام Pyinvoke. يحتوي tasks/ المجلد على مهام مختلفة لإدارة المشروع:
بروميت مرخصة بموجب ترخيص معهد ماساتشوستس للتكنولوجيا. انظر ملف الترخيص لمزيد من التفاصيل.