You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mm_basic.py 1.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import os
  2. from autogen.agentchat.contrib.multimodal_web_surfer import MultimodalWebSurferAgent
  3. from autogen.agentchat.contrib.mmagent import MultimodalAgent
  4. from config_manager import ConfigManager
  5. config = ConfigManager()
  6. config.initialize()
  7. web_surfer = MultimodalWebSurferAgent(
  8. "web_surfer",
  9. llm_config=config.llm_config,
  10. is_termination_msg=lambda x: str(x).find("TERMINATE") >= 0 or str(x).find("FINAL ANSWER") >= 0,
  11. human_input_mode="NEVER",
  12. headless=True,
  13. chromium_channel="chromium",
  14. chromium_data_dir=None,
  15. start_page="https://bing.com",
  16. debug_dir=os.path.join(os.path.dirname(__file__), "debug"),
  17. )
  18. user_proxy = MultimodalAgent(
  19. "user_proxy",
  20. system_message="""You are a general-purpose AI assistant and can handle many questions -- but you don't have access to a web browser. However, the user you are talking to does have a browser, and you can see the screen. Provide short direct instructions to them to take you where you need to go to answer the initial question posed to you.
  21. Once the user has taken the final necessary action to complete the task, and you have fully addressed the initial request, reply with the word TERMINATE.""",
  22. llm_config=config.llm_config,
  23. human_input_mode="NEVER",
  24. is_termination_msg=lambda x: False,
  25. max_consecutive_auto_reply=20,
  26. )
  27. task = input("Enter the task: ")
  28. web_surfer.initiate_chat(
  29. user_proxy,
  30. message=task,
  31. clear_history=True,
  32. )