From edbaa3184297fc577c95ab31f6bf8a7277437a26 Mon Sep 17 00:00:00 2001 From: Jack Gerrits Date: Tue, 12 Mar 2024 11:57:41 -0400 Subject: [PATCH] Updates to formatting and content tweaks --- .../prompting-and-reasoning/_category_.json | 4 +++ .../prompting-and-reasoning/react.ipynb | 11 ++---- .../prompting-and-reasoning/reflection.ipynb | 36 +++---------------- website/docs/topics/task_decomposition.ipynb | 36 +++++++------------ 4 files changed, 23 insertions(+), 64 deletions(-) create mode 100644 website/docs/topics/prompting-and-reasoning/_category_.json diff --git a/website/docs/topics/prompting-and-reasoning/_category_.json b/website/docs/topics/prompting-and-reasoning/_category_.json new file mode 100644 index 00000000000..84e08b9ddf9 --- /dev/null +++ b/website/docs/topics/prompting-and-reasoning/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Prompting and Reasoning", + "collapsible": true +} diff --git a/website/docs/topics/prompting-and-reasoning/react.ipynb b/website/docs/topics/prompting-and-reasoning/react.ipynb index 03aa7a86b08..e0ebaf5d113 100644 --- a/website/docs/topics/prompting-and-reasoning/react.ipynb +++ b/website/docs/topics/prompting-and-reasoning/react.ipynb @@ -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. " ] }, { diff --git a/website/docs/topics/prompting-and-reasoning/reflection.ipynb b/website/docs/topics/prompting-and-reasoning/reflection.ipynb index 6bfd1998e4d..a042c45e813 100644 --- a/website/docs/topics/prompting-and-reasoning/reflection.ipynb +++ b/website/docs/topics/prompting-and-reasoning/reflection.ipynb @@ -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." ] }, { @@ -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", @@ -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." ] }, @@ -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" ] }, { @@ -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", diff --git a/website/docs/topics/task_decomposition.ipynb b/website/docs/topics/task_decomposition.ipynb index 8c1bae06e0e..23c5dee9159 100644 --- a/website/docs/topics/task_decomposition.ipynb +++ b/website/docs/topics/task_decomposition.ipynb @@ -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." ] }, { @@ -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", @@ -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, @@ -85,6 +73,8 @@ } ], "source": [ + "from typing_extensions import Annotated\n", + "\n", "planner = autogen.AssistantAgent(\n", " name=\"planner\",\n", " llm_config=llm_config,\n", @@ -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",