Browse Source

rename args

pull/2494/head
Eduardo Salinas 2 years ago
parent
commit
035659f944
6 changed files with 24 additions and 24 deletions
  1. +14
    -14
      autogen/agentchat/contrib/multimodal_web_surfer/multimodal_web_surfer.py
  2. +2
    -2
      samples/apps/try_orc/demo_orc_mmwebsurfer.py
  3. +2
    -2
      samples/apps/try_orc/mm_basic.py
  4. +2
    -2
      samples/multimodal_browser_chat.py
  5. +2
    -2
      samples/tools/autogenbench/scenarios/WebArena/Templates/Orchestrator/scenario.py
  6. +2
    -2
      samples/tools/autogenbench/scenarios/WebArena/Templates/TwoAgents/scenario.py

+ 14
- 14
autogen/agentchat/contrib/multimodal_web_surfer/multimodal_web_surfer.py View File

@@ -67,8 +67,8 @@ class MultimodalWebSurferAgent(ConversableAgent):
mlm_config: Optional[Union[Dict, Literal[False]]] = None, # TODO: Remove this
default_auto_reply: Optional[Union[str, Dict, None]] = "",
headless: bool = True,
chromium_channel=DEFAULT_CHANNEL,
chromium_data_dir: Optional[str] = None,
browser_channel=DEFAULT_CHANNEL,
browser_data_dir: Optional[str] = None,
start_page: Optional[str] = None,
debug_dir: Optional[str] = None,
):
@@ -87,8 +87,8 @@ class MultimodalWebSurferAgent(ConversableAgent):
llm_config: The configuration for the LLM.
default_auto_reply: The default auto-reply.
headless: Whether to run the browser in headless mode.
chromium_channel: The Chromium channel to use.
chromium_data_dir: The Chromium data directory. If None, a new context is created.
browser_channel: The Chromium channel to use.
browser_data_dir: The Chromium data directory. If None, a new context is created.
start_page: The start page for the browser.
debug_dir: The directory to store debug information. TODO: Clarify behavior on None.
"""
@@ -111,28 +111,28 @@ class MultimodalWebSurferAgent(ConversableAgent):

# Create the playwright instance
launch_args = {"headless": headless}
if chromium_channel is not DEFAULT_CHANNEL:
launch_args["channel"] = chromium_channel
if browser_channel is not DEFAULT_CHANNEL:
launch_args["channel"] = browser_channel
self._playwright = sync_playwright().start()

# Create the context -- are we launching a persistent instance?
if chromium_data_dir is None:
if chromium_channel == "chromium":
if browser_data_dir is None:
if browser_channel == "chromium":
browser = self._playwright.chromium.launch(**launch_args)
elif chromium_channel == "firefox":
elif browser_channel == "firefox":
browser = self._playwright.firefox.launch(**launch_args)
else:
raise NotImplementedError(
f"Invalid chromium channel {chromium_channel}. Only chromium and firefox are supported."
f"Invalid chromium channel {browser_channel}. Only chromium and firefox are supported."
)
self._context = browser.new_context(
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0"
)
else:
if chromium_channel == "chromium":
self._context = self._playwright.chromium.launch_persistent_context(chromium_data_dir, **launch_args)
elif chromium_channel == "firefox":
self._context = self._playwright.firefox.launch_persistent_context(chromium_data_dir, **launch_args)
if browser_channel == "chromium":
self._context = self._playwright.chromium.launch_persistent_context(browser_data_dir, **launch_args)
elif browser_channel == "firefox":
self._context = self._playwright.firefox.launch_persistent_context(browser_data_dir, **launch_args)

# Create the page
self._page = self._context.new_page()


+ 2
- 2
samples/apps/try_orc/demo_orc_mmwebsurfer.py View File

@@ -39,8 +39,8 @@ web_surfer = MultimodalWebSurferAgent(
is_termination_msg=lambda x: str(x).find("TERMINATE") >= 0 or str(x).find("FINAL ANSWER") >= 0,
human_input_mode="NEVER",
headless=True,
chromium_channel="chromium",
chromium_data_dir=None,
browser_channel="chromium",
browser_data_dir=None,
start_page="https://bing.com",
debug_dir=os.path.join(os.path.dirname(__file__), "debug"),
)


+ 2
- 2
samples/apps/try_orc/mm_basic.py View File

@@ -14,8 +14,8 @@ web_surfer = MultimodalWebSurferAgent(
is_termination_msg=lambda x: str(x).find("TERMINATE") >= 0 or str(x).find("FINAL ANSWER") >= 0,
human_input_mode="NEVER",
headless=True,
chromium_channel="chromium",
chromium_data_dir=None,
browser_channel="chromium",
browser_data_dir=None,
start_page="https://bing.com",
debug_dir=os.path.join(os.path.dirname(__file__), "debug"),
)


+ 2
- 2
samples/multimodal_browser_chat.py View File

@@ -18,8 +18,8 @@ def main():
llm_config={"config_list": llm_config_list},
is_termination_msg=lambda x: x.get("content", "").rstrip().find("TERMINATE") >= 0,
headless=True,
chromium_channel="chromium",
chromium_data_dir=None,
browser_channel="chromium",
browser_data_dir=None,
start_page="https://www.bing.com/",
debug_dir=os.path.join(os.getcwd(), "debug"),
)


+ 2
- 2
samples/tools/autogenbench/scenarios/WebArena/Templates/Orchestrator/scenario.py View File

@@ -76,8 +76,8 @@ web_surfer = MultimodalWebSurferAgent(
is_termination_msg=lambda x: str(x).find("TERMINATE") >= 0 or str(x).find("FINAL ANSWER") >= 0,
human_input_mode="NEVER",
headless=True,
chromium_channel="chromium",
chromium_data_dir=None,
browser_channel="chromium",
browser_data_dir=None,
start_page="https://bing.com",
debug_dir=os.path.join(os.path.dirname(__file__), "debug"),
)


+ 2
- 2
samples/tools/autogenbench/scenarios/WebArena/Templates/TwoAgents/scenario.py View File

@@ -55,8 +55,8 @@ web_surfer = MultimodalWebSurferAgent(
is_termination_msg=lambda x: str(x).find("TERMINATE") >= 0 or str(x).find("FINAL ANSWER") >= 0,
human_input_mode="NEVER",
headless=True,
chromium_channel="chromium",
chromium_data_dir=None,
browser_channel="chromium",
browser_data_dir=None,
start_page=HOMEPAGE,
debug_dir=os.getenv("WEB_SURFER_DEBUG_DIR", None),
)


Loading…
Cancel
Save