diff --git a/autogen/agentchat/contrib/captainagent.py b/autogen/agentchat/contrib/captainagent.py index c0c668e9fc..35dc8b4320 100644 --- a/autogen/agentchat/contrib/captainagent.py +++ b/autogen/agentchat/contrib/captainagent.py @@ -126,7 +126,7 @@ class CaptainAgent(ConversableAgent): DEFAULT_DESCRIPTION = "A helpful AI assistant that can build a group of agents at a proper time to solve a task." # This is used to prompt the LLM to summarize the conversation history between CaptainAgent's tool execution history - DEFAULT_SUMMARY_PROMPT = "Read the following conversation history between an expert and a group of agent experts, summarize the conversation history. You should include the initial task, the experts' plan and the attempt, finally the results of the conversation." + DEFAULT_SUMMARY_PROMPT = "Read the following conversation history between an expert and a group of agent experts, summarize the conversation history. Your summarization should include the initial task, the experts' plan and the attempt, finally the results of the conversation. If the experts arrived at a conclusion, state it as it is without any modification." def __init__( self, @@ -445,7 +445,9 @@ def _run_autobuild(self, group_name: str, execution_task: str, building_task: st **self._nested_config["group_chat_config"], ) manager = autogen.GroupChatManager( - groupchat=nested_group_chat, llm_config=self._nested_config["group_chat_llm_config"] + groupchat=nested_group_chat, + llm_config=self._nested_config["group_chat_llm_config"], + is_termination_msg=lambda x: x.get("content", "") and "terminate" in x.get("content", "").lower(), ) key = list(self.chat_messages.keys())[0] general_task = self.chat_messages[key][0]["content"] diff --git a/notebook/test_captainagent.ipynb b/notebook/test_captainagent.ipynb deleted file mode 100644 index 75dffb175d..0000000000 --- a/notebook/test_captainagent.ipynb +++ /dev/null @@ -1,474 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/vscode/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" - ] - } - ], - "source": [ - "import autogen\n", - "from autogen import UserProxyAgent\n", - "from autogen.agentchat.contrib.captainagent import CaptainAgent" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Test CaptainAgent w/o libraries" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "llm_config = {\n", - " \"config_list\": autogen.config_list_from_json(\"OAI_CONFIG_LIST\", filter_dict={\"model\": \"gpt-4o-mini\"}),\n", - "}\n", - "\n", - "captain_agent = CaptainAgent(\n", - " name=\"captain_agent\",\n", - " llm_config=llm_config,\n", - " code_execution_config={\"use_docker\": False, \"work_dir\": \"groupchat\"},\n", - " # nested_config=nested_config,\n", - ")\n", - "user_proxy = UserProxyAgent(name=\"user_proxy\", human_input_mode=\"NEVER\")" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[33muser_proxy\u001b[0m (to captain_agent):\n", - "\n", - "Assemble a team of experts, find the stock price of Microsoft in the past 1 year and plot a line chart to show the trend. Save the line chart as \"microsoft_stock_price.png\".\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[34m\n", - "********************************************************************************\u001b[0m\n", - "\u001b[34mStarting a new chat....\u001b[0m\n", - "\u001b[34m\n", - "********************************************************************************\u001b[0m\n", - "\u001b[33mExpert_summoner\u001b[0m (to CaptainAgent):\n", - "\n", - "Assemble a team of experts, find the stock price of Microsoft in the past 1 year and plot a line chart to show the trend. Save the line chart as \"microsoft_stock_price.png\".\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[31m\n", - ">>>>>>>> USING AUTO REPLY...\u001b[0m\n", - "\u001b[33mCaptainAgent\u001b[0m (to Expert_summoner):\n", - "\n", - "\u001b[32m***** Suggested tool call (call_2JJvuE6dC1HNW1lf4oMAvton): seek_experts_help *****\u001b[0m\n", - "Arguments: \n", - "{\"group_name\":\"Stock_analysis_experts\",\"building_task\":\"- A financial analyst with experience in analyzing stock market data, proficient in using Python libraries such as yfinance to fetch financial data from the internet.\\n- A data visualization expert who specializes in creating line charts using Python libraries such as matplotlib.\\n- A data verification specialist to ensure the accuracy and completeness of the financial data and the resulting visualizations.\",\"execution_task\":\"## Task description\\nFind the stock price of Microsoft (MSFT) for the past 1 year and plot a line chart to show the price trend. Save the resulting line chart as a file named \\\"microsoft_stock_price.png\\\".\\n\\n## Plan for solving the task\\n1. Use a Python library like `yfinance` to fetch Microsoft's stock price data for the last 1 year.\\n2. Utilize a data visualization library such as `matplotlib` to create a line chart showing the trend of the stock price data obtained.\\n3. Save the plotted line chart as a PNG file with the name \\\"microsoft_stock_price.png\\\".\\n\\n## Output format\\n- A file named \\\"microsoft_stock_price.png\\\" containing the line chart of Microsoft's stock prices over the past 1 year.\\n\\n## Constraints and conditions for completion\\n- The stock data must cover a 1-year period from the current date.\\n- The line chart should accurately reflect the trends in the stock price data for Microsoft.\\n- The PNG file must be saved without any errors or corruptions.\"}\n", - "\u001b[32m**********************************************************************************\u001b[0m\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[35m\n", - ">>>>>>>> EXECUTING FUNCTION seek_experts_help...\u001b[0m\n", - "==> Running AutoBuild...\n", - "\n", - "==> Building task: - A financial analyst with experience in analyzing stock market data, proficient in using Python libraries such as yfinance to fetch financial data from the internet.\n", - "- A data visualization expert who specializes in creating line charts using Python libraries such as matplotlib.\n", - "- A data verification specialist to ensure the accuracy and completeness of the financial data and the resulting visualizations.\n", - "\n", - "==> Execution task: ## Task description\n", - "Find the stock price of Microsoft (MSFT) for the past 1 year and plot a line chart to show the price trend. Save the resulting line chart as a file named \"microsoft_stock_price.png\".\n", - "\n", - "## Plan for solving the task\n", - "1. Use a Python library like `yfinance` to fetch Microsoft's stock price data for the last 1 year.\n", - "2. Utilize a data visualization library such as `matplotlib` to create a line chart showing the trend of the stock price data obtained.\n", - "3. Save the plotted line chart as a PNG file with the name \"microsoft_stock_price.png\".\n", - "\n", - "## Output format\n", - "- A file named \"microsoft_stock_price.png\" containing the line chart of Microsoft's stock prices over the past 1 year.\n", - "\n", - "## Constraints and conditions for completion\n", - "- The stock data must cover a 1-year period from the current date.\n", - "- The line chart should accurately reflect the trends in the stock price data for Microsoft.\n", - "- The PNG file must be saved without any errors or corruptions.\n", - "\u001b[32m==> Generating agents...\u001b[0m\n", - "['Financial_Analyst_Expert', 'Data_Visualization_Expert', 'Data_Verification_Specialist_Expert'] are generated.\n", - "\u001b[32m==> Generating system message...\u001b[0m\n", - "Preparing system message for Financial_Analyst_Expert\n", - "Preparing system message for Data_Visualization_Expert\n", - "Preparing system message for Data_Verification_Specialist_Expert\n", - "\u001b[32m==> Generating description...\u001b[0m\n", - "Preparing description for Financial_Analyst_Expert\n", - "Preparing description for Data_Visualization_Expert\n", - "Preparing description for Data_Verification_Specialist_Expert\n", - "\u001b[32m==> Creating agents...\u001b[0m\n", - "Creating agent Financial_Analyst_Expert...\n", - "Creating agent Data_Visualization_Expert...\n", - "Creating agent Data_Verification_Specialist_Expert...\n", - "Adding user console proxy...\n", - "\u001b[33mFinancial_Analyst_Expert\u001b[0m (to chat_manager):\n", - "\n", - "You are given: (1) a task and advises from your manager with a specific plan and (2) a general task.\n", - "Collect information from the general task, follow the suggestions from manager to solve the task.\n", - "\n", - "# General Task\n", - "Assemble a team of experts, find the stock price of Microsoft in the past 1 year and plot a line chart to show the trend. Save the line chart as \"microsoft_stock_price.png\".\n", - "\n", - "# Task and suggestions from manager\n", - "## Task description\n", - "Find the stock price of Microsoft (MSFT) for the past 1 year and plot a line chart to show the price trend. Save the resulting line chart as a file named \"microsoft_stock_price.png\".\n", - "\n", - "## Plan for solving the task\n", - "1. Use a Python library like `yfinance` to fetch Microsoft's stock price data for the last 1 year.\n", - "2. Utilize a data visualization library such as `matplotlib` to create a line chart showing the trend of the stock price data obtained.\n", - "3. Save the plotted line chart as a PNG file with the name \"microsoft_stock_price.png\".\n", - "\n", - "## Output format\n", - "- A file named \"microsoft_stock_price.png\" containing the line chart of Microsoft's stock prices over the past 1 year.\n", - "\n", - "## Constraints and conditions for completion\n", - "- The stock data must cover a 1-year period from the current date.\n", - "- The line chart should accurately reflect the trends in the stock price data for Microsoft.\n", - "- The PNG file must be saved without any errors or corruptions. \n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Data_Visualization_Expert\n", - "\u001b[0m\n", - "\u001b[33mData_Visualization_Expert\u001b[0m (to chat_manager):\n", - "\n", - "Let's follow the plan outlined to complete the task of fetching Microsoft's stock price for the past year and visualizing it.\n", - "\n", - "### Step 1: Install necessary libraries\n", - "We need to ensure that the required libraries (`yfinance` and `matplotlib`) are installed. I'll proceed to install them. \n", - "\n", - "```sh\n", - "pip install yfinance matplotlib\n", - "```\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Computer_terminal\n", - "\u001b[0m\n", - "\u001b[31m\n", - ">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is sh)...\u001b[0m\n", - "\u001b[33mComputer_terminal\u001b[0m (to chat_manager):\n", - "\n", - "exitcode: 0 (execution succeeded)\n", - "Code output: \n", - "Defaulting to user installation because normal site-packages is not writeable\n", - "Requirement already satisfied: yfinance in /home/vscode/.local/lib/python3.10/site-packages (0.2.50)\n", - "Requirement already satisfied: matplotlib in /home/vscode/.local/lib/python3.10/site-packages (3.9.2)\n", - "Requirement already satisfied: pandas>=1.3.0 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (2.2.3)\n", - "Requirement already satisfied: numpy>=1.16.5 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (1.26.4)\n", - "Requirement already satisfied: requests>=2.31 in /usr/local/lib/python3.10/site-packages (from yfinance) (2.32.3)\n", - "Requirement already satisfied: multitasking>=0.0.7 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (0.0.11)\n", - "Requirement already satisfied: lxml>=4.9.1 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (5.3.0)\n", - "Requirement already satisfied: platformdirs>=2.0.0 in /usr/local/lib/python3.10/site-packages (from yfinance) (4.3.6)\n", - "Requirement already satisfied: pytz>=2022.5 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (2024.2)\n", - "Requirement already satisfied: frozendict>=2.3.4 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (2.4.6)\n", - "Requirement already satisfied: peewee>=3.16.2 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (3.17.8)\n", - "Requirement already satisfied: beautifulsoup4>=4.11.1 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (4.12.3)\n", - "Requirement already satisfied: html5lib>=1.1 in /home/vscode/.local/lib/python3.10/site-packages (from yfinance) (1.1)\n", - "Requirement already satisfied: contourpy>=1.0.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (1.3.1)\n", - "Requirement already satisfied: cycler>=0.10 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (0.12.1)\n", - "Requirement already satisfied: fonttools>=4.22.0 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (4.55.0)\n", - "Requirement already satisfied: kiwisolver>=1.3.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (1.4.7)\n", - "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/site-packages (from matplotlib) (24.2)\n", - "Requirement already satisfied: pillow>=8 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (11.0.0)\n", - "Requirement already satisfied: pyparsing>=2.3.1 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (3.2.0)\n", - "Requirement already satisfied: python-dateutil>=2.7 in /home/vscode/.local/lib/python3.10/site-packages (from matplotlib) (2.9.0.post0)\n", - "Requirement already satisfied: soupsieve>1.2 in /home/vscode/.local/lib/python3.10/site-packages (from beautifulsoup4>=4.11.1->yfinance) (2.6)\n", - "Requirement already satisfied: six>=1.9 in /home/vscode/.local/lib/python3.10/site-packages (from html5lib>=1.1->yfinance) (1.16.0)\n", - "Requirement already satisfied: webencodings in /home/vscode/.local/lib/python3.10/site-packages (from html5lib>=1.1->yfinance) (0.5.1)\n", - "Requirement already satisfied: tzdata>=2022.7 in /home/vscode/.local/lib/python3.10/site-packages (from pandas>=1.3.0->yfinance) (2024.2)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/site-packages (from requests>=2.31->yfinance) (3.4.0)\n", - "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/site-packages (from requests>=2.31->yfinance) (3.10)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/site-packages (from requests>=2.31->yfinance) (2.2.3)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/site-packages (from requests>=2.31->yfinance) (2024.8.30)\n", - "\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Data_Visualization_Expert\n", - "\u001b[0m\n", - "\u001b[33mData_Visualization_Expert\u001b[0m (to chat_manager):\n", - "\n", - "The required libraries `yfinance` and `matplotlib` are installed successfully.\n", - "\n", - "### Step 2: Fetch Microsoft's stock price data for the past year\n", - "Now, I will write a Python script to fetch the stock price data for Microsoft (MSFT) for the past year.\n", - "\n", - "```python\n", - "import yfinance as yf\n", - "import matplotlib.pyplot as plt\n", - "import datetime\n", - "\n", - "# Set the date range\n", - "end_date = datetime.datetime.now()\n", - "start_date = end_date - datetime.timedelta(days=365)\n", - "\n", - "# Fetch the data\n", - "msft_data = yf.download('MSFT', start=start_date, end=end_date)\n", - "\n", - "# Plotting the data\n", - "plt.figure(figsize=(10, 5))\n", - "plt.plot(msft_data['Close'], label='MSFT Closing Price')\n", - "plt.title('Microsoft Stock Price Over the Last Year')\n", - "plt.xlabel('Date')\n", - "plt.ylabel('Price (USD)')\n", - "plt.legend()\n", - "plt.grid()\n", - "plt.savefig('microsoft_stock_price.png')\n", - "plt.close()\n", - "```\n", - "\n", - "Let's execute this code to fetch the data and create the line chart.\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Computer_terminal\n", - "\u001b[0m\n", - "\u001b[31m\n", - ">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n", - "\u001b[33mComputer_terminal\u001b[0m (to chat_manager):\n", - "\n", - "exitcode: 0 (execution succeeded)\n", - "Code output: \n", - "\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Data_Verification_Specialist_Expert\n", - "\u001b[0m\n", - "\u001b[33mData_Verification_Specialist_Expert\u001b[0m (to chat_manager):\n", - "\n", - "The script to fetch Microsoft's stock price data for the past year and create the line chart executed successfully without any errors.\n", - "\n", - "### Step 3: Verify the output\n", - "Now, I will verify that the file \"microsoft_stock_price.png\" has been created and is not corrupted. I will check the existence of the file and its size to ensure it's a valid PNG file.\n", - "\n", - "```python\n", - "import os\n", - "\n", - "# Verify if the file exists and check its size\n", - "file_path = 'microsoft_stock_price.png'\n", - "if os.path.exists(file_path):\n", - " file_size = os.path.getsize(file_path)\n", - " print(f\"File '{file_path}' exists with size: {file_size} bytes\")\n", - "else:\n", - " print(f\"File '{file_path}' does not exist.\")\n", - "``` \n", - "\n", - "Let's execute this verification code.\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Computer_terminal\n", - "\u001b[0m\n", - "\u001b[31m\n", - ">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n", - "\u001b[33mComputer_terminal\u001b[0m (to chat_manager):\n", - "\n", - "exitcode: 0 (execution succeeded)\n", - "Code output: \n", - "File 'microsoft_stock_price.png' exists with size: 53717 bytes\n", - "\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Financial_Analyst_Expert\n", - "\u001b[0m\n", - "\u001b[33mFinancial_Analyst_Expert\u001b[0m (to chat_manager):\n", - "\n", - "The file \"microsoft_stock_price.png\" exists and its size is 53,717 bytes, indicating it is a valid PNG file. \n", - "\n", - "With successful execution and verification, we can conclude that the task of fetching Microsoft's stock price for the past year and visualizing it has been completed successfully. \n", - "\n", - "If all members agree, we can proceed to terminate the conversation.\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Data_Visualization_Expert\n", - "\u001b[0m\n", - "\u001b[33mData_Visualization_Expert\u001b[0m (to chat_manager):\n", - "\n", - "I agree that all tasks have been successfully completed and verified. We can proceed to terminate the conversation.\n", - "\n", - "TERMINATE\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[32m\n", - "Next speaker: Financial_Analyst_Expert\n", - "\u001b[0m\n", - "\u001b[33mFinancial_Analyst_Expert\u001b[0m (to chat_manager):\n", - "\n", - "TERMINATE\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[33mExpert_summoner\u001b[0m (to CaptainAgent):\n", - "\n", - "\u001b[33mExpert_summoner\u001b[0m (to CaptainAgent):\n", - "\n", - "\u001b[32m***** Response from calling tool (call_2JJvuE6dC1HNW1lf4oMAvton) *****\u001b[0m\n", - "# Response from seek_agent_help: \n", - "## Task\n", - "Assemble a team of experts to find the stock price of Microsoft (MSFT) for the past year and plot a line chart showing the trend. Save the chart as \"microsoft_stock_price.png\".\n", - "\n", - "## Results\n", - "Successfully completed the tasks as follows:\n", - "1. Installed required libraries (`yfinance` and `matplotlib`).\n", - "2. Fetched Microsoft’s stock price data for the past year and created a line chart.\n", - "3. Saved the line chart as \"microsoft_stock_price.png\".\n", - "4. Verified the existence and size of the file, confirming it is a valid PNG file.\n", - "\n", - "## Reason for the results\n", - "The task was executed step-by-step according to the outlined plan, with each phase verified for success. The libraries required for data fetching and visualization were installed without issues. The data was then successfully fetched, plotted, and saved, which was further confirmed by checking the file's existence and size, ensuring it wasn’t corrupted.\n", - "\n", - "## Errors or issues in the conversation\n", - "There are no obvious errors or issues in the conversation.\n", - "\n", - "### Need to double-check?\n", - "No\n", - "\n", - "## Additional information (file path, code blocks, url, etc.)\n", - "File saved at: \"microsoft_stock_price.png\" \n", - "```python\n", - "import yfinance as yf\n", - "import matplotlib.pyplot as plt\n", - "import datetime\n", - "\n", - "# Set the date range\n", - "end_date = datetime.datetime.now()\n", - "start_date = end_date - datetime.timedelta(days=365)\n", - "\n", - "# Fetch the data\n", - "msft_data = yf.download('MSFT', start=start_date, end=end_date)\n", - "\n", - "# Plotting the data\n", - "plt.figure(figsize=(10, 5))\n", - "plt.plot(msft_data['Close'], label='MSFT Closing Price')\n", - "plt.title('Microsoft Stock Price Over the Last Year')\n", - "plt.xlabel('Date')\n", - "plt.ylabel('Price (USD)')\n", - "plt.legend()\n", - "plt.grid()\n", - "plt.savefig('microsoft_stock_price.png')\n", - "plt.close()\n", - "```\n", - "\u001b[32m**********************************************************************\u001b[0m\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[31m\n", - ">>>>>>>> USING AUTO REPLY...\u001b[0m\n", - "\u001b[33mCaptainAgent\u001b[0m (to Expert_summoner):\n", - "\n", - "The task to find the stock price of Microsoft for the past year and create a line chart showing the trend has been successfully completed. The line chart has been saved as the file \"microsoft_stock_price.png\". The execution proceeded smoothly with no issues detected. Here is the code used for the task:\n", - "\n", - "```python\n", - "import yfinance as yf\n", - "import matplotlib.pyplot as plt\n", - "import datetime\n", - "\n", - "# Set the date range\n", - "end_date = datetime.datetime.now()\n", - "start_date = end_date - datetime.timedelta(days=365)\n", - "\n", - "# Fetch the data\n", - "msft_data = yf.download('MSFT', start=start_date, end=end_date)\n", - "\n", - "# Plotting the data\n", - "plt.figure(figsize=(10, 5))\n", - "plt.plot(msft_data['Close'], label='MSFT Closing Price')\n", - "plt.title('Microsoft Stock Price Over the Last Year')\n", - "plt.xlabel('Date')\n", - "plt.ylabel('Price (USD)')\n", - "plt.legend()\n", - "plt.grid()\n", - "plt.savefig('microsoft_stock_price.png')\n", - "plt.close()\n", - "```\n", - "\n", - "This code fetches Microsoft's stock price data over the last year and visualizes it in a line chart, which is then saved as a PNG file. The file has been verified to ensure there are no errors. \n", - "\n", - "TERMINATE\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[31m\n", - ">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n", - "\u001b[33mExpert_summoner\u001b[0m (to CaptainAgent):\n", - "\n", - "exitcode: 0 (execution succeeded)\n", - "Code output: \n", - "\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[31m\n", - ">>>>>>>> USING AUTO REPLY...\u001b[0m\n", - "\u001b[33mCaptainAgent\u001b[0m (to Expert_summoner):\n", - "\n", - "TERMINATE\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[33mcaptain_agent\u001b[0m (to user_proxy):\n", - "\n", - "In the conversation, a task was carried out by a group of experts to assemble a team required to find and plot the stock price trend of Microsoft (MSFT) over the past year. The team included a financial analyst, a data visualization expert, and a data verification specialist. By using Python libraries such as `yfinance` for fetching data and `matplotlib` for plotting, they successfully retrieved the stock price data and created a line chart. The chart was then saved as a PNG file named \"microsoft_stock_price.png\". The process was executed without errors, and the file was verified for accuracy and integrity.\n", - "\n", - "--------------------------------------------------------------------------------\n", - "\u001b[33muser_proxy\u001b[0m (to captain_agent):\n", - "\n", - "\n", - "\n", - "--------------------------------------------------------------------------------\n" - ] - } - ], - "source": [ - "result = user_proxy.initiate_chat(\n", - " captain_agent,\n", - " message='Assemble a team of experts, find the stock price of Microsoft in the past 1 year and plot a line chart to show the trend. Save the line chart as \"microsoft_stock_price.png\".',\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.15" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}