From 62c8a3eea0c9891e238eefd8da7fce12eee2b867 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Fri, 26 May 2023 13:24:30 -0700 Subject: [PATCH] doc and test update (#1053) * doc and test update * docker update --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 4 ++-- flaml/autogen/agent/chat_agent.py | 12 +----------- flaml/autogen/agent/user_proxy_agent.py | 8 ++++---- test/autogen/test_user_proxy_agent.py | 4 ++-- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 040d7869d3c..3ebd9cba4ce 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* ENV DEBIAN_FRONTEND=dialog -RUN pip3 --disable-pip-version-check --no-cache-dir install flaml +# RUN pip3 --disable-pip-version-check --no-cache-dir install flaml # For docs RUN npm install --global yarn RUN pip install pydoc-markdown==4.5.0 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b01c3bbbe58..cdef85c9d96 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,5 +9,5 @@ }, "terminal.integrated.defaultProfile.linux": "bash" }, - "updateContentCommand": "pip install -e .[test,notebook] && pre-commit install" -} + "updateContentCommand": "pip install -e .[test,notebook,openai] && pre-commit install" +} diff --git a/flaml/autogen/agent/chat_agent.py b/flaml/autogen/agent/chat_agent.py index a6d487a711d..ec386f4c0cb 100644 --- a/flaml/autogen/agent/chat_agent.py +++ b/flaml/autogen/agent/chat_agent.py @@ -4,8 +4,6 @@ class ChatAgent(Agent): - """(Experimental) Chat.""" - DEFAULT_SYSTEM_MESSAGE = """You are a chat agent. """ @@ -13,16 +11,8 @@ class ChatAgent(Agent): "model": DEFAULT_MODEL, } - def __init__(self, name, system_message=DEFAULT_SYSTEM_MESSAGE, work_dir=None, **config): - """ - Args: - name (str): agent name - system_message (str): system message to be sent to the agent - work_dir (str): working directory for the agent to execute code - config (dict): other configurations. - """ + def __init__(self, name, system_message=DEFAULT_SYSTEM_MESSAGE, **config): super().__init__(name, system_message) - self._work_dir = work_dir self._config = self.DEFAULT_CONFIG.copy() self._config.update(config) self._sender_dict = {} diff --git a/flaml/autogen/agent/user_proxy_agent.py b/flaml/autogen/agent/user_proxy_agent.py index 14e663cebe4..b070484aae1 100644 --- a/flaml/autogen/agent/user_proxy_agent.py +++ b/flaml/autogen/agent/user_proxy_agent.py @@ -24,7 +24,7 @@ def __init__( name (str): name of the agent system_message (str): system message to be sent to the agent work_dir (str): working directory for the agent - human_input_mode (bool): whether to ask for human inputs every time a message is received. + human_input_mode (str): whether to ask for human inputs every time a message is received. Possible values are "ALWAYS", "TERMINATE", "NEVER". (1) When "ALWAYS", the agent prompts for human input every time a message is received. Under this mode, the conversation stops when the human input is "exit", @@ -34,12 +34,12 @@ def __init__( (3) When "NEVER", the agent will never prompt for human input. Under this mode, the conversation stops when the number of auto reply reaches the max_consecutive_auto_reply or or when is_termination_msg is True. max_consecutive_auto_reply (int): the maximum number of consecutive auto replies. - default: None (no limit provided, class attribute MAX_CONSECUTIVE_AUTO_REPLY will be used as the limit in this case). + default to None (no limit provided, class attribute MAX_CONSECUTIVE_AUTO_REPLY will be used as the limit in this case). The limit only plays a role when human_input_mode is not "ALWAYS". is_termination_msg (function): a function that takes a message and returns a boolean value. This function is used to determine if a received message is a termination message. - config (dict): other configurations. - + use_docker (bool): whether to use docker to execute the code. + **config (dict): other configurations. """ super().__init__(name, system_message) self._work_dir = work_dir diff --git a/test/autogen/test_user_proxy_agent.py b/test/autogen/test_user_proxy_agent.py index d750bcf93a2..6a4c78a9c1c 100644 --- a/test/autogen/test_user_proxy_agent.py +++ b/test/autogen/test_user_proxy_agent.py @@ -3,7 +3,7 @@ KEY_LOC = "test/autogen" -def test_human_agent(): +def test_user_proxy_agent(): try: import openai except ImportError: @@ -29,4 +29,4 @@ def test_human_agent(): if __name__ == "__main__": - test_human_agent() + test_user_proxy_agent()