From cea80cd1d6181fe1ec1eb341030a199c765065a6 Mon Sep 17 00:00:00 2001 From: "promptless[bot]" <179508745+promptless[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:26:17 +0000 Subject: [PATCH 01/10] Docs update (0cadeb6) --- .../tutorial/termination.ipynb | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb index ef09378635f9..78278b84bbe1 100644 --- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb @@ -70,6 +70,25 @@ "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" ] }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "--------------------------------------------------------------------------- \n", + "\u001b[91m[2024-10-19T12:19:28.807176]:\u001b[0m\n", + "\n", + "Write a unique, Haiku about the weather in Paris\n","source": [ + "## MaxMessageTermination \n", + "\n", + "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -138,6 +157,16 @@ "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " ] }, + { + "cell_type": "code", + "execution_count": 3,"\n", + "A common pattern here is prompt the agent (or some agent participating in the conversation) to emit a specific text string in it's response, which can be used to trigger the termination condition. \n", + "\n", + "In fact, if you review the code implementation for the default `CodingAssistantAgent` class provided by AgentChat, you will observe two things\n", + "- The default `system_message` instructs the agent to end their response with the word \"terminate\" if they deem the task to be completed\n", + "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " + ] + }, { "cell_type": "code", "execution_count": 3, From 1458076f206c13a948c12594e08d2d7c092a26ac Mon Sep 17 00:00:00 2001 From: "promptless[bot]" <179508745+promptless[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:21:13 +0000 Subject: [PATCH 02/10] Revert previous docs update --- .../tutorial/termination.ipynb | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb index 78278b84bbe1..ef09378635f9 100644 --- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb @@ -70,25 +70,6 @@ "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" ] }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "--------------------------------------------------------------------------- \n", - "\u001b[91m[2024-10-19T12:19:28.807176]:\u001b[0m\n", - "\n", - "Write a unique, Haiku about the weather in Paris\n","source": [ - "## MaxMessageTermination \n", - "\n", - "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" - ] - }, { "cell_type": "code", "execution_count": 2, @@ -157,16 +138,6 @@ "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " ] }, - { - "cell_type": "code", - "execution_count": 3,"\n", - "A common pattern here is prompt the agent (or some agent participating in the conversation) to emit a specific text string in it's response, which can be used to trigger the termination condition. \n", - "\n", - "In fact, if you review the code implementation for the default `CodingAssistantAgent` class provided by AgentChat, you will observe two things\n", - "- The default `system_message` instructs the agent to end their response with the word \"terminate\" if they deem the task to be completed\n", - "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " - ] - }, { "cell_type": "code", "execution_count": 3, From ed01985a1045054a48505c0b2f0b83260f6f31fe Mon Sep 17 00:00:00 2001 From: "promptless[bot]" <179508745+promptless[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:44:19 +0000 Subject: [PATCH 03/10] Revert previous docs update From 9c553cd915140f52ccdd862ebaaf962afa4e2e06 Mon Sep 17 00:00:00 2001 From: "promptless[bot]" <179508745+promptless[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:44:25 +0000 Subject: [PATCH 04/10] Docs update (0cadeb6) --- .../tutorial/termination.ipynb | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb index ef09378635f9..50b2ed748c37 100644 --- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb @@ -37,7 +37,7 @@ "from autogen_agentchat import EVENT_LOGGER_NAME\n", "from autogen_agentchat.agents import CodingAssistantAgent\n", "from autogen_agentchat.logging import ConsoleLogHandler\n", - "from autogen_agentchat.task import MaxMessageTermination, StopMessageTermination\n", + "from autogen_agentchat.task import MaxMessageTermination, TextMentionTermination\n", "from autogen_agentchat.teams import RoundRobinGroupChat\n", "from autogen_core.components.models import OpenAIChatCompletionClient\n", "\n", @@ -70,6 +70,26 @@ "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" ] }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "--------------------------------------------------------------------------- \n", + "\u001b[91m[2024-10-19T12:19:28.807176]:\u001b[0m\n", + "\n", + "Write a unique, Haiku about the weather in Paris\n",```plaintext +"source": [ + "## MaxMessageTermination \n", + "\n", + "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -138,6 +158,17 @@ "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " ] }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {},"\n", + "A common pattern here is prompt the agent (or some agent participating in the conversation) to emit a specific text string in it's response, which can be used to trigger the termination condition. \n", + "\n", + "In fact, if you review the code implementation for the default `CodingAssistantAgent` class provided by AgentChat, you will observe two things\n", + "- The default `system_message` instructs the agent to end their response with the word \"terminate\" if they deem the task to be completed\n", + "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " + ] + }, { "cell_type": "code", "execution_count": 3, @@ -178,7 +209,7 @@ "round_robin_team = RoundRobinGroupChat([writing_assistant_agent])\n", "\n", "round_robin_team_result = await round_robin_team.run(\n", - " \"Write a unique, Haiku about the weather in Paris\", termination_condition=StopMessageTermination()\n", + " \"Write a unique, Haiku about the weather in Paris\", termination_condition=TextMentionTermination(\"TERMINATE\")\n", ")" ] } From 2aaffc47fb6d8500b9099c92b4066bd707f09cc6 Mon Sep 17 00:00:00 2001 From: "promptless[bot]" <179508745+promptless[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:16:28 +0000 Subject: [PATCH 05/10] Revert previous docs update --- .../tutorial/termination.ipynb | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb index 50b2ed748c37..ef09378635f9 100644 --- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb @@ -37,7 +37,7 @@ "from autogen_agentchat import EVENT_LOGGER_NAME\n", "from autogen_agentchat.agents import CodingAssistantAgent\n", "from autogen_agentchat.logging import ConsoleLogHandler\n", - "from autogen_agentchat.task import MaxMessageTermination, TextMentionTermination\n", + "from autogen_agentchat.task import MaxMessageTermination, StopMessageTermination\n", "from autogen_agentchat.teams import RoundRobinGroupChat\n", "from autogen_core.components.models import OpenAIChatCompletionClient\n", "\n", @@ -70,26 +70,6 @@ "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" ] }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "--------------------------------------------------------------------------- \n", - "\u001b[91m[2024-10-19T12:19:28.807176]:\u001b[0m\n", - "\n", - "Write a unique, Haiku about the weather in Paris\n",```plaintext -"source": [ - "## MaxMessageTermination \n", - "\n", - "The simplest termination condition is the {py:class}`~autogen_agentchat.teams.MaxMessageTermination` condition, which terminates the conversation after a fixed number of messages. \n" - ] - }, { "cell_type": "code", "execution_count": 2, @@ -158,17 +138,6 @@ "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " ] }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {},"\n", - "A common pattern here is prompt the agent (or some agent participating in the conversation) to emit a specific text string in it's response, which can be used to trigger the termination condition. \n", - "\n", - "In fact, if you review the code implementation for the default `CodingAssistantAgent` class provided by AgentChat, you will observe two things\n", - "- The default `system_message` instructs the agent to end their response with the word \"terminate\" if they deem the task to be completed\n", - "- in the `on_message` method, the agent checks if the incoming message contains the text \"terminate\" and returns a `StopMessage` if it does. " - ] - }, { "cell_type": "code", "execution_count": 3, @@ -209,7 +178,7 @@ "round_robin_team = RoundRobinGroupChat([writing_assistant_agent])\n", "\n", "round_robin_team_result = await round_robin_team.run(\n", - " \"Write a unique, Haiku about the weather in Paris\", termination_condition=TextMentionTermination(\"TERMINATE\")\n", + " \"Write a unique, Haiku about the weather in Paris\", termination_condition=StopMessageTermination()\n", ")" ] } From 4605f2e7dd96ea7634ef009b4d347249fb801f94 Mon Sep 17 00:00:00 2001 From: "promptless[bot]" <179508745+promptless[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:16:36 +0000 Subject: [PATCH 06/10] Docs update (0cadeb6) --- .../tutorial/agents.ipynb | 74 ++++++++++++++++++- .../tutorial/termination.ipynb | 38 +++++++++- 2 files changed, 105 insertions(+), 7 deletions(-) diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/agents.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/agents.ipynb index d367ba29b7e0..fef793897348 100644 --- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/agents.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/agents.ipynb @@ -64,6 +64,23 @@ ")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "