Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to formatting and content tweaks #1968

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions website/docs/topics/prompting-and-reasoning/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Prompting and Reasoning",
"collapsible": true
}
11 changes: 2 additions & 9 deletions website/docs/topics/prompting-and-reasoning/react.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@
"id": "9a71fa36",
"metadata": {},
"source": [
"# ReAct via AutoGen\n",
"# ReAct\n",
"\n",
"AutoGen supports different LLM prompting and reasoning strategies, such as ReAct, Reflection/Self-Critique, and more. This notebook demonstrates how to realize ReAct ([Yao et al., 2022](https://arxiv.org/abs/2210.03629)) with AutoGen. \n",
"\n",
"## Requirements\n",
"\n",
"AutoGen requires `Python>=3.8`. To run this notebook example, please install `pyautogen`:\n",
"```bash\n",
"pip install pyautogen\n",
"```"
"AutoGen supports different LLM prompting and reasoning strategies, such as ReAct, Reflection/Self-Critique, and more. This page demonstrates how to realize ReAct ([Yao et al., 2022](https://arxiv.org/abs/2210.03629)) with AutoGen. "
]
},
{
Expand Down
36 changes: 5 additions & 31 deletions website/docs/topics/prompting-and-reasoning/reflection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,9 @@
"id": "9a71fa36",
"metadata": {},
"source": [
"# LLM Reflection in AutoGen\n",
"# LLM Reflection\n",
"\n",
"AutoGen supports different LLM prompting and reasoning strategies, such as ReAct, Reflection/Self-Critique, and more. This notebook demonstrates how to realize general LLM reflection with AutoGen. Reflection is a general prompting strategy which involves having LLMs analyze their own outputs, behaviors, knowledge, or reasoning processes.\n",
"\n",
"## Requirements\n",
"\n",
"AutoGen requires `Python>=3.8`. To run this notebook example, please install `pyautogen`:\n",
"```bash\n",
"pip install pyautogen\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "2b803c17",
"metadata": {},
"outputs": [],
"source": [
"# %pip install \"pyautogen>=0.2.18\""
"AutoGen supports different LLM prompting and reasoning strategies, such as ReAct, Reflection/Self-Critique, and more. This notebook demonstrates how to realize general LLM reflection with AutoGen. Reflection is a general prompting strategy which involves having LLMs analyze their own outputs, behaviors, knowledge, or reasoning processes."
]
},
{
Expand All @@ -37,15 +20,6 @@
"source": [
"import autogen\n",
"\n",
"try:\n",
" from termcolor import colored\n",
"except ImportError:\n",
"\n",
" def colored(x, *args, **kwargs):\n",
" return x\n",
"\n",
"\n",
"# Construct the llm_config\n",
"config_list = autogen.config_list_from_json(\n",
" \"OAI_CONFIG_LIST\",\n",
")\n",
Expand All @@ -60,7 +34,7 @@
"id": "dea04741",
"metadata": {},
"source": [
"### Construct Agents\n",
"## Construct Agents\n",
"Now we create three agents, including `user_proxy` as a user proxy, `writing_assistant` for generating solutions (based on the initial request or critique), and `reflection_assistant` for reflecting and providing critique."
]
},
Expand Down Expand Up @@ -100,7 +74,7 @@
"id": "8d2c77d7",
"metadata": {},
"source": [
"### Construct Agent Chats with reflection_assistant being a Nested Agent for Reflection"
"## Construct Agent Chats with `reflection_assistant` being a Nested Agent for Reflection"
]
},
{
Expand Down Expand Up @@ -368,7 +342,7 @@
],
"source": [
"def reflection_message(recipient, messages, sender, config):\n",
" print(colored(\"Reflecting...\", \"yellow\"))\n",
" print(\"Reflecting...\", \"yellow\")\n",
" return f\"Reflect and provide critique on the following writing. \\n\\n {recipient.chat_messages_for_summary(sender)[-1]['content']}\"\n",
"\n",
"\n",
Expand Down
36 changes: 12 additions & 24 deletions website/docs/topics/task_decomposition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,9 @@
"id": "9a71fa36",
"metadata": {},
"source": [
"# Task Decomposition in AutoGen\n",
"# Task Decomposition\n",
"\n",
"In this notebook, we demonstrate several different ways to achieve task decomposition in AutoGen.\n",
"\n",
"## Requirements\n",
"\n",
"AutoGen requires `Python>=3.8`. To run this notebook example, please install `pyautogen`:\n",
"```bash\n",
"pip install pyautogen\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2b803c17",
"metadata": {},
"outputs": [],
"source": [
"# %pip install \"pyautogen>=0.2.18\""
"On this page, we demonstrate several different ways to achieve task decomposition in AutoGen."
]
},
{
Expand All @@ -35,10 +18,7 @@
"metadata": {},
"outputs": [],
"source": [
"from typing_extensions import Annotated\n",
"\n",
"import autogen\n",
"from autogen.cache import Cache\n",
"\n",
"config_list = autogen.config_list_from_json(\n",
" \"OAI_CONFIG_LIST\",\n",
Expand All @@ -51,6 +31,14 @@
"}"
]
},
{
"cell_type": "markdown",
"id": "11489237",
"metadata": {},
"source": [
"The task to be solved to write a blog post about the stock price performance of Nvidia in the past month."
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down Expand Up @@ -85,6 +73,8 @@
}
],
"source": [
"from typing_extensions import Annotated\n",
"\n",
"planner = autogen.AssistantAgent(\n",
" name=\"planner\",\n",
" llm_config=llm_config,\n",
Expand Down Expand Up @@ -120,8 +110,6 @@
")\n",
"\n",
"# register the function task_decomposition for execution\n",
"\n",
"\n",
"@user_proxy.register_for_execution()\n",
"@assistant.register_for_llm(\n",
" name=\"task_decomposition\",\n",
Expand Down
Loading