mirror of
https://github.com/microsoft/autogen.git
synced 2025-12-27 23:18:59 +00:00
Improve doc in tutorial/conversation-patterns and customized_speaker_selection (#3006)
* update * update --------- Co-authored-by: Yiran Wu <32823396+kevin666aa@users.noreply.github.com>
This commit is contained in:
parent
03259b2229
commit
1582927ccd
@ -75,7 +75,7 @@ We found that compared to basic prompting, which demonstrates the innate capabil
|
||||
|
||||
For categories like Algebra and Prealgebra, PoT and PS showed little improvement, and in some instances, even led to a decrease in accuracy. However, MathChat was able to enhance total accuracy by around 6% compared to PoT and PS, showing competitive performance across all categories. Remarkably, MathChat improved accuracy in the Algebra category by about 15% over other methods. Note that categories like Intermediate Algebra and Precalculus remained challenging for all methods, with only about 20% of problems solved accurately.
|
||||
|
||||
The code for experiments can be found at this [repository](https://github.com/kevin666aa/FLAML/tree/gpt_math_solver/flaml/autogen/math).
|
||||
The code for experiments can be found at this [repository](https://github.com/yiranwu0/FLAML/tree/gpt_math_solver/flaml/autogen/math).
|
||||
We now provide an implementation of MathChat using the interactive agents in AutoGen. See this [notebook](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_MathChat.ipynb) for example usage.
|
||||
|
||||
## Future Directions
|
||||
|
||||
@ -112,6 +112,6 @@ Checkout more examples [here](https://github.com/microsoft/autogen/tree/main/not
|
||||
`GPTAssistantAgent` was made possible through collaboration with
|
||||
[@IANTHEREAL](https://github.com/IANTHEREAL),
|
||||
[Jiale Liu](https://leoljl.github.io),
|
||||
[Yiran Wu](https://github.com/kevin666aa),
|
||||
[Yiran Wu](https://github.com/yiranwu0),
|
||||
[Qingyun Wu](https://qingyun-wu.github.io/),
|
||||
[Chi Wang](https://www.microsoft.com/en-us/research/people/chiw/), and many other AutoGen maintainers.
|
||||
|
||||
@ -13,8 +13,8 @@ qingyunwu:
|
||||
yiranwu:
|
||||
name: Yiran Wu
|
||||
title: PhD student at Pennsylvania State University
|
||||
url: https://github.com/kevin666aa
|
||||
image_url: https://github.com/kevin666aa.png
|
||||
url: https://github.com/yiranwu0
|
||||
image_url: https://github.com/yiranwu0.png
|
||||
|
||||
jialeliu:
|
||||
name: Jiale Liu
|
||||
|
||||
@ -6,7 +6,34 @@
|
||||
"source": [
|
||||
"# Customize Speaker Selection\n",
|
||||
"\n",
|
||||
"In GroupChat, we can also customize the speaker selection by passing in a function to `speaker_selection_method`:\n",
|
||||
"```{=mdx}\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"In GroupChat, we can customize the speaker selection by passing a function to the `GroupChat` object. With this function, you can build a more **deterministic** agent workflow. We recommend following a **StateFlow** pattern when crafting this function. Please refer to the [StateFlow blog](/blog/2024/02/29/StateFlow) for more details.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## An example research workflow\n",
|
||||
"We provide a simple example to build a StateFlow model for research with customized speaker selection.\n",
|
||||
"\n",
|
||||
"We first define the following agents:\n",
|
||||
"\n",
|
||||
"- Initializer: Start the workflow by sending a task.\n",
|
||||
"- Coder: Retrieve papers from the internet by writing code.\n",
|
||||
"- Executor: Execute the code.\n",
|
||||
"- Scientist: Read the papers and write a summary.\n",
|
||||
"\n",
|
||||
"In the figure above, we define a simple workflow for research with 4 states: *Init*, *Retrieve*, *Research*, and *End*. Within each state, we will call different agents to perform the tasks.\n",
|
||||
"\n",
|
||||
"- *Init*: We use the initializer to start the workflow.\n",
|
||||
"- *Retrieve*: We will first call the coder to write code and then call the executor to execute the code.\n",
|
||||
"- *Research*: We will call the scientist to read the papers and write a summary.\n",
|
||||
"- *End*: We will end the workflow.\n",
|
||||
"\n",
|
||||
"## Create your speaker selection function\n",
|
||||
"\n",
|
||||
"Below is a skeleton of the speaker selection function. Fill in the function to define the speaker selection logic.\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"def custom_speaker_selection_func(\n",
|
||||
" last_speaker: Agent, \n",
|
||||
@ -35,28 +62,7 @@
|
||||
")\n",
|
||||
"```\n",
|
||||
"The last speaker and the groupchat object are passed to the function. \n",
|
||||
"Commonly used variables from groupchat are `groupchat.messages` and `groupchat.agents`, which is the message history and the agents in the group chat respectively. You can access other attributes of the groupchat, such as `groupchat.allowed_speaker_transitions_dict` for pre-defined `allowed_speaker_transitions_dict`.\n",
|
||||
"\n",
|
||||
"Heres is a simple example to build workflow for research with customized speaker selection.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"```{=mdx}\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"We define the following agents:\n",
|
||||
"\n",
|
||||
"- Initializer: Start the workflow by sending a task.\n",
|
||||
"- Coder: Retrieve papers from the internet by writing code.\n",
|
||||
"- Executor: Execute the code.\n",
|
||||
"- Scientist: Read the papers and write a summary.\n",
|
||||
"\n",
|
||||
"In the Figure, we define a simple workflow for research with 4 states: Init, Retrieve, Research and End. Within each state, we will call different agents to perform the tasks.\n",
|
||||
"\n",
|
||||
"Init: We use the initializer to start the workflow.\n",
|
||||
"Retrieve: We will first call the coder to write code and then call the executor to execute the code.\n",
|
||||
"Research: We will call the scientist to read the papers and write a summary.\n",
|
||||
"End: We will end the workflow."
|
||||
"Commonly used variables from groupchat are `groupchat.messages` and `groupchat.agents`, which is the message history and the agents in the group chat respectively. You can access other attributes of the groupchat, such as `groupchat.allowed_speaker_transitions_dict` for pre-defined `allowed_speaker_transitions_dict`."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -12,7 +12,18 @@
|
||||
"In this chapter, we will first dig a little bit more into the two-agent \n",
|
||||
"chat pattern and chat result, \n",
|
||||
"then we will show you several conversation patterns that involve \n",
|
||||
"more than two agents.\n"
|
||||
"more than two agents.\n",
|
||||
"\n",
|
||||
"### An Overview\n",
|
||||
"\n",
|
||||
"1. **Two-agent chat**: the simplest form of conversation pattern where two agents chat with each other.\n",
|
||||
"2. **Sequential chat**: a sequence of chats between two agents, chained together by a carryover mechanism, which brings the summary of the previous chat to the context of the next chat.\n",
|
||||
"3. **Group Chat**: a single chat involving more than two agents. An important question in group chat is: What agent should be next to speak? To support different scenarios, we provide different ways to organize agents in a group chat:\n",
|
||||
" - We support several strategies to select the next agent: `round_robin`, `random`, `manual` (human selection), and `auto` (Default, using an LLM to decide).\n",
|
||||
" - We provide a way to constrain the selection of the next speaker (See examples below).\n",
|
||||
" - We allow you to pass in a function to customize the selection of the next speaker. With this feature, you can build a **StateFlow** model which allows a deterministic workflow among your agents.\n",
|
||||
" Please refer to this [guide](/docs/topics/groupchat/customized_speaker_selection) and this [blog post](/blog/2024/02/29/StateFlow) on StateFlow for more details.\n",
|
||||
"4. **Nested Chat**: package a workflow into a single agent for reuse in a larger workflow."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user