เว็บไซต์•กระดาษ•ลีดเดอร์บอร์ด

สำคัญ
ที่เก็บนี้เป็นเจ้าภาพการใช้งาน ที่เป็นที่ยอมรับ ของ Webarena เพื่อทำซ้ำผลลัพธ์ที่รายงานในกระดาษ โครงสร้างพื้นฐานการนำทางเว็บได้รับการปรับปรุงอย่างมีนัยสำคัญโดย AgentLab แนะนำคุณสมบัติที่สำคัญหลายประการ: (1) การสนับสนุนสำหรับการทดลองแบบขนานโดยใช้ Browsergym, (2) การบูรณาการของมาตรฐานการนำทางเว็บยอดนิยม (เช่น Visualwebarena) ภายในกรอบการทำงานแบบครบวงจร เราขอแนะนำอย่างยิ่งให้ใช้เฟรมเวิร์กนี้สำหรับการทดลองของคุณ
# Python 3.10+
conda create -n webarena python=3.10 ; conda activate webarena
pip install -r requirements.txt
playwright install
pip install -e .
# optional, dev only
pip install -e " .[dev] "
mypy --install-types --non-interactive browser_env agents evaluation_harness
pip install pre-commit
pre-commit installตรวจสอบสคริปต์นี้เพื่อขอคำแนะนำอย่างรวดเร็วเกี่ยวกับวิธีการตั้งค่าสภาพแวดล้อมของเบราว์เซอร์และโต้ตอบกับมันโดยใช้เว็บไซต์สาธิตที่เราโฮสต์ สคริปต์นี้มีไว้เพื่อการศึกษาเพื่อทำการทดลองที่ ทำซ้ำได้ โปรดตรวจสอบส่วนถัดไป สรุปการใช้ WebArena นั้นคล้ายกับการใช้ OpenAI Gym ตัวอย่างโค้ดต่อไปนี้แสดงวิธีโต้ตอบกับสภาพแวดล้อม
from browser_env import ScriptBrowserEnv , create_id_based_action
# init the environment
env = ScriptBrowserEnv (
headless = False ,
observation_type = "accessibility_tree" ,
current_viewport_only = True ,
viewport_size = { "width" : 1280 , "height" : 720 },
)
# prepare the environment for a configuration defined in a json file
config_file = "config_files/0.json"
obs , info = env . reset ( options = { "config_file" : config_file })
# get the text observation (e.g., html, accessibility tree) through obs["text"]
# create a random action
id = random . randint ( 0 , 1000 )
action = create_id_based_action ( f"click [id]" )
# take the action
obs , _ , terminated , _ , info = env . step ( action )สำคัญ
เพื่อให้แน่ใจว่าการประเมินที่ถูกต้องโปรดตั้งค่าเว็บไซต์ WebArena ของคุณเองตามขั้นตอนที่ 1 และขั้นตอนที่ 2 เว็บไซต์สาธิตมีไว้สำหรับการท่องเว็บเพื่อช่วยให้คุณเข้าใจเนื้อหาได้ดีขึ้น หลังจากประเมินตัวอย่าง 812 ตัวอย่างให้รีเซ็ตสภาพแวดล้อมเป็นสถานะเริ่มต้นตามคำแนะนำที่นี่
ตั้งค่าสภาพแวดล้อมแบบสแตนด์อโลน โปรดตรวจสอบรายละเอียดหน้านี้
กำหนดค่า URL สำหรับแต่ละเว็บไซต์
export SHOPPING= " <your_shopping_site_domain>:7770 "
export SHOPPING_ADMIN= " <your_e_commerce_cms_domain>:7780/admin "
export REDDIT= " <your_reddit_domain>:9999 "
export GITLAB= " <your_gitlab_domain>:8023 "
export MAP= " <your_map_domain>:3000 "
export WIKIPEDIA= " <your_wikipedia_domain>:8888/wikipedia_en_all_maxi_2022-05/A/User:The_other_Kiwix_guy/Landing "
export HOMEPAGE= " <your_homepage_domain>:4399 " # this is a placeholderคุณได้รับการสนับสนุนให้อัปเดตตัวแปรสภาพแวดล้อมในเวิร์กโฟลว์ GitHub เพื่อให้แน่ใจว่าความถูกต้องของการทดสอบหน่วย
python scripts/generate_test_data.py คุณจะเห็นไฟล์ *.json ที่สร้างขึ้นในโฟลเดอร์ config_files แต่ละไฟล์มีการกำหนดค่าสำหรับตัวอย่างการทดสอบหนึ่งตัวอย่าง
mkdir -p ./.auth
python browser_env/auto_login.py
ส่งออก OPENAI_API_KEY=your_key คีย์ OpenAI API ที่ถูกต้องเริ่มต้นด้วย sk-
เปิดการประเมินผล
python run.py
--instruction_path agent/prompts/jsons/p_cot_id_actree_2s.json # this is the reasoning agent prompt we used in the paper
--test_start_idx 0
--test_end_idx 1
--model gpt-3.5-turbo
--result_dir < your_result_dir > สคริปต์นี้จะเรียกใช้ตัวอย่างแรกด้วยตัวแทนการให้เหตุผล GPT-3.5 วิถีจะถูกบันทึกไว้ใน <your_result_dir>/0.html
prompt = {
"intro" : < The overall guideline which includes the task description , available action , hint and others > ,
"examples" : [
(
example_1_observation ,
example_1_response
),
(
example_2_observation ,
example_2_response
),
...
],
"template" : < How to organize different information such as observation , previous action , instruction , url > ,
"meta_data" : {
"observation" : < Which observation space the agent uses > ,
"action_type" : < Which action space the agent uses > ,
"keywords" : < The keywords used in the template , the program will later enumerate all keywords in the template to see if all of them are correctly replaced with the content > ,
"prompt_constructor" : < Which prompt construtor is in used , the prompt constructor will construct the input feed to an LLM and extract the action from the generation , more details below > ,
"action_splitter" : < Inside which splitter can we extract the action , used by the prompt constructor >
}
}construct : สร้างอินพุตฟีดเป็น LLM_extract_action : ให้การสร้างจาก LLM วิธีการแยกวลีที่สอดคล้องกับการกระทำ หากคุณใช้สภาพแวดล้อมหรือข้อมูลของเราโปรดอ้างอิงบทความของเรา:
@article{zhou2023webarena,
title={WebArena: A Realistic Web Environment for Building Autonomous Agents},
author={Zhou, Shuyan and Xu, Frank F and Zhu, Hao and Zhou, Xuhui and Lo, Robert and Sridhar, Abishek and Cheng, Xianyi and Bisk, Yonatan and Fried, Daniel and Alon, Uri and others},
journal={arXiv preprint arXiv:2307.13854},
year={2023}
}