diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c02e7bc2eccd..aa6311b7fbd0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,6 +40,7 @@ jobs: run: | python -m pip install --upgrade pip wheel pip install -e . + pip install -e .[test,websurfer] python -c "import autogen" pip install pytest mock - name: Install optional dependencies for code executors diff --git a/autogen/agentchat/contrib/web_surfer.py b/autogen/agentchat/contrib/web_surfer.py index 9b7320f092fe..b8d7e322c4c7 100644 --- a/autogen/agentchat/contrib/web_surfer.py +++ b/autogen/agentchat/contrib/web_surfer.py @@ -1,4 +1,3 @@ -import json import copy import logging import re @@ -6,7 +5,7 @@ from typing import Any, Dict, List, Optional, Union, Callable, Literal, Tuple from typing_extensions import Annotated from ... import Agent, ConversableAgent, AssistantAgent, UserProxyAgent, GroupChatManager, GroupChat, OpenAIWrapper -from ...browser_utils import SimpleTextBrowser +from ...browser_utils import SimpleTextBrowser, HeadlessChromeBrowser from ...code_utils import content_str from datetime import datetime from ...token_count_utils import count_token, get_max_token_limit @@ -16,7 +15,10 @@ class WebSurferAgent(ConversableAgent): - """(In preview) An agent that acts as a basic web surfer that can search the web and visit web pages.""" + """(In preview) An agent that acts as a basic web surfer that can search the web and visit web pages. + Defaults to a simple text-based browser. + Can be configured to use a headless Chrome browser by providing a browser_config dictionary with the key "headless" set to True. + """ DEFAULT_PROMPT = ( "You are a helpful AI assistant with access to a web browser (via the provided functions). In fact, YOU ARE THE ONLY MEMBER OF YOUR PARTY WITH ACCESS TO A WEB BROWSER, so please help out where you can by performing web searches, navigating pages, and reporting what you find. Today's date is " @@ -56,8 +58,12 @@ def __init__( self._create_summarizer_client(summarizer_llm_config, llm_config) # Create the browser - self.browser = SimpleTextBrowser(**(browser_config if browser_config else {})) - + headless = browser_config.pop("headless", False) + self.browser = ( + SimpleTextBrowser(**(browser_config if browser_config else {})) + if not headless + else HeadlessChromeBrowser(**browser_config) + ) inner_llm_config = copy.deepcopy(llm_config) # Set up the inner monologue @@ -124,7 +130,7 @@ def _browser_state() -> Tuple[str, str]: current_page = self.browser.viewport_current_page total_pages = len(self.browser.viewport_pages) - header += f"Viewport position: Showing page {current_page+1} of {total_pages}.\n" + header += f"Viewport position: Showing page {current_page + 1} of {total_pages}.\n" return (header, self.browser.viewport) @self._user_proxy.register_for_execution() @@ -145,7 +151,7 @@ def _informational_search(query: Annotated[str, "The informational web search qu def _navigational_search(query: Annotated[str, "The navigational web search query to perform."]) -> str: self.browser.visit_page(f"bing: {query}") - # Extract the first linl + # Extract the first link m = re.search(r"\[.*?\]\((http.*?)\)", self.browser.page_content) if m: self.browser.visit_page(m.group(1)) diff --git a/autogen/browser_utils/__init__.py b/autogen/browser_utils/__init__.py new file mode 100644 index 000000000000..cc89c8e7ec25 --- /dev/null +++ b/autogen/browser_utils/__init__.py @@ -0,0 +1,7 @@ +from .simple_text_browser import SimpleTextBrowser +from .headless_chrome_browser import HeadlessChromeBrowser + +__all__ = ( + "SimpleTextBrowser", + "HeadlessChromeBrowser", +) diff --git a/autogen/browser_utils/abstract_browser.py b/autogen/browser_utils/abstract_browser.py new file mode 100644 index 000000000000..123f5fb9863e --- /dev/null +++ b/autogen/browser_utils/abstract_browser.py @@ -0,0 +1,48 @@ +from abc import ABC, abstractmethod +from typing import Optional, Union, Dict + + +class AbstractBrowser(ABC): + """An abstract class for a web browser.""" + + @abstractmethod + def __init__( + self, + start_page: Optional[str] = "about:blank", + viewport_size: Optional[int] = 1024 * 8, + downloads_folder: Optional[Union[str, None]] = None, + bing_api_key: Optional[Union[str, None]] = None, + request_kwargs: Optional[Union[Dict, None]] = None, + ): + pass + + @property + @abstractmethod + def address(self) -> str: + pass + + @abstractmethod + def set_address(self, uri_or_path): + pass + + @property + @abstractmethod + def viewport(self) -> str: + pass + + @property + @abstractmethod + def page_content(self) -> str: + pass + + @abstractmethod + def page_down(self): + pass + + @abstractmethod + def page_up(self): + pass + + @abstractmethod + def visit_page(self, path_or_uri): + pass diff --git a/autogen/browser_utils/headless_chrome_browser.py b/autogen/browser_utils/headless_chrome_browser.py new file mode 100644 index 000000000000..240243b28cee --- /dev/null +++ b/autogen/browser_utils/headless_chrome_browser.py @@ -0,0 +1,150 @@ +import re + +from bs4 import BeautifulSoup +import markdownify +from selenium import webdriver +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.common.by import By +from typing import Optional, Union, Dict + +from autogen.browser_utils.abstract_browser import AbstractBrowser + +# Optional PDF support +IS_PDF_CAPABLE = False +try: + import pdfminer + import pdfminer.high_level + + IS_PDF_CAPABLE = True +except ModuleNotFoundError: + pass + +# Other optional dependencies +try: + import pathvalidate +except ModuleNotFoundError: + pass + + +class HeadlessChromeBrowser(AbstractBrowser): + """(In preview) A Selenium powered headless Chrome browser. Suitable for Agentic use.""" + + def __init__( + self, + start_page: Optional[str] = "about:blank", + viewport_size: Optional[int] = 1024 * 8, + downloads_folder: Optional[Union[str, None]] = None, + bing_api_key: Optional[Union[str, None]] = None, + request_kwargs: Optional[Union[Dict, None]] = None, + ): + self.start_page = start_page + self.driver = None + self.viewport_size = viewport_size # Applies only to the standard uri types + self.downloads_folder = downloads_folder + self.history = list() + self.page_title = None + self.viewport_current_page = 0 + self.viewport_pages = list() + self.bing_api_key = bing_api_key + self.request_kwargs = request_kwargs + self._page_content = "" + + self._start_browser() + + def _start_browser(self): + chrome_options = Options() + chrome_options.add_argument("--headless") + self.driver = webdriver.Chrome(options=chrome_options) + self.driver.implicitly_wait(99) + self.driver.get(self.start_page) + + @property + def address(self) -> str: + return self.driver.current_url + + def set_address(self, uri_or_path): + if uri_or_path.startswith("bing:"): + self._bing_search(uri_or_path[len("bing:") :].strip()) + else: + self.driver.get(uri_or_path) + + @property + def viewport(self) -> str: + """Return the content of the current viewport.""" + if not self.viewport_pages: + return "" + bounds = self.viewport_pages[self.viewport_current_page] + return self._page_content[bounds[0] : bounds[1]] + + @property + def page_content(self) -> str: + """Return the full contents of the current page.""" + return self._page_content + + def _set_page_content(self, content) -> str: + """Sets the text content of the current page.""" + self._page_content = content + self._split_pages() + if self.viewport_current_page >= len(self.viewport_pages): + self.viewport_current_page = len(self.viewport_pages) - 1 + + def _split_pages(self): + # Split only regular pages + if not self.address.startswith("http:") and not self.address.startswith("https:"): + return + + # Handle empty pages + if len(self._page_content) == 0: + self.viewport_pages = [(0, 0)] + return + + # Break the viewport into pages + self.viewport_pages = [] + start_idx = 0 + while start_idx < len(self._page_content): + end_idx = min(start_idx + self.viewport_size, len(self._page_content)) + self.viewport_pages.append((start_idx, end_idx)) + start_idx = end_idx + + def _process_html(self, html: str, is_search: bool) -> str: + """Process the raw HTML content and return the processed text.""" + soup = BeautifulSoup(html, "html.parser") + + # Remove javascript and style blocks + for script in soup(["script", "style"]): + script.extract() + + # Convert to text + converter = markdownify.MarkdownConverter() + text = converter.convert_soup(soup) if not is_search else converter.convert_soup(soup.find("main")) + + # Remove excessive blank lines + text = re.sub(r"\n{2,}", "\n\n", text).strip() + + return text + + def _bing_search(self, query): + self.driver.get("https://www.bing.com") + + search_bar = self.driver.find_element(By.NAME, "q") + search_bar.clear() + search_bar.send_keys(query) + search_bar.submit() + + def page_down(self): + """Move the viewport one page down.""" + if self.viewport_current_page < len(self.viewport_pages) - 1: + self.viewport_current_page += 1 + + def page_up(self): + """Move the viewport one page up.""" + if self.viewport_current_page > 0: + self.viewport_current_page -= 1 + + def visit_page(self, path_or_uri): + """Update the address, visit the page, and return the content of the viewport.""" + is_search = path_or_uri.startswith("bing:") + self.set_address(path_or_uri) + html = self.driver.execute_script("return document.body.innerHTML;") + self._set_page_content(self._process_html(html, is_search)) + return self.viewport diff --git a/autogen/browser_utils.py b/autogen/browser_utils/simple_text_browser.py similarity index 90% rename from autogen/browser_utils.py rename to autogen/browser_utils/simple_text_browser.py index 41d2d62f825b..8c13f6d1e283 100644 --- a/autogen/browser_utils.py +++ b/autogen/browser_utils/simple_text_browser.py @@ -1,14 +1,16 @@ -import json +import io +import mimetypes import os -import requests import re -import markdownify -import io +from typing import Optional, Union, Dict import uuid -import mimetypes from urllib.parse import urljoin, urlparse + +import markdownify +import requests from bs4 import BeautifulSoup -from typing import Any, Dict, List, Optional, Union, Tuple + +from autogen.browser_utils.abstract_browser import AbstractBrowser # Optional PDF support IS_PDF_CAPABLE = False @@ -27,25 +29,25 @@ pass -class SimpleTextBrowser: +class SimpleTextBrowser(AbstractBrowser): """(In preview) An extremely simple text-based web browser comparable to Lynx. Suitable for Agentic use.""" def __init__( self, - start_page: Optional[str] = None, + start_page: Optional[str] = "about:blank", viewport_size: Optional[int] = 1024 * 8, downloads_folder: Optional[Union[str, None]] = None, bing_api_key: Optional[Union[str, None]] = None, - request_kwargs: Optional[Union[Dict[str, Any], None]] = None, + request_kwargs: Optional[Union[Dict, None]] = None, ): - self.start_page: str = start_page if start_page else "about:blank" + self.start_page = start_page self.viewport_size = viewport_size # Applies only to the standard uri types self.downloads_folder = downloads_folder - self.history: List[str] = list() - self.page_title: Optional[str] = None + self.history = list() + self.page_title = None self.viewport_current_page = 0 - self.viewport_pages: List[Tuple[int, int]] = list() - self.set_address(self.start_page) + self.viewport_pages = list() + self.set_address(start_page) self.bing_api_key = bing_api_key self.request_kwargs = request_kwargs @@ -56,7 +58,7 @@ def address(self) -> str: """Return the address of the current page.""" return self.history[-1] - def set_address(self, uri_or_path: str) -> None: + def set_address(self, uri_or_path): self.history.append(uri_or_path) # Handle special URIs @@ -83,25 +85,25 @@ def page_content(self) -> str: """Return the full contents of the current page.""" return self._page_content - def _set_page_content(self, content: str) -> None: + def _set_page_content(self, content) -> str: """Sets the text content of the current page.""" self._page_content = content self._split_pages() if self.viewport_current_page >= len(self.viewport_pages): self.viewport_current_page = len(self.viewport_pages) - 1 - def page_down(self) -> None: + def page_down(self): self.viewport_current_page = min(self.viewport_current_page + 1, len(self.viewport_pages) - 1) - def page_up(self) -> None: + def page_up(self): self.viewport_current_page = max(self.viewport_current_page - 1, 0) - def visit_page(self, path_or_uri: str) -> str: + def visit_page(self, path_or_uri): """Update the address, visit the page, and return the content of the viewport.""" self.set_address(path_or_uri) return self.viewport - def _split_pages(self) -> None: + def _split_pages(self): # Split only regular pages if not self.address.startswith("http:") and not self.address.startswith("https:"): self.viewport_pages = [(0, len(self._page_content))] @@ -116,14 +118,14 @@ def _split_pages(self) -> None: self.viewport_pages = [] start_idx = 0 while start_idx < len(self._page_content): - end_idx = min(start_idx + self.viewport_size, len(self._page_content)) # type: ignore[operator] + end_idx = min(start_idx + self.viewport_size, len(self._page_content)) # Adjust to end on a space while end_idx < len(self._page_content) and self._page_content[end_idx - 1] not in [" ", "\t", "\r", "\n"]: end_idx += 1 self.viewport_pages.append((start_idx, end_idx)) start_idx = end_idx - def _bing_api_call(self, query: str) -> Dict[str, Dict[str, List[Dict[str, Union[str, Dict[str, str]]]]]]: + def _bing_api_call(self, query): # Make sure the key was set if self.bing_api_key is None: raise ValueError("Missing Bing API key.") @@ -148,12 +150,12 @@ def _bing_api_call(self, query: str) -> Dict[str, Dict[str, List[Dict[str, Union response.raise_for_status() results = response.json() - return results # type: ignore[no-any-return] + return results - def _bing_search(self, query: str) -> None: + def _bing_search(self, query): results = self._bing_api_call(query) - web_snippets: List[str] = list() + web_snippets = list() idx = 0 for page in results["webPages"]["value"]: idx += 1 @@ -162,7 +164,7 @@ def _bing_search(self, query: str) -> None: for dl in page["deepLinks"]: idx += 1 web_snippets.append( - f"{idx}. [{dl['name']}]({dl['url']})\n{dl['snippet'] if 'snippet' in dl else ''}" # type: ignore[index] + f"{idx}. [{dl['name']}]({dl['url']})\n{dl['snippet'] if 'snippet' in dl else ''}" ) news_snippets = list() @@ -181,7 +183,7 @@ def _bing_search(self, query: str) -> None: content += "\n\n## News Results:\n" + "\n\n".join(news_snippets) self._set_page_content(content) - def _fetch_page(self, url: str) -> None: + def _fetch_page(self, url): try: # Prepare the request parameters request_kwargs = self.request_kwargs.copy() if self.request_kwargs is not None else {} diff --git a/notebook/agentchat_surfer.ipynb b/notebook/agentchat_surfer.ipynb index dcbe6ee66bc2..6eda31873594 100644 --- a/notebook/agentchat_surfer.ipynb +++ b/notebook/agentchat_surfer.ipynb @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -60,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -101,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -122,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": { "scrolled": true }, @@ -159,7 +159,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -183,41 +183,48 @@ "Title: Microsoft AutoGen - Search\n", "Viewport position: Showing page 1 of 1.\n", "=======================\n", - "A Bing search for 'Microsoft AutoGen' found 10 results:\n", + "A Bing search for 'Microsoft AutoGen' found 9 results:\n", "\n", "## Web Results\n", "1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\n", "AutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\n", "\n", - "2. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\n", - "AutoGen is a Python library that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports various conversation patterns, enhanced LLM inference, and customizable and conversable agents based on OpenAI models.\n", - "\n", - "3. [Getting Started | AutoGen](https://microsoft.github.io/autogen/docs/Getting-Started/)\n", - "AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools. Main Features\n", + "2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\n", + "AutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\n", "\n", - "4. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\n", - "AutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\n", + "3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\n", + "AutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\n", "\n", - "5. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\n", - "AutoGen is an open-source library for building next-generation LLM applications with multiple agents, teachability and personalization. It supports agents that can be backed by various LLM configurations, code generation and execution, and human proxy agent integration.\n", + "4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\n", + "AutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\n", "\n", - "6. [Installation | AutoGen](https://microsoft.github.io/autogen/docs/Installation/)\n", - "Installation Setup Virtual Environment When not using a docker container, we recommend using a virtual environment to install AutoGen. This will ensure that the dependencies for AutoGen are isolated from the rest of your system. Option 1: venv You can create a virtual environment with venv as below: python3 -m venv pyautogen\n", + "5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\n", + "Getting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\n", "\n", - "7. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\n", - "AutoGen allows developers to build LLM applications via multiple agents that can converse with each other to accomplish tasks.\n", + "6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\n", + "AutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\n", "\n", - "8. [Multi-agent Conversation Framework | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat/)\n", - "AutoGen offers a unified multi-agent conversation framework as a high-level abstraction of using foundation models. It features capable, customizable and conversable agents which integrate LLMs, tools, and humans via automated agent chat.\n", + "7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\n", + "AutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\n", "\n", - "9. [[2308.08155] AutoGen: Enabling Next-Gen LLM Applications via Multi ...](https://arxiv.org/abs/2308.08155)\n", - "AutoGen is an open-source framework that allows developers to create and customize agents that can converse with each other to perform tasks using various types of language models (LLMs). The framework supports natural language and code-based conversation patterns, and is effective for diverse applications such as mathematics, coding, question answering, and more.\n", + "8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\n", + "AutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\n", "\n", - "10. [How to setup and use the new Microsoft AutoGen AI agent](https://www.geeky-gadgets.com/microsoft-autogen/)\n", - "Learn how to use AutoGen, a tool that simplifies the automation and optimization of complex language model applications using multiple agents that can converse with each other. AutoGen supports diverse conversation patterns, human participation, and the tuning of expensive LLMs like ChatGPT and GPT-4.\n", + "9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\n", + "To help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\n", "\n", "--------------------------------------------------------------------------------\n" ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': \"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", 'role': 'user'}], summary=\"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -230,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -248,10 +255,22 @@ ">>>>>>>> EXECUTING FUNCTION summarize_page...\u001b[0m\n", "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n", "\n", - "AutoGen is a Python package and framework developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables the development of customizable and conversable agents that can solve tasks using advanced LLMs like GPT-4. AutoGen supports various conversation patterns, enhanced LLM inference, and seamless integration with humans, tools, and other agents. It offers a high-level abstraction for building diverse and enhanced LLM workflows and provides a collection of working systems for different domains and complexities. AutoGen is open-source and supports natural language and code-based conversation patterns for applications such as question answering, coding, mathematics, and more.\n", + "A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\n", + "\n", + "Overall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\n", "\n", "--------------------------------------------------------------------------------\n" ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': \"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': \"A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\\n\\nOverall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\", 'role': 'user'}], summary=\"A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\\n\\nOverall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\", cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -261,7 +280,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -285,13 +304,18 @@ "=======================\n", "Getting Started | AutoGen\n", "\n", - "[Skip to main content](#)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)Resources* [Ecosystem](/autogen/docs/Ecosystem)\n", + "[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\n", "* [Gallery](/autogen/docs/Gallery)\n", - "[GitHub](https://github.com/microsoft/autogen)🌜🌞`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\n", - "* [Installation](/autogen/docs/Installation)\n", - "* [Use Cases](#)\n", + "[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\n", + "[GitHub](https://github.com/microsoft/autogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\n", + "* [Installation](/autogen/docs/installation/)\n", + "* [LLM Configuration](/autogen/docs/llm_configuration)\n", + "* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\n", "* [Contributing](/autogen/docs/Contribute)\n", "* [Research](/autogen/docs/Research)\n", + "* [Migration Guide](/autogen/docs/Migration-Guide)\n", + "* \n", + "* Getting Started\n", "On this pageGetting Started\n", "===============\n", "\n", @@ -299,7 +323,7 @@ "\n", "![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\n", "\n", - "### Main Features[​](#main-features \"Direct link to heading\")\n", + "### Main Features[​](#main-features \"Direct link to Main Features\")\n", "\n", "* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\n", "* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\n", @@ -309,12 +333,12 @@ "\n", "AutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\n", "\n", - "### Quickstart[​](#quickstart \"Direct link to heading\")\n", + "### Quickstart[​](#quickstart \"Direct link to Quickstart\")\n", "\n", - "Install from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/Installation).\n", + "Install from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\n", "For [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\n", "\n", - "#### Multi-Agent Conversation Framework[​](#multi-agent-conversation-framework \"Direct link to heading\")\n", + "#### Multi-Agent Conversation Framework[​](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\n", "\n", "Autogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\n", "By automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\n", @@ -324,14 +348,20 @@ " \n", "# Load LLM inference endpoints from an env variable or a file \n", "# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints \n", - "# and OAI\\_CONFIG\\_LIST\\_sample.json \n", - "config\\_list = config\\_list\\_from\\_json(env\\_or\\_file=\"OAI\\_CONFIG\\_LIST\") \n", - "assistant = AssistantAgent(\"assistant\", llm\\_config={\"config\\_list\": config\\_list}) \n", - "user\\_proxy = UserProxyAgent(\"user\\_proxy\", code\\_execution\\_config={\"work\\_dir\": \"coding\"}) \n", - "user\\_proxy.initiate\\_chat(assistant, \n", + "# and OAI\\_CONFIG\\_LIST\\_sample.json \n", "\n", "--------------------------------------------------------------------------------\n" ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': \"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': \"A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\\n\\nOverall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\", 'role': 'user'}, {'content': \"Click the 'Getting Started' result\", 'role': 'assistant'}, {'content': 'Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nTitle: Getting Started | AutoGen\\nViewport position: Showing page 1 of 2.\\n=======================\\nGetting Started | AutoGen\\n\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\\n\\n```\\nfrom autogen import AssistantAgent, UserProxyAgent, config\\\\_list\\\\_from\\\\_json \\n \\n# Load LLM inference endpoints from an env variable or a file \\n# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints \\n# and OAI\\\\_CONFIG\\\\_LIST\\\\_sample.json ', 'role': 'user'}], summary='Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nTitle: Getting Started | AutoGen\\nViewport position: Showing page 1 of 2.\\n=======================\\nGetting Started | AutoGen\\n\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\\n\\n```\\nfrom autogen import AssistantAgent, UserProxyAgent, config\\\\_list\\\\_from\\\\_json \\n \\n# Load LLM inference endpoints from an env variable or a file \\n# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints \\n# and OAI\\\\_CONFIG\\\\_LIST\\\\_sample.json ', cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -351,7 +381,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -371,7 +401,7 @@ "\n", "Address: https://en.wikipedia.org/wiki/Microsoft\n", "Title: Microsoft - Wikipedia\n", - "Viewport position: Showing page 1 of 64.\n", + "Viewport position: Showing page 1 of 66.\n", "=======================\n", "# Microsoft\n", "\n", @@ -379,7 +409,7 @@ "\n", "Microsoft Corporation| [A square divided into four sub-squares, colored red-orange, green, yellow and blue (clockwise), with the company name appearing to its right](/wiki/File:Microsoft_logo_(2012).svg) |\n", "| Building 92 on the [Microsoft Redmond campus](/wiki/Microsoft_Redmond_campus \"Microsoft Redmond campus\") |\n", - "| Type | [Public](/wiki/Public_company \"Public company\") |\n", + "| Company type | [Public](/wiki/Public_company \"Public company\") |\n", "| [Traded as](/wiki/Ticker_symbol \"Ticker symbol\") | * [Nasdaq](/wiki/Nasdaq \"Nasdaq\"): [MSFT](https://www.nasdaq.com/market-activity/stocks/msft)\n", "* [Nasdaq-100](/wiki/Nasdaq-100 \"Nasdaq-100\") component\n", "* [DJIA](/wiki/Dow_Jones_Industrial_Average \"Dow Jones Industrial Average\") component\n", @@ -392,11 +422,11 @@ "| Founders | * [Bill Gates](/wiki/Bill_Gates \"Bill Gates\")\n", "* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\n", " |\n", - "| Headquarters | [One Microsoft Way](/wiki/Microsoft_campus \"Microsoft campus\")[Redmond, Washington](/wiki/Redmond,_Washington \"Redmond, Washington\"), U.S. |\n", + "| Headquarters | [One Microsoft Way](/wiki/One_Microsoft_Way \"One Microsoft Way\"), [Redmond, Washington](/wiki/Redmond,_Washington \"Redmond, Washington\"), U.S. |\n", "| Area served | Worldwide |\n", "| Key people | * [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\")([Chairman](/wiki/Chairman \"Chairman\") & [CEO](/wiki/Chief_executive_officer \"Chief executive officer\"))\n", "* [Brad Smith](/wiki/Brad_Smith_(American_lawyer) \"Brad Smith (American lawyer)\")([Vice Chairman](/wiki/Vice-Chairman \"Vice-Chairman\") & [President](/wiki/President_(corporate_title) \"President (corporate title)\"))\n", - "* [Bill Gates](/wiki/Bill_Gates \"Bill Gates\")([technical adviser](/wiki/Adviser \"Adviser\"))\n", + "* Bill Gates([technical adviser](/wiki/Adviser \"Adviser\"))\n", " |\n", "| Products | * [Software development](/wiki/Software_development \"Software development\")\n", "* [Computer hardware](/wiki/Computer_hardware \"Computer hardware\")\n", @@ -437,10 +467,20 @@ "| [Operating income](/wiki/Earnings_before_interest_and_taxes \"Earnings before interest and taxes\") | Increase US$88.5 billion (2023) |\n", "| [Net income](/wiki/Net_income \"Net income\") | Increase US$73.4 billion (2023) |\n", "| [Total assets](/wiki/Asset \"Asset\") | Increase US$411.9 billion (2023) |\n", - "| [Total equity](/wiki/Equity_(finance) \"Equity \n", + "| [Total equity](/wiki/Equity_(finance) \"Equity (finance)\") | Increase \n", "\n", "--------------------------------------------------------------------------------\n" ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': \"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': \"A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\\n\\nOverall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\", 'role': 'user'}, {'content': \"Click the 'Getting Started' result\", 'role': 'assistant'}, {'content': 'Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nTitle: Getting Started | AutoGen\\nViewport position: Showing page 1 of 2.\\n=======================\\nGetting Started | AutoGen\\n\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\\n\\n```\\nfrom autogen import AssistantAgent, UserProxyAgent, config\\\\_list\\\\_from\\\\_json \\n \\n# Load LLM inference endpoints from an env variable or a file \\n# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints \\n# and OAI\\\\_CONFIG\\\\_LIST\\\\_sample.json ', 'role': 'user'}, {'content': \"Find Microsoft's Wikipedia page.\", 'role': 'assistant'}, {'content': 'Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 1 of 66.\\n=======================\\n# Microsoft\\n\\nAmerican multinational technology corporation\\n\\nMicrosoft Corporation| [A square divided into four sub-squares, colored red-orange, green, yellow and blue (clockwise), with the company name appearing to its right](/wiki/File:Microsoft_logo_(2012).svg) |\\n| Building 92 on the [Microsoft Redmond campus](/wiki/Microsoft_Redmond_campus \"Microsoft Redmond campus\") |\\n| Company type | [Public](/wiki/Public_company \"Public company\") |\\n| [Traded as](/wiki/Ticker_symbol \"Ticker symbol\") | * [Nasdaq](/wiki/Nasdaq \"Nasdaq\"):\\xa0[MSFT](https://www.nasdaq.com/market-activity/stocks/msft)\\n* [Nasdaq-100](/wiki/Nasdaq-100 \"Nasdaq-100\") component\\n* [DJIA](/wiki/Dow_Jones_Industrial_Average \"Dow Jones Industrial Average\") component\\n* [S&P 100](/wiki/S%26P_100 \"S&P 100\") component\\n* [S&P 500](/wiki/S%26P_500 \"S&P 500\") component\\n |\\n| [ISIN](/wiki/International_Securities_Identification_Number \"International Securities Identification Number\") | [US5949181045](https://isin.toolforge.org/?language=en&isin=US5949181045) |\\n| Industry | [Information technology](/wiki/Information_technology \"Information technology\") |\\n| Founded | April\\xa04, 1975; 48 years ago\\xa0(1975-04-04) in [Albuquerque, New Mexico](/wiki/Albuquerque,_New_Mexico \"Albuquerque, New Mexico\"), U.S. |\\n| Founders | * [Bill Gates](/wiki/Bill_Gates \"Bill Gates\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n |\\n| Headquarters | [One Microsoft Way](/wiki/One_Microsoft_Way \"One Microsoft Way\"), [Redmond, Washington](/wiki/Redmond,_Washington \"Redmond, Washington\"), U.S. |\\n| Area served | Worldwide |\\n| Key people | * [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\")([Chairman](/wiki/Chairman \"Chairman\") & [CEO](/wiki/Chief_executive_officer \"Chief executive officer\"))\\n* [Brad Smith](/wiki/Brad_Smith_(American_lawyer) \"Brad Smith (American lawyer)\")([Vice Chairman](/wiki/Vice-Chairman \"Vice-Chairman\") & [President](/wiki/President_(corporate_title) \"President (corporate title)\"))\\n* Bill Gates([technical adviser](/wiki/Adviser \"Adviser\"))\\n |\\n| Products | * [Software development](/wiki/Software_development \"Software development\")\\n* [Computer hardware](/wiki/Computer_hardware \"Computer hardware\")\\n* [Consumer electronics](/wiki/Consumer_electronics \"Consumer electronics\")\\n* [Social networking service](/wiki/Social_networking_service \"Social networking service\")\\n* [Cloud computing](/wiki/Cloud_computing \"Cloud computing\")\\n* [Video games](/wiki/Video_game_industry \"Video game industry\")\\n* [Internet](/wiki/Internet \"Internet\")\\n* [Corporate venture capital](/wiki/Corporate_venture_capital \"Corporate venture capital\")\\n |\\n| Brands | \\n* [Windows](/wiki/Microsoft_Windows \"Microsoft Windows\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [Skype](/wiki/Skype \"Skype\")\\n* [Visual Studio](/wiki/Visual_Studio \"Visual Studio\")\\n* [Xbox](/wiki/Xbox \"Xbox\")\\n* [Dynamics](/wiki/Microsoft_Dynamics_365 \"Microsoft Dynamics 365\")\\n* [Surface](/wiki/Microsoft_Surface \"Microsoft Surface\")\\n\\n |\\n| Services | \\n* [Edge](/wiki/Microsoft_Edge \"Microsoft Edge\")\\n* [Azure](/wiki/Microsoft_Azure \"Microsoft Azure\")\\n* [Bing](/wiki/Microsoft_Bing \"Microsoft Bing\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Yammer](/wiki/Yammer \"Yammer\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [OneDrive](/wiki/OneDrive \"OneDrive\")\\n* [Outlook](/wiki/Microsoft_Outlook \"Microsoft Outlook\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [Microsoft Store](/wiki/Microsoft_Store_(digital) \"Microsoft Store (digital)\")\\n* [Windows Update](/wiki/Windows_Update \"Windows Update\")\\n* [Xbox Game Pass](/wiki/Xbox_Game_Pass \"Xbox Game Pass\")\\n* [Xbox network](/wiki/Xbox_network \"Xbox network\")\\n\\n |\\n| Revenue | Increase [US$](/wiki/United_States_dollar \"United States dollar\")211.9 billion (2023) |\\n| [Operating income](/wiki/Earnings_before_interest_and_taxes \"Earnings before interest and taxes\") | Increase US$88.5 billion (2023) |\\n| [Net income](/wiki/Net_income \"Net income\") | Increase US$73.4 billion (2023) |\\n| [Total assets](/wiki/Asset \"Asset\") | Increase US$411.9 billion (2023) |\\n| [Total equity](/wiki/Equity_(finance) \"Equity (finance)\") | Increase ', 'role': 'user'}], summary='Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 1 of 66.\\n=======================\\n# Microsoft\\n\\nAmerican multinational technology corporation\\n\\nMicrosoft Corporation| [A square divided into four sub-squares, colored red-orange, green, yellow and blue (clockwise), with the company name appearing to its right](/wiki/File:Microsoft_logo_(2012).svg) |\\n| Building 92 on the [Microsoft Redmond campus](/wiki/Microsoft_Redmond_campus \"Microsoft Redmond campus\") |\\n| Company type | [Public](/wiki/Public_company \"Public company\") |\\n| [Traded as](/wiki/Ticker_symbol \"Ticker symbol\") | * [Nasdaq](/wiki/Nasdaq \"Nasdaq\"):\\xa0[MSFT](https://www.nasdaq.com/market-activity/stocks/msft)\\n* [Nasdaq-100](/wiki/Nasdaq-100 \"Nasdaq-100\") component\\n* [DJIA](/wiki/Dow_Jones_Industrial_Average \"Dow Jones Industrial Average\") component\\n* [S&P 100](/wiki/S%26P_100 \"S&P 100\") component\\n* [S&P 500](/wiki/S%26P_500 \"S&P 500\") component\\n |\\n| [ISIN](/wiki/International_Securities_Identification_Number \"International Securities Identification Number\") | [US5949181045](https://isin.toolforge.org/?language=en&isin=US5949181045) |\\n| Industry | [Information technology](/wiki/Information_technology \"Information technology\") |\\n| Founded | April\\xa04, 1975; 48 years ago\\xa0(1975-04-04) in [Albuquerque, New Mexico](/wiki/Albuquerque,_New_Mexico \"Albuquerque, New Mexico\"), U.S. |\\n| Founders | * [Bill Gates](/wiki/Bill_Gates \"Bill Gates\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n |\\n| Headquarters | [One Microsoft Way](/wiki/One_Microsoft_Way \"One Microsoft Way\"), [Redmond, Washington](/wiki/Redmond,_Washington \"Redmond, Washington\"), U.S. |\\n| Area served | Worldwide |\\n| Key people | * [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\")([Chairman](/wiki/Chairman \"Chairman\") & [CEO](/wiki/Chief_executive_officer \"Chief executive officer\"))\\n* [Brad Smith](/wiki/Brad_Smith_(American_lawyer) \"Brad Smith (American lawyer)\")([Vice Chairman](/wiki/Vice-Chairman \"Vice-Chairman\") & [President](/wiki/President_(corporate_title) \"President (corporate title)\"))\\n* Bill Gates([technical adviser](/wiki/Adviser \"Adviser\"))\\n |\\n| Products | * [Software development](/wiki/Software_development \"Software development\")\\n* [Computer hardware](/wiki/Computer_hardware \"Computer hardware\")\\n* [Consumer electronics](/wiki/Consumer_electronics \"Consumer electronics\")\\n* [Social networking service](/wiki/Social_networking_service \"Social networking service\")\\n* [Cloud computing](/wiki/Cloud_computing \"Cloud computing\")\\n* [Video games](/wiki/Video_game_industry \"Video game industry\")\\n* [Internet](/wiki/Internet \"Internet\")\\n* [Corporate venture capital](/wiki/Corporate_venture_capital \"Corporate venture capital\")\\n |\\n| Brands | \\n* [Windows](/wiki/Microsoft_Windows \"Microsoft Windows\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [Skype](/wiki/Skype \"Skype\")\\n* [Visual Studio](/wiki/Visual_Studio \"Visual Studio\")\\n* [Xbox](/wiki/Xbox \"Xbox\")\\n* [Dynamics](/wiki/Microsoft_Dynamics_365 \"Microsoft Dynamics 365\")\\n* [Surface](/wiki/Microsoft_Surface \"Microsoft Surface\")\\n\\n |\\n| Services | \\n* [Edge](/wiki/Microsoft_Edge \"Microsoft Edge\")\\n* [Azure](/wiki/Microsoft_Azure \"Microsoft Azure\")\\n* [Bing](/wiki/Microsoft_Bing \"Microsoft Bing\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Yammer](/wiki/Yammer \"Yammer\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [OneDrive](/wiki/OneDrive \"OneDrive\")\\n* [Outlook](/wiki/Microsoft_Outlook \"Microsoft Outlook\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [Microsoft Store](/wiki/Microsoft_Store_(digital) \"Microsoft Store (digital)\")\\n* [Windows Update](/wiki/Windows_Update \"Windows Update\")\\n* [Xbox Game Pass](/wiki/Xbox_Game_Pass \"Xbox Game Pass\")\\n* [Xbox network](/wiki/Xbox_network \"Xbox network\")\\n\\n |\\n| Revenue | Increase [US$](/wiki/United_States_dollar \"United States dollar\")211.9 billion (2023) |\\n| [Operating income](/wiki/Earnings_before_interest_and_taxes \"Earnings before interest and taxes\") | Increase US$88.5 billion (2023) |\\n| [Net income](/wiki/Net_income \"Net income\") | Increase US$73.4 billion (2023) |\\n| [Total assets](/wiki/Asset \"Asset\") | Increase US$411.9 billion (2023) |\\n| [Total equity](/wiki/Equity_(finance) \"Equity (finance)\") | Increase ', cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -450,7 +490,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -470,26 +510,27 @@ "\n", "Address: https://en.wikipedia.org/wiki/Microsoft\n", "Title: Microsoft - Wikipedia\n", - "Viewport position: Showing page 2 of 64.\n", + "Viewport position: Showing page 2 of 66.\n", "=======================\n", - "(finance)\") | Increase US$206.2 billion (2023) |\n", - "| Number of employees | 238,000 (2023) |\n", + "US$206.2 billion (2023) |\n", + "| Number of employees | 221,000 (2023) |\n", "| [Divisions](/wiki/Division_(business) \"Division (business)\") | \n", "* [Microsoft Engineering Groups](/wiki/Microsoft_engineering_groups \"Microsoft engineering groups\")\n", "* [Microsoft Digital Crimes Unit](/wiki/Microsoft_Digital_Crimes_Unit \"Microsoft Digital Crimes Unit\")\n", "* [Microsoft Press](/wiki/Microsoft_Press \"Microsoft Press\")\n", - "* [Microsoft Japan](/wiki/Microsoft_Japan \"Microsoft Japan\")\n", "* [Microsoft Gaming](/wiki/Microsoft_Gaming \"Microsoft Gaming\")\n", "\n", " |\n", "| [Subsidiaries](/wiki/Subsidiary \"Subsidiary\") | \n", + "* [Microsoft Japan](/wiki/Microsoft_Japan \"Microsoft Japan\")\n", + "* [Microsoft India](/wiki/Microsoft_India \"Microsoft India\")\n", + "* [Microsoft Egypt](/wiki/Microsoft_Egypt \"Microsoft Egypt\")\n", "* [GitHub](/wiki/GitHub \"GitHub\")\n", "* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\n", "* [Metaswitch](/wiki/Metaswitch \"Metaswitch\")\n", "* [Nuance Communications](/wiki/Nuance_Communications \"Nuance Communications\")\n", "* [RiskIQ](/wiki/RiskIQ \"RiskIQ\")\n", "* [Skype Technologies](/wiki/Skype_Technologies \"Skype Technologies\")\n", - "* [OpenAI](/wiki/OpenAI \"OpenAI\") (49%)[[1]](#cite_note-1)\n", "* [Xamarin](/wiki/Xamarin \"Xamarin\")\n", "* [Xandr](/wiki/Xandr \"Xandr\")\n", "\n", @@ -499,7 +540,7 @@ " |\n", "| |\n", "| Website | [microsoft.com](https://www.microsoft.com/) |\n", - "| **Footnotes / references**Financials as of June 30, 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit)[[2]](#cite_note-2) |\n", + "| **Footnotes / references**Financials as of June 30, 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit)[[1]](#cite_note-1) |\n", "\n", "| | | |\n", "| --- | --- | --- |\n", @@ -560,10 +601,20 @@ "* [e](/wiki/Special:EditPage/Template:Bill_Gates_series \"Special:EditPage/Template:Bill Gates series\")\n", " |\n", "\n", - "**Microsoft Corporation** is an American multinational [technology corporation](/wiki/Technology_company \n", + "**Microsoft Corporation** is an American multinational \n", "\n", "--------------------------------------------------------------------------------\n" ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': \"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': \"A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\\n\\nOverall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\", 'role': 'user'}, {'content': \"Click the 'Getting Started' result\", 'role': 'assistant'}, {'content': 'Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nTitle: Getting Started | AutoGen\\nViewport position: Showing page 1 of 2.\\n=======================\\nGetting Started | AutoGen\\n\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\\n\\n```\\nfrom autogen import AssistantAgent, UserProxyAgent, config\\\\_list\\\\_from\\\\_json \\n \\n# Load LLM inference endpoints from an env variable or a file \\n# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints \\n# and OAI\\\\_CONFIG\\\\_LIST\\\\_sample.json ', 'role': 'user'}, {'content': \"Find Microsoft's Wikipedia page.\", 'role': 'assistant'}, {'content': 'Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 1 of 66.\\n=======================\\n# Microsoft\\n\\nAmerican multinational technology corporation\\n\\nMicrosoft Corporation| [A square divided into four sub-squares, colored red-orange, green, yellow and blue (clockwise), with the company name appearing to its right](/wiki/File:Microsoft_logo_(2012).svg) |\\n| Building 92 on the [Microsoft Redmond campus](/wiki/Microsoft_Redmond_campus \"Microsoft Redmond campus\") |\\n| Company type | [Public](/wiki/Public_company \"Public company\") |\\n| [Traded as](/wiki/Ticker_symbol \"Ticker symbol\") | * [Nasdaq](/wiki/Nasdaq \"Nasdaq\"):\\xa0[MSFT](https://www.nasdaq.com/market-activity/stocks/msft)\\n* [Nasdaq-100](/wiki/Nasdaq-100 \"Nasdaq-100\") component\\n* [DJIA](/wiki/Dow_Jones_Industrial_Average \"Dow Jones Industrial Average\") component\\n* [S&P 100](/wiki/S%26P_100 \"S&P 100\") component\\n* [S&P 500](/wiki/S%26P_500 \"S&P 500\") component\\n |\\n| [ISIN](/wiki/International_Securities_Identification_Number \"International Securities Identification Number\") | [US5949181045](https://isin.toolforge.org/?language=en&isin=US5949181045) |\\n| Industry | [Information technology](/wiki/Information_technology \"Information technology\") |\\n| Founded | April\\xa04, 1975; 48 years ago\\xa0(1975-04-04) in [Albuquerque, New Mexico](/wiki/Albuquerque,_New_Mexico \"Albuquerque, New Mexico\"), U.S. |\\n| Founders | * [Bill Gates](/wiki/Bill_Gates \"Bill Gates\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n |\\n| Headquarters | [One Microsoft Way](/wiki/One_Microsoft_Way \"One Microsoft Way\"), [Redmond, Washington](/wiki/Redmond,_Washington \"Redmond, Washington\"), U.S. |\\n| Area served | Worldwide |\\n| Key people | * [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\")([Chairman](/wiki/Chairman \"Chairman\") & [CEO](/wiki/Chief_executive_officer \"Chief executive officer\"))\\n* [Brad Smith](/wiki/Brad_Smith_(American_lawyer) \"Brad Smith (American lawyer)\")([Vice Chairman](/wiki/Vice-Chairman \"Vice-Chairman\") & [President](/wiki/President_(corporate_title) \"President (corporate title)\"))\\n* Bill Gates([technical adviser](/wiki/Adviser \"Adviser\"))\\n |\\n| Products | * [Software development](/wiki/Software_development \"Software development\")\\n* [Computer hardware](/wiki/Computer_hardware \"Computer hardware\")\\n* [Consumer electronics](/wiki/Consumer_electronics \"Consumer electronics\")\\n* [Social networking service](/wiki/Social_networking_service \"Social networking service\")\\n* [Cloud computing](/wiki/Cloud_computing \"Cloud computing\")\\n* [Video games](/wiki/Video_game_industry \"Video game industry\")\\n* [Internet](/wiki/Internet \"Internet\")\\n* [Corporate venture capital](/wiki/Corporate_venture_capital \"Corporate venture capital\")\\n |\\n| Brands | \\n* [Windows](/wiki/Microsoft_Windows \"Microsoft Windows\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [Skype](/wiki/Skype \"Skype\")\\n* [Visual Studio](/wiki/Visual_Studio \"Visual Studio\")\\n* [Xbox](/wiki/Xbox \"Xbox\")\\n* [Dynamics](/wiki/Microsoft_Dynamics_365 \"Microsoft Dynamics 365\")\\n* [Surface](/wiki/Microsoft_Surface \"Microsoft Surface\")\\n\\n |\\n| Services | \\n* [Edge](/wiki/Microsoft_Edge \"Microsoft Edge\")\\n* [Azure](/wiki/Microsoft_Azure \"Microsoft Azure\")\\n* [Bing](/wiki/Microsoft_Bing \"Microsoft Bing\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Yammer](/wiki/Yammer \"Yammer\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [OneDrive](/wiki/OneDrive \"OneDrive\")\\n* [Outlook](/wiki/Microsoft_Outlook \"Microsoft Outlook\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [Microsoft Store](/wiki/Microsoft_Store_(digital) \"Microsoft Store (digital)\")\\n* [Windows Update](/wiki/Windows_Update \"Windows Update\")\\n* [Xbox Game Pass](/wiki/Xbox_Game_Pass \"Xbox Game Pass\")\\n* [Xbox network](/wiki/Xbox_network \"Xbox network\")\\n\\n |\\n| Revenue | Increase [US$](/wiki/United_States_dollar \"United States dollar\")211.9 billion (2023) |\\n| [Operating income](/wiki/Earnings_before_interest_and_taxes \"Earnings before interest and taxes\") | Increase US$88.5 billion (2023) |\\n| [Net income](/wiki/Net_income \"Net income\") | Increase US$73.4 billion (2023) |\\n| [Total assets](/wiki/Asset \"Asset\") | Increase US$411.9 billion (2023) |\\n| [Total equity](/wiki/Equity_(finance) \"Equity (finance)\") | Increase ', 'role': 'user'}, {'content': 'Scroll down.', 'role': 'assistant'}, {'content': 'Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 2 of 66.\\n=======================\\nUS$206.2 billion (2023) |\\n| Number of employees | 221,000 (2023) |\\n| [Divisions](/wiki/Division_(business) \"Division (business)\") | \\n* [Microsoft Engineering Groups](/wiki/Microsoft_engineering_groups \"Microsoft engineering groups\")\\n* [Microsoft Digital Crimes Unit](/wiki/Microsoft_Digital_Crimes_Unit \"Microsoft Digital Crimes Unit\")\\n* [Microsoft Press](/wiki/Microsoft_Press \"Microsoft Press\")\\n* [Microsoft Gaming](/wiki/Microsoft_Gaming \"Microsoft Gaming\")\\n\\n |\\n| [Subsidiaries](/wiki/Subsidiary \"Subsidiary\") | \\n* [Microsoft Japan](/wiki/Microsoft_Japan \"Microsoft Japan\")\\n* [Microsoft India](/wiki/Microsoft_India \"Microsoft India\")\\n* [Microsoft Egypt](/wiki/Microsoft_Egypt \"Microsoft Egypt\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Metaswitch](/wiki/Metaswitch \"Metaswitch\")\\n* [Nuance Communications](/wiki/Nuance_Communications \"Nuance Communications\")\\n* [RiskIQ](/wiki/RiskIQ \"RiskIQ\")\\n* [Skype Technologies](/wiki/Skype_Technologies \"Skype Technologies\")\\n* [Xamarin](/wiki/Xamarin \"Xamarin\")\\n* [Xandr](/wiki/Xandr \"Xandr\")\\n\\n |\\n| |\\n| [ASN](/wiki/Autonomous_System_Number \"Autonomous System Number\") | * [8075](https://bgp.tools/as/8075)\\n |\\n| |\\n| Website | [microsoft.com](https://www.microsoft.com/) |\\n| **Footnotes\\xa0/ references**Financials as of June\\xa030, 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit)[[1]](#cite_note-1) |\\n\\n| | | |\\n| --- | --- | --- |\\n| \\n\\n| | |\\n| --- | --- |\\n| [Bill Gates in 2023](/wiki/File:Bill_Gates_2017_(cropped).jpg) | This article is part of a series about\\n[Bill Gates](/wiki/Bill_Gates \"Bill Gates\") |\\n\\n |\\n| * [Awards and honors](/wiki/Bill_Gates#Recognition \"Bill Gates\")\\n* [Philanthropy](/wiki/Bill_Gates#Philanthropy \"Bill Gates\")\\n* [Political positions](/wiki/Bill_Gates#Political_positions \"Bill Gates\")\\n* [Public image](/wiki/Bill_Gates#Public_image \"Bill Gates\")\\n* [Residence](/wiki/Bill_Gates%27s_house \"Bill Gates\\'s house\")\\n\\n---\\n\\nCompanies* [Traf-O-Data](/wiki/Traf-O-Data \"Traf-O-Data\")\\n* Microsoft ([criticism](/wiki/Criticism_of_Microsoft \"Criticism of Microsoft\"))\\n* [BEN](/wiki/Branded_Entertainment_Network \"Branded Entertainment Network\")\\n* [Cascade Investment](/wiki/Cascade_Investment \"Cascade Investment\")\\n* [TerraPower](/wiki/TerraPower \"TerraPower\")\\n* [Gates Ventures](/wiki/Gates_Ventures \"Gates Ventures\")\\n\\n---\\n\\nCharitable organizations* [Bill & Melinda Gates Foundation](/wiki/Bill_%26_Melinda_Gates_Foundation \"Bill & Melinda Gates Foundation\")\\n* [Match for Africa](/wiki/Match_for_Africa \"Match for Africa\")\\n* [The Giving Pledge](/wiki/The_Giving_Pledge \"The Giving Pledge\")\\n* [OER Project](/wiki/OER_Project \"OER Project\")\\n* [Breakthrough Energy](/wiki/Breakthrough_Energy \"Breakthrough Energy\")\\n* [Mission Innovation](/wiki/Mission_Innovation \"Mission Innovation\")\\n\\n---\\n\\nWritings* \"[An Open Letter to Hobbyists](/wiki/An_Open_Letter_to_Hobbyists \"An Open Letter to Hobbyists\")\"\\n* *[The Road Ahead](/wiki/The_Road_Ahead_(Gates_book) \"The Road Ahead (Gates book)\")*\\n* *[Business @ the Speed of Thought](/wiki/Business_@_the_Speed_of_Thought \"Business @ the Speed of Thought\")*\\n* *[How to Avoid a Climate Disaster](/wiki/How_to_Avoid_a_Climate_Disaster \"How to Avoid a Climate Disaster\")*\\n* *[How to Prevent the Next Pandemic](/wiki/How_to_Prevent_the_Next_Pandemic \"How to Prevent the Next Pandemic\")*\\n\\n---\\n\\nRelated* [Bill Gates\\' flower fly](/wiki/Bill_Gates%27_flower_fly \"Bill Gates\\' flower fly\")\\n* [Codex Leicester](/wiki/Codex_Leicester \"Codex Leicester\")\\n* *[Lost on the Grand Banks](/wiki/Lost_on_the_Grand_Banks \"Lost on the Grand Banks\")*\\n* [History of Microsoft](/wiki/History_of_Microsoft \"History of Microsoft\")\\n* [Timeline of Microsoft](/wiki/Timeline_of_Microsoft \"Timeline of Microsoft\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n\\n---\\n\\n |\\n| * [v](/wiki/Template:Bill_Gates_series \"Template:Bill Gates series\")\\n* [t](/wiki/Template_talk:Bill_Gates_series \"Template talk:Bill Gates series\")\\n* [e](/wiki/Special:EditPage/Template:Bill_Gates_series \"Special:EditPage/Template:Bill Gates series\")\\n |\\n\\n**Microsoft Corporation** is an American multinational ', 'role': 'user'}], summary='Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 2 of 66.\\n=======================\\nUS$206.2 billion (2023) |\\n| Number of employees | 221,000 (2023) |\\n| [Divisions](/wiki/Division_(business) \"Division (business)\") | \\n* [Microsoft Engineering Groups](/wiki/Microsoft_engineering_groups \"Microsoft engineering groups\")\\n* [Microsoft Digital Crimes Unit](/wiki/Microsoft_Digital_Crimes_Unit \"Microsoft Digital Crimes Unit\")\\n* [Microsoft Press](/wiki/Microsoft_Press \"Microsoft Press\")\\n* [Microsoft Gaming](/wiki/Microsoft_Gaming \"Microsoft Gaming\")\\n\\n |\\n| [Subsidiaries](/wiki/Subsidiary \"Subsidiary\") | \\n* [Microsoft Japan](/wiki/Microsoft_Japan \"Microsoft Japan\")\\n* [Microsoft India](/wiki/Microsoft_India \"Microsoft India\")\\n* [Microsoft Egypt](/wiki/Microsoft_Egypt \"Microsoft Egypt\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Metaswitch](/wiki/Metaswitch \"Metaswitch\")\\n* [Nuance Communications](/wiki/Nuance_Communications \"Nuance Communications\")\\n* [RiskIQ](/wiki/RiskIQ \"RiskIQ\")\\n* [Skype Technologies](/wiki/Skype_Technologies \"Skype Technologies\")\\n* [Xamarin](/wiki/Xamarin \"Xamarin\")\\n* [Xandr](/wiki/Xandr \"Xandr\")\\n\\n |\\n| |\\n| [ASN](/wiki/Autonomous_System_Number \"Autonomous System Number\") | * [8075](https://bgp.tools/as/8075)\\n |\\n| |\\n| Website | [microsoft.com](https://www.microsoft.com/) |\\n| **Footnotes\\xa0/ references**Financials as of June\\xa030, 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit)[[1]](#cite_note-1) |\\n\\n| | | |\\n| --- | --- | --- |\\n| \\n\\n| | |\\n| --- | --- |\\n| [Bill Gates in 2023](/wiki/File:Bill_Gates_2017_(cropped).jpg) | This article is part of a series about\\n[Bill Gates](/wiki/Bill_Gates \"Bill Gates\") |\\n\\n |\\n| * [Awards and honors](/wiki/Bill_Gates#Recognition \"Bill Gates\")\\n* [Philanthropy](/wiki/Bill_Gates#Philanthropy \"Bill Gates\")\\n* [Political positions](/wiki/Bill_Gates#Political_positions \"Bill Gates\")\\n* [Public image](/wiki/Bill_Gates#Public_image \"Bill Gates\")\\n* [Residence](/wiki/Bill_Gates%27s_house \"Bill Gates\\'s house\")\\n\\n---\\n\\nCompanies* [Traf-O-Data](/wiki/Traf-O-Data \"Traf-O-Data\")\\n* Microsoft ([criticism](/wiki/Criticism_of_Microsoft \"Criticism of Microsoft\"))\\n* [BEN](/wiki/Branded_Entertainment_Network \"Branded Entertainment Network\")\\n* [Cascade Investment](/wiki/Cascade_Investment \"Cascade Investment\")\\n* [TerraPower](/wiki/TerraPower \"TerraPower\")\\n* [Gates Ventures](/wiki/Gates_Ventures \"Gates Ventures\")\\n\\n---\\n\\nCharitable organizations* [Bill & Melinda Gates Foundation](/wiki/Bill_%26_Melinda_Gates_Foundation \"Bill & Melinda Gates Foundation\")\\n* [Match for Africa](/wiki/Match_for_Africa \"Match for Africa\")\\n* [The Giving Pledge](/wiki/The_Giving_Pledge \"The Giving Pledge\")\\n* [OER Project](/wiki/OER_Project \"OER Project\")\\n* [Breakthrough Energy](/wiki/Breakthrough_Energy \"Breakthrough Energy\")\\n* [Mission Innovation](/wiki/Mission_Innovation \"Mission Innovation\")\\n\\n---\\n\\nWritings* \"[An Open Letter to Hobbyists](/wiki/An_Open_Letter_to_Hobbyists \"An Open Letter to Hobbyists\")\"\\n* *[The Road Ahead](/wiki/The_Road_Ahead_(Gates_book) \"The Road Ahead (Gates book)\")*\\n* *[Business @ the Speed of Thought](/wiki/Business_@_the_Speed_of_Thought \"Business @ the Speed of Thought\")*\\n* *[How to Avoid a Climate Disaster](/wiki/How_to_Avoid_a_Climate_Disaster \"How to Avoid a Climate Disaster\")*\\n* *[How to Prevent the Next Pandemic](/wiki/How_to_Prevent_the_Next_Pandemic \"How to Prevent the Next Pandemic\")*\\n\\n---\\n\\nRelated* [Bill Gates\\' flower fly](/wiki/Bill_Gates%27_flower_fly \"Bill Gates\\' flower fly\")\\n* [Codex Leicester](/wiki/Codex_Leicester \"Codex Leicester\")\\n* *[Lost on the Grand Banks](/wiki/Lost_on_the_Grand_Banks \"Lost on the Grand Banks\")*\\n* [History of Microsoft](/wiki/History_of_Microsoft \"History of Microsoft\")\\n* [Timeline of Microsoft](/wiki/Timeline_of_Microsoft \"Timeline of Microsoft\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n\\n---\\n\\n |\\n| * [v](/wiki/Template:Bill_Gates_series \"Template:Bill Gates series\")\\n* [t](/wiki/Template_talk:Bill_Gates_series \"Template talk:Bill Gates series\")\\n* [e](/wiki/Special:EditPage/Template:Bill_Gates_series \"Special:EditPage/Template:Bill Gates series\")\\n |\\n\\n**Microsoft Corporation** is an American multinational ', cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -573,7 +624,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -591,16 +642,269 @@ ">>>>>>>> EXECUTING FUNCTION answer_from_page...\u001b[0m\n", "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n", "\n", - "Microsoft's first office location was in Albuquerque, New Mexico, where it was founded on April 4, 1975. However, Microsoft later moved its headquarters to Redmond, Washington in January 1979. Since then, Redmond has been the main office location for Microsoft.\n", + "Microsoft was founded on April 4, 1975, in Albuquerque, New Mexico. The company moved its headquarters to Bellevue, Washington, in January 1979. Microsoft entered the operating system business in 1980 with its own version of Unix called Xenix, but it was MS-DOS that solidified the company's dominance. In 1985, Microsoft released Windows 1.0, and in 1990, the company introduced the Microsoft Office suite. In 2000, Bill Gates handed over the CEO position to Steve Ballmer, and in 2014, Satya Nadella succeeded Ballmer as the CEO of Microsoft. In 2015, Microsoft released Windows 10, and in 2016, the company joined the Linux Foundation as a Platinum member. In 2018, Microsoft acquired GitHub for $7.5 billion and announced the closure of its Mixer service. In 2020, Microsoft announced plans to acquire TikTok and finalized the acquisition of ZeniMax Media, the parent company of Bethesda Softworks, for about $7.5 billion. Additionally, Microsoft released the Xbox Series X and Xbox Series S video game consoles in November 2020.\n", "\n", "--------------------------------------------------------------------------------\n" ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': \"Address: bing: Microsoft AutoGen\\nTitle: Microsoft AutoGen - Search\\nViewport position: Showing page 1 of 1.\\n=======================\\nA Bing search for 'Microsoft AutoGen' found 9 results:\\n\\n## Web Results\\n1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\nAutoGen is a Python package that simplifies the orchestration, optimization, and automation of large language model applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using GPT-4 and other advanced LLMs. Learn how to use AutoGen for code-based question answering, supply-chain optimization, conversational chess, and more.\\n\\n2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n4. [GitHub - microsoft/autogen: Enable Next-Gen Large Language Model ...](https://github.com/microsoft/autogen)\\nAutoGen is a framework that enables the development of large language model applications using multiple agents that can converse with each other to solve tasks. It supports diverse conversation patterns, enhanced LLM inference, and customizable and conversable agents.\\n\\n5. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\nGetting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n6. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\\nAutoGen is a tool that enables next-gen large language model applications by providing a high-level abstraction for building diverse and enhanced LLM workflows. It offers a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs.\\n\\n7. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\\nAutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds. Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State University and the University of Washington, and product teams like Microsoft Fabric and ML.NET. AutoGen aims to provide an ...\\n\\n8. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\\nAutoGen. September 2023. Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They….\\n\\n9. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\nTo help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\", 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': \"A Bing search for 'Microsoft AutoGen' yielded 9 results related to the AutoGen project. AutoGen is a Python package developed by Microsoft that simplifies the orchestration, optimization, and automation of large language model (LLM) applications. It enables customizable and conversable agents that integrate with humans, tools, and other agents to solve tasks using advanced LLMs such as GPT-4. The project is open-source and community-driven, with contributions from various entities including academic contributors and product teams at Microsoft. AutoGen aims to provide a high-level abstraction for building diverse and enhanced LLM workflows, offering a collection of working systems for various domains and complexities, as well as enhanced LLM inference and optimization APIs. Additionally, AutoGen Studio has been introduced to allow rapid prototyping of multi-agent solutions through a user-friendly interface.\\n\\nOverall, the search results highlight the development, features, and applications of AutoGen in enabling next-generation large language model applications, as well as the collaborative and open nature of the project.\", 'role': 'user'}, {'content': \"Click the 'Getting Started' result\", 'role': 'assistant'}, {'content': 'Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nTitle: Getting Started | AutoGen\\nViewport position: Showing page 1 of 2.\\n=======================\\nGetting Started | AutoGen\\n\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\\n\\n```\\nfrom autogen import AssistantAgent, UserProxyAgent, config\\\\_list\\\\_from\\\\_json \\n \\n# Load LLM inference endpoints from an env variable or a file \\n# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints \\n# and OAI\\\\_CONFIG\\\\_LIST\\\\_sample.json ', 'role': 'user'}, {'content': \"Find Microsoft's Wikipedia page.\", 'role': 'assistant'}, {'content': 'Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 1 of 66.\\n=======================\\n# Microsoft\\n\\nAmerican multinational technology corporation\\n\\nMicrosoft Corporation| [A square divided into four sub-squares, colored red-orange, green, yellow and blue (clockwise), with the company name appearing to its right](/wiki/File:Microsoft_logo_(2012).svg) |\\n| Building 92 on the [Microsoft Redmond campus](/wiki/Microsoft_Redmond_campus \"Microsoft Redmond campus\") |\\n| Company type | [Public](/wiki/Public_company \"Public company\") |\\n| [Traded as](/wiki/Ticker_symbol \"Ticker symbol\") | * [Nasdaq](/wiki/Nasdaq \"Nasdaq\"):\\xa0[MSFT](https://www.nasdaq.com/market-activity/stocks/msft)\\n* [Nasdaq-100](/wiki/Nasdaq-100 \"Nasdaq-100\") component\\n* [DJIA](/wiki/Dow_Jones_Industrial_Average \"Dow Jones Industrial Average\") component\\n* [S&P 100](/wiki/S%26P_100 \"S&P 100\") component\\n* [S&P 500](/wiki/S%26P_500 \"S&P 500\") component\\n |\\n| [ISIN](/wiki/International_Securities_Identification_Number \"International Securities Identification Number\") | [US5949181045](https://isin.toolforge.org/?language=en&isin=US5949181045) |\\n| Industry | [Information technology](/wiki/Information_technology \"Information technology\") |\\n| Founded | April\\xa04, 1975; 48 years ago\\xa0(1975-04-04) in [Albuquerque, New Mexico](/wiki/Albuquerque,_New_Mexico \"Albuquerque, New Mexico\"), U.S. |\\n| Founders | * [Bill Gates](/wiki/Bill_Gates \"Bill Gates\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n |\\n| Headquarters | [One Microsoft Way](/wiki/One_Microsoft_Way \"One Microsoft Way\"), [Redmond, Washington](/wiki/Redmond,_Washington \"Redmond, Washington\"), U.S. |\\n| Area served | Worldwide |\\n| Key people | * [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\")([Chairman](/wiki/Chairman \"Chairman\") & [CEO](/wiki/Chief_executive_officer \"Chief executive officer\"))\\n* [Brad Smith](/wiki/Brad_Smith_(American_lawyer) \"Brad Smith (American lawyer)\")([Vice Chairman](/wiki/Vice-Chairman \"Vice-Chairman\") & [President](/wiki/President_(corporate_title) \"President (corporate title)\"))\\n* Bill Gates([technical adviser](/wiki/Adviser \"Adviser\"))\\n |\\n| Products | * [Software development](/wiki/Software_development \"Software development\")\\n* [Computer hardware](/wiki/Computer_hardware \"Computer hardware\")\\n* [Consumer electronics](/wiki/Consumer_electronics \"Consumer electronics\")\\n* [Social networking service](/wiki/Social_networking_service \"Social networking service\")\\n* [Cloud computing](/wiki/Cloud_computing \"Cloud computing\")\\n* [Video games](/wiki/Video_game_industry \"Video game industry\")\\n* [Internet](/wiki/Internet \"Internet\")\\n* [Corporate venture capital](/wiki/Corporate_venture_capital \"Corporate venture capital\")\\n |\\n| Brands | \\n* [Windows](/wiki/Microsoft_Windows \"Microsoft Windows\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [Skype](/wiki/Skype \"Skype\")\\n* [Visual Studio](/wiki/Visual_Studio \"Visual Studio\")\\n* [Xbox](/wiki/Xbox \"Xbox\")\\n* [Dynamics](/wiki/Microsoft_Dynamics_365 \"Microsoft Dynamics 365\")\\n* [Surface](/wiki/Microsoft_Surface \"Microsoft Surface\")\\n\\n |\\n| Services | \\n* [Edge](/wiki/Microsoft_Edge \"Microsoft Edge\")\\n* [Azure](/wiki/Microsoft_Azure \"Microsoft Azure\")\\n* [Bing](/wiki/Microsoft_Bing \"Microsoft Bing\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Yammer](/wiki/Yammer \"Yammer\")\\n* [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\")\\n* [OneDrive](/wiki/OneDrive \"OneDrive\")\\n* [Outlook](/wiki/Microsoft_Outlook \"Microsoft Outlook\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [Microsoft Store](/wiki/Microsoft_Store_(digital) \"Microsoft Store (digital)\")\\n* [Windows Update](/wiki/Windows_Update \"Windows Update\")\\n* [Xbox Game Pass](/wiki/Xbox_Game_Pass \"Xbox Game Pass\")\\n* [Xbox network](/wiki/Xbox_network \"Xbox network\")\\n\\n |\\n| Revenue | Increase [US$](/wiki/United_States_dollar \"United States dollar\")211.9 billion (2023) |\\n| [Operating income](/wiki/Earnings_before_interest_and_taxes \"Earnings before interest and taxes\") | Increase US$88.5 billion (2023) |\\n| [Net income](/wiki/Net_income \"Net income\") | Increase US$73.4 billion (2023) |\\n| [Total assets](/wiki/Asset \"Asset\") | Increase US$411.9 billion (2023) |\\n| [Total equity](/wiki/Equity_(finance) \"Equity (finance)\") | Increase ', 'role': 'user'}, {'content': 'Scroll down.', 'role': 'assistant'}, {'content': 'Address: https://en.wikipedia.org/wiki/Microsoft\\nTitle: Microsoft - Wikipedia\\nViewport position: Showing page 2 of 66.\\n=======================\\nUS$206.2 billion (2023) |\\n| Number of employees | 221,000 (2023) |\\n| [Divisions](/wiki/Division_(business) \"Division (business)\") | \\n* [Microsoft Engineering Groups](/wiki/Microsoft_engineering_groups \"Microsoft engineering groups\")\\n* [Microsoft Digital Crimes Unit](/wiki/Microsoft_Digital_Crimes_Unit \"Microsoft Digital Crimes Unit\")\\n* [Microsoft Press](/wiki/Microsoft_Press \"Microsoft Press\")\\n* [Microsoft Gaming](/wiki/Microsoft_Gaming \"Microsoft Gaming\")\\n\\n |\\n| [Subsidiaries](/wiki/Subsidiary \"Subsidiary\") | \\n* [Microsoft Japan](/wiki/Microsoft_Japan \"Microsoft Japan\")\\n* [Microsoft India](/wiki/Microsoft_India \"Microsoft India\")\\n* [Microsoft Egypt](/wiki/Microsoft_Egypt \"Microsoft Egypt\")\\n* [GitHub](/wiki/GitHub \"GitHub\")\\n* [LinkedIn](/wiki/LinkedIn \"LinkedIn\")\\n* [Metaswitch](/wiki/Metaswitch \"Metaswitch\")\\n* [Nuance Communications](/wiki/Nuance_Communications \"Nuance Communications\")\\n* [RiskIQ](/wiki/RiskIQ \"RiskIQ\")\\n* [Skype Technologies](/wiki/Skype_Technologies \"Skype Technologies\")\\n* [Xamarin](/wiki/Xamarin \"Xamarin\")\\n* [Xandr](/wiki/Xandr \"Xandr\")\\n\\n |\\n| |\\n| [ASN](/wiki/Autonomous_System_Number \"Autonomous System Number\") | * [8075](https://bgp.tools/as/8075)\\n |\\n| |\\n| Website | [microsoft.com](https://www.microsoft.com/) |\\n| **Footnotes\\xa0/ references**Financials as of June\\xa030, 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit)[[1]](#cite_note-1) |\\n\\n| | | |\\n| --- | --- | --- |\\n| \\n\\n| | |\\n| --- | --- |\\n| [Bill Gates in 2023](/wiki/File:Bill_Gates_2017_(cropped).jpg) | This article is part of a series about\\n[Bill Gates](/wiki/Bill_Gates \"Bill Gates\") |\\n\\n |\\n| * [Awards and honors](/wiki/Bill_Gates#Recognition \"Bill Gates\")\\n* [Philanthropy](/wiki/Bill_Gates#Philanthropy \"Bill Gates\")\\n* [Political positions](/wiki/Bill_Gates#Political_positions \"Bill Gates\")\\n* [Public image](/wiki/Bill_Gates#Public_image \"Bill Gates\")\\n* [Residence](/wiki/Bill_Gates%27s_house \"Bill Gates\\'s house\")\\n\\n---\\n\\nCompanies* [Traf-O-Data](/wiki/Traf-O-Data \"Traf-O-Data\")\\n* Microsoft ([criticism](/wiki/Criticism_of_Microsoft \"Criticism of Microsoft\"))\\n* [BEN](/wiki/Branded_Entertainment_Network \"Branded Entertainment Network\")\\n* [Cascade Investment](/wiki/Cascade_Investment \"Cascade Investment\")\\n* [TerraPower](/wiki/TerraPower \"TerraPower\")\\n* [Gates Ventures](/wiki/Gates_Ventures \"Gates Ventures\")\\n\\n---\\n\\nCharitable organizations* [Bill & Melinda Gates Foundation](/wiki/Bill_%26_Melinda_Gates_Foundation \"Bill & Melinda Gates Foundation\")\\n* [Match for Africa](/wiki/Match_for_Africa \"Match for Africa\")\\n* [The Giving Pledge](/wiki/The_Giving_Pledge \"The Giving Pledge\")\\n* [OER Project](/wiki/OER_Project \"OER Project\")\\n* [Breakthrough Energy](/wiki/Breakthrough_Energy \"Breakthrough Energy\")\\n* [Mission Innovation](/wiki/Mission_Innovation \"Mission Innovation\")\\n\\n---\\n\\nWritings* \"[An Open Letter to Hobbyists](/wiki/An_Open_Letter_to_Hobbyists \"An Open Letter to Hobbyists\")\"\\n* *[The Road Ahead](/wiki/The_Road_Ahead_(Gates_book) \"The Road Ahead (Gates book)\")*\\n* *[Business @ the Speed of Thought](/wiki/Business_@_the_Speed_of_Thought \"Business @ the Speed of Thought\")*\\n* *[How to Avoid a Climate Disaster](/wiki/How_to_Avoid_a_Climate_Disaster \"How to Avoid a Climate Disaster\")*\\n* *[How to Prevent the Next Pandemic](/wiki/How_to_Prevent_the_Next_Pandemic \"How to Prevent the Next Pandemic\")*\\n\\n---\\n\\nRelated* [Bill Gates\\' flower fly](/wiki/Bill_Gates%27_flower_fly \"Bill Gates\\' flower fly\")\\n* [Codex Leicester](/wiki/Codex_Leicester \"Codex Leicester\")\\n* *[Lost on the Grand Banks](/wiki/Lost_on_the_Grand_Banks \"Lost on the Grand Banks\")*\\n* [History of Microsoft](/wiki/History_of_Microsoft \"History of Microsoft\")\\n* [Timeline of Microsoft](/wiki/Timeline_of_Microsoft \"Timeline of Microsoft\")\\n* [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")\\n\\n---\\n\\n |\\n| * [v](/wiki/Template:Bill_Gates_series \"Template:Bill Gates series\")\\n* [t](/wiki/Template_talk:Bill_Gates_series \"Template talk:Bill Gates series\")\\n* [e](/wiki/Special:EditPage/Template:Bill_Gates_series \"Special:EditPage/Template:Bill Gates series\")\\n |\\n\\n**Microsoft Corporation** is an American multinational ', 'role': 'user'}, {'content': 'Where was the first office location, and when did they move to Redmond?', 'role': 'assistant'}, {'content': \"Microsoft was founded on April 4, 1975, in Albuquerque, New Mexico. The company moved its headquarters to Bellevue, Washington, in January 1979. Microsoft entered the operating system business in 1980 with its own version of Unix called Xenix, but it was MS-DOS that solidified the company's dominance. In 1985, Microsoft released Windows 1.0, and in 1990, the company introduced the Microsoft Office suite. In 2000, Bill Gates handed over the CEO position to Steve Ballmer, and in 2014, Satya Nadella succeeded Ballmer as the CEO of Microsoft. In 2015, Microsoft released Windows 10, and in 2016, the company joined the Linux Foundation as a Platinum member. In 2018, Microsoft acquired GitHub for $7.5 billion and announced the closure of its Mixer service. In 2020, Microsoft announced plans to acquire TikTok and finalized the acquisition of ZeniMax Media, the parent company of Bethesda Softworks, for about $7.5 billion. Additionally, Microsoft released the Xbox Series X and Xbox Series S video game consoles in November 2020.\", 'role': 'user'}], summary=\"Microsoft was founded on April 4, 1975, in Albuquerque, New Mexico. The company moved its headquarters to Bellevue, Washington, in January 1979. Microsoft entered the operating system business in 1980 with its own version of Unix called Xenix, but it was MS-DOS that solidified the company's dominance. In 1985, Microsoft released Windows 1.0, and in 1990, the company introduced the Microsoft Office suite. In 2000, Bill Gates handed over the CEO position to Steve Ballmer, and in 2014, Satya Nadella succeeded Ballmer as the CEO of Microsoft. In 2015, Microsoft released Windows 10, and in 2016, the company joined the Linux Foundation as a Platinum member. In 2018, Microsoft acquired GitHub for $7.5 billion and announced the closure of its Mixer service. In 2020, Microsoft announced plans to acquire TikTok and finalized the acquisition of ZeniMax Media, the parent company of Bethesda Softworks, for about $7.5 billion. Additionally, Microsoft released the Xbox Series X and Xbox Series S video game consoles in November 2020.\", cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "task6 = \"\"\"Where was the first office location, and when did they move to Redmond?\"\"\"\n", "user_proxy.initiate_chat(web_surfer, message=task6, clear_history=False)" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Example 3: Headless chrome browser\n", + "\n", + "Perform the same steps as in example 1 but with headless option. This example uses Selenium for Bing search queries so you won't need the Bing search API key." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The only difference while constructing agents is to use `True` for `headless` in `browser_config`." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "web_surfer = WebSurferAgent(\n", + " \"web_surfer\",\n", + " llm_config=llm_config,\n", + " summarizer_llm_config=summarizer_llm_config,\n", + " browser_config={\"headless\": True, \"viewport_size\": 4096, \"bing_api_key\": bing_api_key},\n", + ")\n", + "\n", + "user_proxy = autogen.UserProxyAgent(\n", + " \"user_proxy\",\n", + " human_input_mode=\"NEVER\",\n", + " code_execution_config=False,\n", + " default_auto_reply=\"\",\n", + " is_termination_msg=lambda x: True,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n", + "\n", + "\n", + "Search the web for information about Microsoft AutoGen\n", + "\n", + "\n", + "--------------------------------------------------------------------------------\n", + "\u001b[31m\n", + ">>>>>>>> USING AUTO REPLY...\u001b[0m\n", + "\u001b[35m\n", + ">>>>>>>> EXECUTING FUNCTION informational_web_search...\u001b[0m\n", + "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n", + "\n", + "Address: https://www.bing.com/search?q=Microsoft+AutoGen&form=QBLH\n", + "Viewport position: Showing page 1 of 2.\n", + "=======================\n", + "About 97,00,000 results[Date](javascript:) 1. [microsoft.comhttps://www.microsoft.com/en-us/research/blog/autogen-enabling-next...](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)[**AutoGen**: Enabling next-generation large language model …](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\n", + "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n", + "\n", + "webSep 25, 2023 · **Microsoft** researchers are introducing **AutoGen**, a framework for simplifying the orchestration, optimization, and automation of workflows for large language model (LLM) applications—potentially transforming and extending what LLMs can do.\n", + "2. [github.comhttps://github.com/microsoft/autogen](https://github.com/microsoft/autogen)[GitHub - **microsoft/autogen**: Enable Next-Gen Large Language …](https://github.com/microsoft/autogen)\n", + "--------------------------------------------------------------------------------------------------------\n", + "\n", + "web**AutoGen** is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. **AutoGen** agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\n", + "3. [microsoft.github.iohttps://microsoft.github.io/autogen/docs/Getting-Started](https://microsoft.github.io/autogen/docs/Getting-Started/)[Getting Started | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\n", + "--------------------------------------------------------------------------------------------------------------------\n", + "\n", + "web**AutoGen** provides enhanced LLM inference. It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc. **AutoGen** is powered by collaborative research studies from **Microsoft**, Penn State University, and University of Washington.\n", + "4. [microsoft.github.iohttps://microsoft.github.io/autogen](https://microsoft.github.io/autogen/)[**AutoGen** | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/)\n", + "-------------------------------------------------------------------------------------------\n", + "\n", + "web**AutoGen** offers a collection of working systems spanning a wide range of applications from various domains and complexities. Enhanced LLM Inference & Optimization. **AutoGen** supports enhanced LLM inference APIs, which can be used to improve inference performance and reduce cost.\n", + "5. [microsoft.comhttps://www.microsoft.com/en-us/research/project/autogen](https://www.microsoft.com/en-us/research/project/autogen/)[**AutoGen** - **Microsoft** Research](https://www.microsoft.com/en-us/research/project/autogen/)\n", + "-------------------------------------------------------------------------------------------------\n", + "\n", + "web**AutoGen**. **AutoGen** provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability and personalization. With this framework, users can build LLM workflows.\n", + "6. [microsoft.github.iohttps://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)[**AutoGen** Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\n", + "-------------------------------------------------------------------------------------------------------------------------------------\n", + "\n", + "webDec 1, 2023 · Now that you have **AutoGen** Studio installed and running, you are ready to explore its capabilities, including defining and modifying agent workflows, interacting with agents and sessions, and expanding agent skills.\n", + "7. [microsoft.comhttps://t\n", + "\n", + "--------------------------------------------------------------------------------\n" + ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': 'Address: https://www.bing.com/search?q=Microsoft+AutoGen&form=QBLH\\nViewport position: Showing page 1 of 2.\\n=======================\\nAbout 97,00,000 results[Date](javascript:) 1. [microsoft.comhttps://www.microsoft.com/en-us/research/blog/autogen-enabling-next...](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)[**AutoGen**: Enabling next-generation large language model …](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebSep 25, 2023\\xa0· **Microsoft** researchers are introducing **AutoGen**, a framework for simplifying the orchestration, optimization, and automation of workflows for large language model (LLM) applications—potentially transforming and extending what LLMs can do.\\n2. [github.comhttps://github.com/microsoft/autogen](https://github.com/microsoft/autogen)[GitHub - **microsoft/autogen**: Enable Next-Gen Large Language …](https://github.com/microsoft/autogen)\\n--------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. **AutoGen** agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n3. [microsoft.github.iohttps://microsoft.github.io/autogen/docs/Getting-Started](https://microsoft.github.io/autogen/docs/Getting-Started/)[Getting Started | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\n--------------------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** provides enhanced LLM inference. It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc. **AutoGen** is powered by collaborative research studies from **Microsoft**, Penn State University, and University of Washington.\\n4. [microsoft.github.iohttps://microsoft.github.io/autogen](https://microsoft.github.io/autogen/)[**AutoGen** | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/)\\n-------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** offers a collection of working systems spanning a wide range of applications from various domains and complexities. Enhanced LLM Inference & Optimization. **AutoGen** supports enhanced LLM inference APIs, which can be used to improve inference performance and reduce cost.\\n5. [microsoft.comhttps://www.microsoft.com/en-us/research/project/autogen](https://www.microsoft.com/en-us/research/project/autogen/)[**AutoGen** - **Microsoft** Research](https://www.microsoft.com/en-us/research/project/autogen/)\\n-------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen**. **AutoGen** provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability and personalization. With this framework, users can build LLM workflows.\\n6. [microsoft.github.iohttps://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)[**AutoGen** Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\n-------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebDec 1, 2023\\xa0· Now that you have **AutoGen** Studio installed and running, you are ready to explore its capabilities, including defining and modifying agent workflows, interacting with agents and sessions, and expanding agent skills.\\n7. [microsoft.comhttps://t', 'role': 'user'}], summary='Address: https://www.bing.com/search?q=Microsoft+AutoGen&form=QBLH\\nViewport position: Showing page 1 of 2.\\n=======================\\nAbout 97,00,000 results[Date](javascript:) 1. [microsoft.comhttps://www.microsoft.com/en-us/research/blog/autogen-enabling-next...](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)[**AutoGen**: Enabling next-generation large language model …](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebSep 25, 2023\\xa0· **Microsoft** researchers are introducing **AutoGen**, a framework for simplifying the orchestration, optimization, and automation of workflows for large language model (LLM) applications—potentially transforming and extending what LLMs can do.\\n2. [github.comhttps://github.com/microsoft/autogen](https://github.com/microsoft/autogen)[GitHub - **microsoft/autogen**: Enable Next-Gen Large Language …](https://github.com/microsoft/autogen)\\n--------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. **AutoGen** agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n3. [microsoft.github.iohttps://microsoft.github.io/autogen/docs/Getting-Started](https://microsoft.github.io/autogen/docs/Getting-Started/)[Getting Started | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\n--------------------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** provides enhanced LLM inference. It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc. **AutoGen** is powered by collaborative research studies from **Microsoft**, Penn State University, and University of Washington.\\n4. [microsoft.github.iohttps://microsoft.github.io/autogen](https://microsoft.github.io/autogen/)[**AutoGen** | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/)\\n-------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** offers a collection of working systems spanning a wide range of applications from various domains and complexities. Enhanced LLM Inference & Optimization. **AutoGen** supports enhanced LLM inference APIs, which can be used to improve inference performance and reduce cost.\\n5. [microsoft.comhttps://www.microsoft.com/en-us/research/project/autogen](https://www.microsoft.com/en-us/research/project/autogen/)[**AutoGen** - **Microsoft** Research](https://www.microsoft.com/en-us/research/project/autogen/)\\n-------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen**. **AutoGen** provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability and personalization. With this framework, users can build LLM workflows.\\n6. [microsoft.github.iohttps://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)[**AutoGen** Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\n-------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebDec 1, 2023\\xa0· Now that you have **AutoGen** Studio installed and running, you are ready to explore its capabilities, including defining and modifying agent workflows, interacting with agents and sessions, and expanding agent skills.\\n7. [microsoft.comhttps://t', cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "task1 = \"\"\"\n", + "Search the web for information about Microsoft AutoGen\n", + "\"\"\"\n", + "\n", + "user_proxy.initiate_chat(web_surfer, message=task1)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n", + "\n", + "Summarize these results\n", + "\n", + "--------------------------------------------------------------------------------\n", + "\u001b[31m\n", + ">>>>>>>> USING AUTO REPLY...\u001b[0m\n", + "\u001b[35m\n", + ">>>>>>>> EXECUTING FUNCTION summarize_page...\u001b[0m\n", + "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n", + "\n", + "AutoGen is a framework developed by Microsoft researchers to simplify the orchestration, optimization, and automation of workflows for large language model (LLM) applications. It enables the development of LLM applications using multiple agents that can converse with each other to solve tasks, and these agents are customizable, conversable, and allow human participation. AutoGen offers enhanced LLM inference, supports a wide range of applications, and provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability, and personalization. AutoGen is designed to simplify the process of creating and maintaining libraries of data structures and routines, and it can significantly speed up the development process in various programming projects.\n", + "\n", + "In summary, AutoGen is a versatile and powerful framework that aims to transform and extend the capabilities of large language model applications by enabling multi-agent collaborations, enhancing inference, and simplifying the development process for LLM applications.\n", + "\n", + "--------------------------------------------------------------------------------\n" + ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': 'Address: https://www.bing.com/search?q=Microsoft+AutoGen&form=QBLH\\nViewport position: Showing page 1 of 2.\\n=======================\\nAbout 97,00,000 results[Date](javascript:) 1. [microsoft.comhttps://www.microsoft.com/en-us/research/blog/autogen-enabling-next...](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)[**AutoGen**: Enabling next-generation large language model …](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebSep 25, 2023\\xa0· **Microsoft** researchers are introducing **AutoGen**, a framework for simplifying the orchestration, optimization, and automation of workflows for large language model (LLM) applications—potentially transforming and extending what LLMs can do.\\n2. [github.comhttps://github.com/microsoft/autogen](https://github.com/microsoft/autogen)[GitHub - **microsoft/autogen**: Enable Next-Gen Large Language …](https://github.com/microsoft/autogen)\\n--------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. **AutoGen** agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n3. [microsoft.github.iohttps://microsoft.github.io/autogen/docs/Getting-Started](https://microsoft.github.io/autogen/docs/Getting-Started/)[Getting Started | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\n--------------------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** provides enhanced LLM inference. It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc. **AutoGen** is powered by collaborative research studies from **Microsoft**, Penn State University, and University of Washington.\\n4. [microsoft.github.iohttps://microsoft.github.io/autogen](https://microsoft.github.io/autogen/)[**AutoGen** | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/)\\n-------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** offers a collection of working systems spanning a wide range of applications from various domains and complexities. Enhanced LLM Inference & Optimization. **AutoGen** supports enhanced LLM inference APIs, which can be used to improve inference performance and reduce cost.\\n5. [microsoft.comhttps://www.microsoft.com/en-us/research/project/autogen](https://www.microsoft.com/en-us/research/project/autogen/)[**AutoGen** - **Microsoft** Research](https://www.microsoft.com/en-us/research/project/autogen/)\\n-------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen**. **AutoGen** provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability and personalization. With this framework, users can build LLM workflows.\\n6. [microsoft.github.iohttps://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)[**AutoGen** Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\n-------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebDec 1, 2023\\xa0· Now that you have **AutoGen** Studio installed and running, you are ready to explore its capabilities, including defining and modifying agent workflows, interacting with agents and sessions, and expanding agent skills.\\n7. [microsoft.comhttps://t', 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': 'AutoGen is a framework developed by Microsoft researchers to simplify the orchestration, optimization, and automation of workflows for large language model (LLM) applications. It enables the development of LLM applications using multiple agents that can converse with each other to solve tasks, and these agents are customizable, conversable, and allow human participation. AutoGen offers enhanced LLM inference, supports a wide range of applications, and provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability, and personalization. AutoGen is designed to simplify the process of creating and maintaining libraries of data structures and routines, and it can significantly speed up the development process in various programming projects.\\n\\nIn summary, AutoGen is a versatile and powerful framework that aims to transform and extend the capabilities of large language model applications by enabling multi-agent collaborations, enhancing inference, and simplifying the development process for LLM applications.', 'role': 'user'}], summary='AutoGen is a framework developed by Microsoft researchers to simplify the orchestration, optimization, and automation of workflows for large language model (LLM) applications. It enables the development of LLM applications using multiple agents that can converse with each other to solve tasks, and these agents are customizable, conversable, and allow human participation. AutoGen offers enhanced LLM inference, supports a wide range of applications, and provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability, and personalization. AutoGen is designed to simplify the process of creating and maintaining libraries of data structures and routines, and it can significantly speed up the development process in various programming projects.\\n\\nIn summary, AutoGen is a versatile and powerful framework that aims to transform and extend the capabilities of large language model applications by enabling multi-agent collaborations, enhancing inference, and simplifying the development process for LLM applications.', cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "task2 = \"Summarize these results\"\n", + "user_proxy.initiate_chat(web_surfer, message=task2, clear_history=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n", + "\n", + "Click the 'Getting Started' result\n", + "\n", + "--------------------------------------------------------------------------------\n", + "\u001b[31m\n", + ">>>>>>>> USING AUTO REPLY...\u001b[0m\n", + "\u001b[35m\n", + ">>>>>>>> EXECUTING FUNCTION navigational_web_search...\u001b[0m\n", + "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n", + "\n", + "Address: https://microsoft.github.io/autogen/docs/Getting-Started/\n", + "Viewport position: Showing page 1 of 2.\n", + "=======================\n", + "[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\n", + "* [Gallery](/autogen/docs/Gallery)\n", + "[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\n", + "[GitHub](https://github.com/microsoft/autogen)`ctrl``K`[![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)* [Docs](/autogen/docs/Getting-Started)\n", + "* [SDK](/autogen/docs/reference/agentchat/conversable_agent)\n", + "* [Blog](/autogen/blog)\n", + "* [FAQ](/autogen/docs/FAQ)\n", + "* [Examples](/autogen/docs/Examples)\n", + "* Resources\n", + "* Other Languages\n", + "* [GitHub](https://github.com/microsoft/autogen)\n", + "← Back to main menu* [Getting Started](/autogen/docs/Getting-Started)\n", + "* [Installation](/autogen/docs/installation/)\n", + "* [LLM Configuration](/autogen/docs/llm_configuration)\n", + "* [Use Cases](#)\n", + "* [Contributing](/autogen/docs/Contribute)\n", + "* [Research](/autogen/docs/Research)\n", + "* [Migration Guide](/autogen/docs/Migration-Guide)\n", + "* \n", + "* Getting Started\n", + "On this pageGetting Started\n", + "===============\n", + "\n", + "AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\n", + "\n", + "![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\n", + "\n", + "### Main Features[​](#main-features \"Direct link to Main Features\")\n", + "\n", + "* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\n", + "* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\n", + "the number of agents, and agent conversation topology.\n", + "* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\n", + "* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\n", + "\n", + "AutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\n", + "\n", + "### Quickstart[​](#quickstart \"Direct link to Quickstart\")\n", + "\n", + "Install from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\n", + "For [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\n", + "\n", + "#### Multi-Agent Conversation Framework[​](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\n", + "\n", + "Autogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\n", + "By automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/two\n", + "\n", + "--------------------------------------------------------------------------------\n" + ] + }, + { + "data": { + "text/plain": [ + "ChatResult(chat_id=None, chat_history=[{'content': '\\nSearch the web for information about Microsoft AutoGen\\n', 'role': 'assistant'}, {'content': 'Address: https://www.bing.com/search?q=Microsoft+AutoGen&form=QBLH\\nViewport position: Showing page 1 of 2.\\n=======================\\nAbout 97,00,000 results[Date](javascript:) 1. [microsoft.comhttps://www.microsoft.com/en-us/research/blog/autogen-enabling-next...](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)[**AutoGen**: Enabling next-generation large language model …](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebSep 25, 2023\\xa0· **Microsoft** researchers are introducing **AutoGen**, a framework for simplifying the orchestration, optimization, and automation of workflows for large language model (LLM) applications—potentially transforming and extending what LLMs can do.\\n2. [github.comhttps://github.com/microsoft/autogen](https://github.com/microsoft/autogen)[GitHub - **microsoft/autogen**: Enable Next-Gen Large Language …](https://github.com/microsoft/autogen)\\n--------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. **AutoGen** agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n3. [microsoft.github.iohttps://microsoft.github.io/autogen/docs/Getting-Started](https://microsoft.github.io/autogen/docs/Getting-Started/)[Getting Started | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\\n--------------------------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** provides enhanced LLM inference. It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc. **AutoGen** is powered by collaborative research studies from **Microsoft**, Penn State University, and University of Washington.\\n4. [microsoft.github.iohttps://microsoft.github.io/autogen](https://microsoft.github.io/autogen/)[**AutoGen** | **AutoGen** - **microsoft**.github.io](https://microsoft.github.io/autogen/)\\n-------------------------------------------------------------------------------------------\\n\\nweb**AutoGen** offers a collection of working systems spanning a wide range of applications from various domains and complexities. Enhanced LLM Inference & Optimization. **AutoGen** supports enhanced LLM inference APIs, which can be used to improve inference performance and reduce cost.\\n5. [microsoft.comhttps://www.microsoft.com/en-us/research/project/autogen](https://www.microsoft.com/en-us/research/project/autogen/)[**AutoGen** - **Microsoft** Research](https://www.microsoft.com/en-us/research/project/autogen/)\\n-------------------------------------------------------------------------------------------------\\n\\nweb**AutoGen**. **AutoGen** provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability and personalization. With this framework, users can build LLM workflows.\\n6. [microsoft.github.iohttps://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)[**AutoGen** Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\\n-------------------------------------------------------------------------------------------------------------------------------------\\n\\nwebDec 1, 2023\\xa0· Now that you have **AutoGen** Studio installed and running, you are ready to explore its capabilities, including defining and modifying agent workflows, interacting with agents and sessions, and expanding agent skills.\\n7. [microsoft.comhttps://t', 'role': 'user'}, {'content': 'Summarize these results', 'role': 'assistant'}, {'content': 'AutoGen is a framework developed by Microsoft researchers to simplify the orchestration, optimization, and automation of workflows for large language model (LLM) applications. It enables the development of LLM applications using multiple agents that can converse with each other to solve tasks, and these agents are customizable, conversable, and allow human participation. AutoGen offers enhanced LLM inference, supports a wide range of applications, and provides a multi-agent conversation framework as a high-level abstraction. It is an open-source library for enabling next-generation LLM applications with multi-agent collaborations, teachability, and personalization. AutoGen is designed to simplify the process of creating and maintaining libraries of data structures and routines, and it can significantly speed up the development process in various programming projects.\\n\\nIn summary, AutoGen is a versatile and powerful framework that aims to transform and extend the capabilities of large language model applications by enabling multi-agent collaborations, enhancing inference, and simplifying the development process for LLM applications.', 'role': 'user'}, {'content': \"Click the 'Getting Started' result\", 'role': 'assistant'}, {'content': 'Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nViewport position: Showing page 1 of 2.\\n=======================\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`[![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)* [Docs](/autogen/docs/Getting-Started)\\n* [SDK](/autogen/docs/reference/agentchat/conversable_agent)\\n* [Blog](/autogen/blog)\\n* [FAQ](/autogen/docs/FAQ)\\n* [Examples](/autogen/docs/Examples)\\n* Resources\\n* Other Languages\\n* [GitHub](https://github.com/microsoft/autogen)\\n← Back to main menu* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](#)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/two', 'role': 'user'}], summary='Address: https://microsoft.github.io/autogen/docs/Getting-Started/\\nViewport position: Showing page 1 of 2.\\n=======================\\n[Skip to main content](#__docusaurus_skipToContent_fallback)[![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)[Docs](/autogen/docs/Getting-Started)[SDK](/autogen/docs/reference/agentchat/conversable_agent)[Blog](/autogen/blog)[FAQ](/autogen/docs/FAQ)[Examples](/autogen/docs/Examples)[Resources](#)* [Ecosystem](/autogen/docs/Ecosystem)\\n* [Gallery](/autogen/docs/Gallery)\\n[Other Languages](#)* [Dotnet](https://microsoft.github.io/autogen-for-net/)\\n[GitHub](https://github.com/microsoft/autogen)`ctrl``K`[![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)* [Docs](/autogen/docs/Getting-Started)\\n* [SDK](/autogen/docs/reference/agentchat/conversable_agent)\\n* [Blog](/autogen/blog)\\n* [FAQ](/autogen/docs/FAQ)\\n* [Examples](/autogen/docs/Examples)\\n* Resources\\n* Other Languages\\n* [GitHub](https://github.com/microsoft/autogen)\\n← Back to main menu* [Getting Started](/autogen/docs/Getting-Started)\\n* [Installation](/autogen/docs/installation/)\\n* [LLM Configuration](/autogen/docs/llm_configuration)\\n* [Use Cases](#)\\n* [Contributing](/autogen/docs/Contribute)\\n* [Research](/autogen/docs/Research)\\n* [Migration Guide](/autogen/docs/Migration-Guide)\\n* \\n* Getting Started\\nOn this pageGetting Started\\n===============\\n\\nAutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\\n\\n![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\\n\\n### Main Features[\\u200b](#main-features \"Direct link to Main Features\")\\n\\n* AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n* It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\nthe number of agents, and agent conversation topology.\\n* It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n* AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is powered by collaborative [research studies](/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.\\n\\n### Quickstart[\\u200b](#quickstart \"Direct link to Quickstart\")\\n\\nInstall from pip: `pip install pyautogen`. Find more options in [Installation](/autogen/docs/installation/).\\nFor [code execution](/autogen/docs/FAQ#code-execution), we strongly recommend installing the python docker package, and using docker.\\n\\n#### Multi-Agent Conversation Framework[\\u200b](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\\n\\nAutogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/main/test/two', cost=({'total_cost': 0}, {'total_cost': 0}), human_input=[])" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "task3 = \"Click the 'Getting Started' result\"\n", + "user_proxy.initiate_chat(web_surfer, message=task3, clear_history=False)" + ] } ], "metadata": { diff --git a/setup.py b/setup.py index 4debf3c81e36..130fd91f3824 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ "teachable": ["chromadb"], "lmm": ["replicate", "pillow"], "graph": ["networkx", "matplotlib"], - "websurfer": ["beautifulsoup4", "markdownify", "pdfminer.six", "pathvalidate"], + "websurfer": ["beautifulsoup4", "markdownify", "pdfminer.six", "pathvalidate", "selenium"], "redis": ["redis"], "jupyter-executor": [ "jupyter-kernel-gateway", diff --git a/test/agentchat/contrib/test_web_surfer.py b/test/agentchat/contrib/test_web_surfer.py index 71325fc9c154..cc1bf806f3d5 100755 --- a/test/agentchat/contrib/test_web_surfer.py +++ b/test/agentchat/contrib/test_web_surfer.py @@ -102,6 +102,59 @@ def test_web_surfer() -> None: response = function_map["summarize_page"]() +@pytest.mark.skipif( + skip_all, + reason="do not run if dependency is not installed", +) +def test_web_surfer_headless(): + with pytest.MonkeyPatch.context() as mp: + # we mock the API key so we can register functions (llm_config must be present for this to work) + mp.setenv("OPENAI_API_KEY", MOCK_OPEN_AI_API_KEY) + + page_size = 4096 + web_surfer = WebSurferAgent( + "web_surfer", + llm_config={"model": "gpt-3.5-turbo", "config_list": []}, + browser_config={"viewport_size": page_size, "headless": True}, + ) + + # Sneak a peak at the function map, allowing us to call the functions for testing here + function_map = web_surfer._user_proxy._function_map + + # Test some basic navigations + response = function_map["visit_page"](BLOG_POST_URL) + assert f"Address: {BLOG_POST_URL}".strip() in response + # assert f"Title: {BLOG_POST_TITLE}".strip() in response + + # Test scrolling + m = re.search(r"\bViewport position: Showing page 1 of (\d+).", response) + total_pages = int(m.group(1)) + + response = function_map["page_down"]() + assert ( + f"Viewport position: Showing page 2 of {total_pages}." in response + ) # Assumes the content is longer than one screen + + response = function_map["page_up"]() + assert f"Viewport position: Showing page 1 of {total_pages}." in response + + # Try to scroll too far back up + response = function_map["page_up"]() + assert f"Viewport position: Showing page 1 of {total_pages}." in response + + # Try to scroll too far down + for i in range(0, total_pages + 1): + response = function_map["page_down"]() + assert f"Viewport position: Showing page {total_pages} of {total_pages}." in response + + # Test Q&A and summarization -- we don't have a key so we expect it to fail (but it means the code path is correct) + with pytest.raises(IndexError): + response = function_map["answer_from_page"]("When was it founded?") + + with pytest.raises(IndexError): + response = function_map["summarize_page"]() + + @pytest.mark.skipif( skip_oai, reason="do not run if oai is not installed", @@ -121,32 +174,34 @@ def test_web_surfer_oai() -> None: assert len(llm_config["config_list"]) > 0 # type: ignore[arg-type] assert len(summarizer_llm_config["config_list"]) > 0 - page_size = 4096 - web_surfer = WebSurferAgent( - "web_surfer", - llm_config=llm_config, - summarizer_llm_config=summarizer_llm_config, - browser_config={"viewport_size": page_size}, - ) + # run the test with both text and headless browsers + for useHeadlessBrowser in [False, True]: + page_size = 4096 + web_surfer = WebSurferAgent( + "web_surfer", + llm_config=llm_config, + summarizer_llm_config=summarizer_llm_config, + browser_config={"viewport_size": page_size, "headless": useHeadlessBrowser}, + ) - user_proxy = UserProxyAgent( - "user_proxy", - human_input_mode="NEVER", - code_execution_config=False, - default_auto_reply="", - is_termination_msg=lambda x: True, - ) + user_proxy = UserProxyAgent( + "user_proxy", + human_input_mode="NEVER", + code_execution_config=False, + default_auto_reply="", + is_termination_msg=lambda x: True, + ) - # Make some requests that should test function calling - user_proxy.initiate_chat(web_surfer, message="Please visit the page 'https://en.wikipedia.org/wiki/Microsoft'") + # Make some requests that should test function calling + user_proxy.initiate_chat(web_surfer, message="Please visit the page 'https://en.wikipedia.org/wiki/Microsoft'") - user_proxy.initiate_chat(web_surfer, message="Please scroll down.") + user_proxy.initiate_chat(web_surfer, message="Please scroll down.") - user_proxy.initiate_chat(web_surfer, message="Please scroll up.") + user_proxy.initiate_chat(web_surfer, message="Please scroll up.") - user_proxy.initiate_chat(web_surfer, message="When was it founded?") + user_proxy.initiate_chat(web_surfer, message="When was it founded?") - user_proxy.initiate_chat(web_surfer, message="What's this page about?") + user_proxy.initiate_chat(web_surfer, message="What's this page about?") @pytest.mark.skipif( @@ -183,6 +238,36 @@ def test_web_surfer_bing() -> None: assert "Address: https://en.wikipedia.org/wiki/" in response +@pytest.mark.skipif( + skip_oai, + reason="do not run if open ai api key is not available", +) +def test_web_surfer_headless_bing(): + with pytest.MonkeyPatch.context() as mp: + # we mock the API key so we can register functions (llm_config must be present for this to work) + mp.setenv("OPENAI_API_KEY", MOCK_OPEN_AI_API_KEY) + + page_size = 4096 + web_surfer = WebSurferAgent( + "web_surfer", + llm_config={"model": "gpt-3.5-turbo", "config_list": []}, + browser_config={"viewport_size": page_size, "headless": True}, + ) + + # Sneak a peak at the function map, allowing us to call the functions for testing here + function_map = web_surfer._user_proxy._function_map + + # Test informational queries + response = function_map["informational_web_search"](BING_QUERY) + assert "Address: https://www.bing.com/search?q=Microsoft&form=QBLH" in response + assert "**Microsoft** – Cloud, Computers, Apps & Gaming" in response + + # Test informational queries + response = function_map["navigational_web_search"](BING_QUERY + " Wikipedia") + print("RESPONSE BEG", response, "RESPONSE END") + assert "Address: https://en.wikipedia.org/wiki/" in response + + if __name__ == "__main__": """Runs this file's tests from the command line.""" test_web_surfer() diff --git a/test/browser_utils/test_headless_chrome_browser.py b/test/browser_utils/test_headless_chrome_browser.py new file mode 100644 index 000000000000..359cb4b710cb --- /dev/null +++ b/test/browser_utils/test_headless_chrome_browser.py @@ -0,0 +1,100 @@ +import unittest +from unittest.mock import patch, MagicMock, call +from selenium.webdriver.chrome.webdriver import WebDriver +from selenium.webdriver.common.by import By + +from autogen.browser_utils.headless_chrome_browser import HeadlessChromeBrowser + + +class TestHeadlessChromeBrowser(unittest.TestCase): + @patch.object(WebDriver, "get") + def test_set_address(self, mock_get): + # Arrange + browser = HeadlessChromeBrowser() + + # Act + browser.set_address("https://www.example.com") + + # Assert + self.assertEqual(mock_get.call_count, 2) + self.assertEqual(mock_get.call_args_list[0], call("about:blank")) + self.assertEqual(mock_get.call_args_list[1], call("https://www.example.com")) + + @patch.object(WebDriver, "execute_script") + def test_page_content(self, mock_execute_script): + # Arrange + mock_execute_script.return_value = "

Hello, World!

" + browser = HeadlessChromeBrowser() + browser.visit_page("https://www.example.com") + # Act + content = browser.page_content + + # Assert + self.assertEqual("Hello, World!", content) + + @patch.object(WebDriver, "get") + @patch.object(WebDriver, "find_element") + def test_bing_search(self, mock_find_element, mock_get): + # Arrange + mock_element = MagicMock() + mock_element.submit = MagicMock() + mock_element.clear = MagicMock() + mock_element.send_keys = MagicMock() + mock_find_element.return_value = mock_element + browser = HeadlessChromeBrowser() + + # Act + browser._bing_search("test query") + + # Assert + self.assertEqual(mock_get.call_count, 2) + self.assertEqual(mock_get.call_args_list[0], call("about:blank")) + self.assertEqual(mock_get.call_args_list[1], call("https://www.bing.com")) + mock_find_element.assert_called_once_with(By.NAME, "q") + mock_element.clear.assert_called_once() + mock_element.send_keys.assert_called_once_with("test query") + mock_element.submit.assert_called_once() + + def test_page_up(self): + # Arrange + browser = HeadlessChromeBrowser() + browser._set_page_content("Hello, World!" * 1000) # Set a long page content + browser.viewport_current_page = 1 # Set the current page to 1 + + # Act + browser.page_up() + + # Assert + self.assertEqual(browser.viewport_current_page, 0) # The current page should now be 0 + + def test_page_down(self): + # Arrange + browser = HeadlessChromeBrowser() + browser._set_page_content("Hello, World!" * 1000) # Set a long page content + browser.viewport_current_page = 1 # Set the current page to 0 + + # Act + browser.page_down() + + # Assert + self.assertEqual(browser.viewport_current_page, 1) # The current page should now be 1 + + @patch.object(WebDriver, "get") + @patch.object(WebDriver, "execute_script") + def test_visit_page(self, mock_execute_script, mock_get): + # Arrange + mock_execute_script.return_value = "

Hello, World!

" + browser = HeadlessChromeBrowser() + + # Act + browser.visit_page("https://www.example.com") + + # Assert + self.assertEqual(mock_get.call_count, 2) + self.assertEqual(mock_get.call_args_list[0], call("about:blank")) + self.assertEqual(mock_get.call_args_list[1], call("https://www.example.com")) + self.assertEqual(browser.page_content, "Hello, World!") + + +if __name__ == "__main__": + unittest.main() diff --git a/test/browser_utils/test_simple_text_browser.py b/test/browser_utils/test_simple_text_browser.py new file mode 100644 index 000000000000..56df119a175a --- /dev/null +++ b/test/browser_utils/test_simple_text_browser.py @@ -0,0 +1,138 @@ +import os +import tempfile +import unittest +from unittest.mock import patch, Mock + +import requests + +from autogen.browser_utils.simple_text_browser import SimpleTextBrowser + + +class TestSimpleTextBrowser(unittest.TestCase): + def setUp(self): + self.browser = SimpleTextBrowser() + + def test_init(self): + self.assertEqual(self.browser.start_page, "about:blank") + self.assertEqual(self.browser.viewport_size, 1024 * 8) + self.assertIsNone(self.browser.downloads_folder) + self.assertIsNone(self.browser.bing_api_key) + self.assertIsNone(self.browser.request_kwargs) + + def test_set_address(self): + self.browser.set_address("https://www.example.com") + self.assertEqual(self.browser.address, "https://www.example.com") + + def test_viewport(self): + self.browser.set_address("https://www.example.com") + self.assertIsInstance(self.browser.viewport, str) + + def test_page_content(self): + self.browser.set_address("https://www.example.com") + self.assertIsInstance(self.browser.page_content, str) + + def test_page_down(self): + self.browser.set_address("https://www.example.com") + current_page = self.browser.viewport_current_page + self.browser.page_down() + self.assertEqual( + self.browser.viewport_current_page, min(current_page + 1, len(self.browser.viewport_pages) - 1) + ) + + def test_page_up(self): + self.browser.set_address("https://www.example.com") + self.browser.page_down() + current_page = self.browser.viewport_current_page + self.browser.page_up() + self.assertEqual(self.browser.viewport_current_page, max(current_page - 1, 0)) + + def test_visit_page(self): + content = self.browser.visit_page("https://www.example.com") + self.assertIsInstance(content, str) + + @patch.object(requests, "get") + def test_bing_api_call(self, mock_get): + # Arrange + mock_response = Mock() + expected_result = {"webPages": {"value": []}} + mock_response.json.return_value = expected_result + mock_response.raise_for_status.return_value = None + mock_get.return_value = mock_response + self.browser.bing_api_key = "test_key" + + # Act + result = self.browser._bing_api_call("test_query") + + # Assert + mock_get.assert_called_once_with( + "https://api.bing.microsoft.com/v7.0/search", + headers={"Ocp-Apim-Subscription-Key": "test_key"}, + params={"q": "test_query", "textDecorations": False, "textFormat": "raw"}, + stream=False, + ) + self.assertEqual(result, expected_result) + + @patch.object(SimpleTextBrowser, "_bing_api_call") + def test_bing_search(self, mock_bing_api_call): + # Arrange + expected_result = { + "webPages": {"value": [{"name": "Test Page", "url": "https://www.example.com", "snippet": "Test Snippet"}]} + } + mock_bing_api_call.return_value = expected_result + query = "test_query" + + # Act + self.browser._bing_search(query) + + # Assert + mock_bing_api_call.assert_called_once_with(query) + self.assertIn("Test Page", self.browser.page_content) + self.assertIn("https://www.example.com", self.browser.page_content) + self.assertIn("Test Snippet", self.browser.page_content) + + @patch.object(requests, "get") + def test_fetch_page_text_plain(self, mock_get): + # Arrange + mock_response = Mock() + mock_response.status_code = 200 + mock_response.headers = {"content-type": "text/plain"} + mock_response.iter_content.return_value = iter([b"Test content".decode("utf-8")]) # decode bytes to string + mock_get.return_value = mock_response + url = "https://www.example.com/test.txt" + + # Act + self.browser.set_address(url) + + # Assert + mock_get.assert_called_once_with(url, stream=True) + self.assertEqual(self.browser.page_content, "Test content") # compare with decoded string + + @patch.object(requests, "get") + def test_downloads_folder(self, mock_get): + # Arrange + mock_response = Mock() + mock_response.status_code = 200 + mock_response.headers = {"content-type": "application/octet-stream"} + mock_response.iter_content.return_value = iter([b"Download content"]) + mock_get.return_value = mock_response + url = "https://www.example.com/test.bin" + + with tempfile.TemporaryDirectory() as downloads_folder: + self.browser.downloads_folder = downloads_folder + + # Act + self.browser.set_address(url) + + # Assert + mock_get.assert_called_once_with(url, stream=True) + download_path = os.path.join(downloads_folder, os.listdir(downloads_folder)[0]) + with open(download_path, "rb") as f: + content = f.read() + self.assertEqual(content, b"Download content") + self.assertIn("Downloaded", self.browser.page_content) + self.assertIn(url, self.browser.page_content) + self.assertIn(download_path, self.browser.page_content) + + +if __name__ == "__main__": + unittest.main() diff --git a/test/test_browser_utils.py b/test/test_browser_utils.py index ffcaca40ca1e..15b827518c22 100755 --- a/test/test_browser_utils.py +++ b/test/test_browser_utils.py @@ -3,6 +3,7 @@ import pytest import os import sys +import tempfile import requests import hashlib import re @@ -57,96 +58,91 @@ def _rm_folder(path): reason="do not run if dependency is not installed", ) def test_simple_text_browser(): - # Create a downloads folder (removing any leftover ones from prior tests) - downloads_folder = os.path.join(KEY_LOC, "downloads") - if os.path.isdir(downloads_folder): - _rm_folder(downloads_folder) - os.mkdir(downloads_folder) - - # Instantiate the browser - user_agent = "python-requests/" + requests.__version__ - viewport_size = 1024 - browser = SimpleTextBrowser( - downloads_folder=downloads_folder, - viewport_size=viewport_size, - request_kwargs={ - "headers": {"User-Agent": user_agent}, - }, - ) - - # Test that we can visit a page and find what we expect there - top_viewport = browser.visit_page(BLOG_POST_URL) - assert browser.viewport == top_viewport - assert browser.page_title.strip() == BLOG_POST_TITLE.strip() - assert BLOG_POST_STRING in browser.page_content - - # Check if page splitting works - approx_pages = math.ceil(len(browser.page_content) / viewport_size) # May be fewer, since it aligns to word breaks - assert len(browser.viewport_pages) <= approx_pages - assert abs(len(browser.viewport_pages) - approx_pages) <= 1 # allow only a small deviation - assert browser.viewport_pages[0][0] == 0 - assert browser.viewport_pages[-1][1] == len(browser.page_content) - - # Make sure we can reconstruct the full contents from the split pages - buffer = "" - for bounds in browser.viewport_pages: - buffer += browser.page_content[bounds[0] : bounds[1]] - assert buffer == browser.page_content - - # Test scrolling (scroll all the way to the bottom) - for i in range(1, len(browser.viewport_pages)): - browser.page_down() - assert browser.viewport_current_page == i - # Test scrolloing beyond the limits - for i in range(0, 5): - browser.page_down() - assert browser.viewport_current_page == len(browser.viewport_pages) - 1 - - # Test scrolling (scroll all the way to the bottom) - for i in range(len(browser.viewport_pages) - 2, 0, -1): - browser.page_up() - assert browser.viewport_current_page == i - # Test scrolloing beyond the limits - for i in range(0, 5): - browser.page_up() - assert browser.viewport_current_page == 0 - - # Test Wikipedia handling - assert WIKIPEDIA_STRING in browser.visit_page(WIKIPEDIA_URL) - assert WIKIPEDIA_TITLE.strip() == browser.page_title.strip() - - # Visit a plain-text file - response = requests.get(PLAIN_TEXT_URL) - response.raise_for_status() - expected_results = response.text - - browser.visit_page(PLAIN_TEXT_URL) - assert browser.page_content.strip() == expected_results.strip() - - # Directly download an image, and compute its md5 - response = requests.get(IMAGE_URL, stream=True) - response.raise_for_status() - expected_md5 = hashlib.md5(response.raw.read()).hexdigest() - - # Visit an image causing it to be downloaded by the SimpleTextBrowser, then compute its md5 - viewport = browser.visit_page(IMAGE_URL) - m = re.search(r"Downloaded '(.*?)' to '(.*?)'", viewport) - fetched_url = m.group(1) - download_loc = m.group(2) - assert fetched_url == IMAGE_URL - - with open(download_loc, "rb") as fh: - downloaded_md5 = hashlib.md5(fh.read()).hexdigest() - - # MD%s should match - assert expected_md5 == downloaded_md5 - - # Fetch a PDF - viewport = browser.visit_page(PDF_URL) - assert PDF_STRING in viewport - - # Clean up - _rm_folder(downloads_folder) + # Create a temp downloads folder (removing any leftover ones from prior tests) + with tempfile.TemporaryDirectory() as downloads_folder: + # Instantiate the browser + user_agent = "python-requests/" + requests.__version__ + viewport_size = 1024 + browser = SimpleTextBrowser( + downloads_folder=downloads_folder, + viewport_size=viewport_size, + request_kwargs={ + "headers": {"User-Agent": user_agent}, + }, + ) + + # Test that we can visit a page and find what we expect there + top_viewport = browser.visit_page(BLOG_POST_URL) + assert browser.viewport == top_viewport + assert browser.page_title.strip() == BLOG_POST_TITLE.strip() + assert BLOG_POST_STRING in browser.page_content + + # Check if page splitting works + approx_pages = math.ceil( + len(browser.page_content) / viewport_size + ) # May be fewer, since it aligns to word breaks + assert len(browser.viewport_pages) <= approx_pages + assert abs(len(browser.viewport_pages) - approx_pages) <= 1 # allow only a small deviation + assert browser.viewport_pages[0][0] == 0 + assert browser.viewport_pages[-1][1] == len(browser.page_content) + + # Make sure we can reconstruct the full contents from the split pages + buffer = "" + for bounds in browser.viewport_pages: + buffer += browser.page_content[bounds[0] : bounds[1]] + assert buffer == browser.page_content + + # Test scrolling (scroll all the way to the bottom) + for i in range(1, len(browser.viewport_pages)): + browser.page_down() + assert browser.viewport_current_page == i + # Test scrolloing beyond the limits + for i in range(0, 5): + browser.page_down() + assert browser.viewport_current_page == len(browser.viewport_pages) - 1 + + # Test scrolling (scroll all the way to the bottom) + for i in range(len(browser.viewport_pages) - 2, 0, -1): + browser.page_up() + assert browser.viewport_current_page == i + # Test scrolloing beyond the limits + for i in range(0, 5): + browser.page_up() + assert browser.viewport_current_page == 0 + + # Test Wikipedia handling + assert WIKIPEDIA_STRING in browser.visit_page(WIKIPEDIA_URL) + assert WIKIPEDIA_TITLE.strip() == browser.page_title.strip() + + # Visit a plain-text file + response = requests.get(PLAIN_TEXT_URL) + response.raise_for_status() + expected_results = response.text + + browser.visit_page(PLAIN_TEXT_URL) + assert browser.page_content.strip() == expected_results.strip() + + # Directly download an image, and compute its md5 + response = requests.get(IMAGE_URL, stream=True) + response.raise_for_status() + expected_md5 = hashlib.md5(response.raw.read()).hexdigest() + + # Visit an image causing it to be downloaded by the SimpleTextBrowser, then compute its md5 + viewport = browser.visit_page(IMAGE_URL) + m = re.search(r"Downloaded '(.*?)' to '(.*?)'", viewport) + fetched_url = m.group(1) + download_loc = m.group(2) + assert fetched_url == IMAGE_URL + + with open(download_loc, "rb") as fh: + downloaded_md5 = hashlib.md5(fh.read()).hexdigest() + + # MD%s should match + assert expected_md5 == downloaded_md5 + + # Fetch a PDF + viewport = browser.visit_page(PDF_URL) + assert PDF_STRING in viewport @pytest.mark.skipif(