Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## StopMessageTermination\n",
"## TextMentionTermination\n",
"\n",
"In this scenario, the team terminates the conversation if any agent sends a `StopMessage`. So, when does an agent send a `StopMessage`? Typically, this is implemented in the `on_message` method of the agent, where the agent can check the incoming message and decide to send a `StopMessage` based on some condition. \n",
"In this scenario, the team terminates the conversation if any agent's message contains a specific text mention, such as \"TERMINATE\". This approach provides more flexible and explicit control over when a chat session should end. \n",
"\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",
"A common pattern here is to prompt the agent (or some agent participating in the conversation) to emit a specific text string in its 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. "
"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 triggers a termination if it does."
]
},
{
Expand Down Expand Up @@ -163,7 +163,7 @@
"--------------------------------------------------------------------------- \n",
"\u001b[91m[2024-10-19T12:19:31.753265], Termination:\u001b[0m\n",
"\n",
"Stop message received"
"Termination condition met"
]
}
],
Expand All @@ -178,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=StopMessageTermination()\n",
" \"Write a unique, Haiku about the weather in Paris\", termination_condition=TextMentionTermination(\"TERMINATE\")\n",
")"
]
}
Expand Down