From 5bbcd1b81fe2f911fe2d953e3e24b52b2408441a Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Tue, 28 Jan 2025 19:26:08 +0530 Subject: [PATCH] WIP --- autogen/_website/process_notebooks.py | 2 +- ...ersable-agent.md => conversable-agent.mdx} | 4 ++++ .../{ending-a-chat.md => ending-a-chat.mdx} | 12 ++++++---- .../{groupchat.md => groupchat.mdx} | 8 ++++--- ...n-in-the-loop.md => human-in-the-loop.mdx} | 4 +++- .../{installing-ag2.md => installing-ag2.mdx} | 9 ++++---- ...configuration.md => llm-configuration.mdx} | 4 +++- .../{orchestrations.md => orchestrations.mdx} | 8 ++++--- ...ured-outputs.md => structured-outputs.mdx} | 8 ++++--- .../basic-concepts/{swarm.md => swarm.mdx} | 4 +++- .../basic-concepts/{tools.md => tools.mdx} | 8 +++---- website/mint-json-template.json.jinja | 23 ++++++++----------- 12 files changed, 55 insertions(+), 39 deletions(-) rename website/docs/user-guide/basic-concepts/{conversable-agent.md => conversable-agent.mdx} (98%) rename website/docs/user-guide/basic-concepts/{ending-a-chat.md => ending-a-chat.mdx} (98%) rename website/docs/user-guide/basic-concepts/{groupchat.md => groupchat.mdx} (99%) rename website/docs/user-guide/basic-concepts/{human-in-the-loop.md => human-in-the-loop.mdx} (98%) rename website/docs/user-guide/basic-concepts/{installing-ag2.md => installing-ag2.mdx} (84%) rename website/docs/user-guide/basic-concepts/{llm-configuration.md => llm-configuration.mdx} (97%) rename website/docs/user-guide/basic-concepts/{orchestrations.md => orchestrations.mdx} (93%) rename website/docs/user-guide/basic-concepts/{structured-outputs.md => structured-outputs.mdx} (98%) rename website/docs/user-guide/basic-concepts/{swarm.md => swarm.mdx} (99%) rename website/docs/user-guide/basic-concepts/{tools.md => tools.mdx} (97%) diff --git a/autogen/_website/process_notebooks.py b/autogen/_website/process_notebooks.py index fdfe5dc865..5d2a37b125 100755 --- a/autogen/_website/process_notebooks.py +++ b/autogen/_website/process_notebooks.py @@ -1031,7 +1031,7 @@ def main() -> None: # Post-processing steps after all notebooks are handled if not args.dry_run: copy_examples_mdx_files(args.website_directory) - update_navigation_with_notebooks(args.website_directory) + # update_navigation_with_notebooks(args.website_directory) fix_internal_references_in_mdx_files(args.website_directory) add_authors_and_social_img_to_blog_posts(args.website_directory) diff --git a/website/docs/user-guide/basic-concepts/conversable-agent.md b/website/docs/user-guide/basic-concepts/conversable-agent.mdx similarity index 98% rename from website/docs/user-guide/basic-concepts/conversable-agent.md rename to website/docs/user-guide/basic-concepts/conversable-agent.mdx index 55f09aed04..1fd2d5091e 100644 --- a/website/docs/user-guide/basic-concepts/conversable-agent.md +++ b/website/docs/user-guide/basic-concepts/conversable-agent.mdx @@ -1,3 +1,7 @@ +--- +title: Conversable agent +--- + ### GitHub Codespaces Before we jump into some code, each code block will have a button that opens it in GitHub Codespaces so you can start playing with AG2 inside a fully configured environment. diff --git a/website/docs/user-guide/basic-concepts/ending-a-chat.md b/website/docs/user-guide/basic-concepts/ending-a-chat.mdx similarity index 98% rename from website/docs/user-guide/basic-concepts/ending-a-chat.md rename to website/docs/user-guide/basic-concepts/ending-a-chat.mdx index c2c2aa59ec..323d712cd6 100644 --- a/website/docs/user-guide/basic-concepts/ending-a-chat.md +++ b/website/docs/user-guide/basic-concepts/ending-a-chat.mdx @@ -1,4 +1,6 @@ -# Ending a chat +--- +title: Ending a chat +--- There are a number of ways a chat can end: 1. The maximum number of turns in a chat is reached @@ -71,9 +73,9 @@ agent_b = ConversableAgent( # agent_b > agent_a replies with message "... DONE!" > agent_b ends before replying ``` -::note + If the termination condition is met and the agent's `human_input_mode` is "ALWAYS" or 'TERMINATE' (ConversableAgent's default), you will be asked for input and can decide to end the chat. If it is "NEVER" it will end immediately. -:: + ### 3. Number of automatic replies @@ -96,9 +98,9 @@ agent_a.initiate_chat(agent_b, ...) # agent_a > agent_b > agent_a with first auto reply > agent_b > agent_a with second auto reply > agent_b > agent_a ends before replying ``` -::note + If the agent's `human_input_mode` is "ALWAYS" or 'TERMINATE' (ConversableAgent's default), you will be asked for input and can decide to end the chat. If it is "NEVER" it will end immediately. -:: + ### 4. Human replies with 'exit' During the course of the conversation, if you are prompted and reply 'exit', the chat will end. diff --git a/website/docs/user-guide/basic-concepts/groupchat.md b/website/docs/user-guide/basic-concepts/groupchat.mdx similarity index 99% rename from website/docs/user-guide/basic-concepts/groupchat.md rename to website/docs/user-guide/basic-concepts/groupchat.mdx index df735d9cfe..3b925f0efa 100644 --- a/website/docs/user-guide/basic-concepts/groupchat.md +++ b/website/docs/user-guide/basic-concepts/groupchat.mdx @@ -1,4 +1,6 @@ -# GroupChat +--- +title: GroupChat +--- `GroupChat` has four built-in conversation patterns: @@ -14,9 +16,9 @@ Coordinating the `GroupChat` is the `GroupChatManager`, an agent that provides a Let's enhance our lesson planner example to include a lesson reviewer and a teacher agent. -:::tip + You can start any multi-agent chats using the `initiate_chat` method -::: + --SNIPPET: groupchat.py diff --git a/website/docs/user-guide/basic-concepts/human-in-the-loop.md b/website/docs/user-guide/basic-concepts/human-in-the-loop.mdx similarity index 98% rename from website/docs/user-guide/basic-concepts/human-in-the-loop.md rename to website/docs/user-guide/basic-concepts/human-in-the-loop.mdx index 91c88da0a0..d52c845388 100644 --- a/website/docs/user-guide/basic-concepts/human-in-the-loop.md +++ b/website/docs/user-guide/basic-concepts/human-in-the-loop.mdx @@ -1,4 +1,6 @@ -# Human in the loop +--- +title: Human in the loop +--- If the previous ConversableAgent example you were able to chat with the agent and this is because another agent was automatically created to represent you, the human in the loop, when using an agent's `run` method. diff --git a/website/docs/user-guide/basic-concepts/installing-ag2.md b/website/docs/user-guide/basic-concepts/installing-ag2.mdx similarity index 84% rename from website/docs/user-guide/basic-concepts/installing-ag2.md rename to website/docs/user-guide/basic-concepts/installing-ag2.mdx index 0857a61cd7..8a10193182 100644 --- a/website/docs/user-guide/basic-concepts/installing-ag2.md +++ b/website/docs/user-guide/basic-concepts/installing-ag2.mdx @@ -1,8 +1,9 @@ -## Install the AG2 Package - -:::tip +--- +title: Installing ag2 +--- + We recommended using a virtual environment for your project to keep your packages contained. See [venv](https://docs.python.org/3/library/venv.html). -::: + Install AG2 on your machine: diff --git a/website/docs/user-guide/basic-concepts/llm-configuration.md b/website/docs/user-guide/basic-concepts/llm-configuration.mdx similarity index 97% rename from website/docs/user-guide/basic-concepts/llm-configuration.md rename to website/docs/user-guide/basic-concepts/llm-configuration.mdx index 28ad37146e..8cfafe0390 100644 --- a/website/docs/user-guide/basic-concepts/llm-configuration.md +++ b/website/docs/user-guide/basic-concepts/llm-configuration.mdx @@ -1,4 +1,6 @@ -## LLM configurations +--- +title: LLM configuration +--- Your AG2 agents are likely to need to use an LLM and you can configure one, or more, for each agent. diff --git a/website/docs/user-guide/basic-concepts/orchestrations.md b/website/docs/user-guide/basic-concepts/orchestrations.mdx similarity index 93% rename from website/docs/user-guide/basic-concepts/orchestrations.md rename to website/docs/user-guide/basic-concepts/orchestrations.mdx index 2e33f6e915..3cffdc1748 100644 --- a/website/docs/user-guide/basic-concepts/orchestrations.md +++ b/website/docs/user-guide/basic-concepts/orchestrations.mdx @@ -1,4 +1,6 @@ -# Orchestrating many agents +--- +title: Orchestrating many agents +--- Many hands make for light work, so it's time to move on from our simple two-agent conversations and think about orchestrating workflows containing many agents, a strength of the AG2 framework. @@ -8,8 +10,8 @@ GroupChat contains a number of built-in conversation patterns to determine the n Swarm is a conversation pattern based on agents with handoffs. There's a shared context and each agent has tools and the ability to transfer control to other agents. The [original swarm concept](https://github.com/openai/swarm) was created by OpenAI. -:::note + We'll refer to *[conversation patterns](https://docs.ag2.ai/docs/tutorial/conversation-patterns)* throughout the documentation - they are simply a structured way of organizing the flow between agents. -::: + Next > groupchat.md diff --git a/website/docs/user-guide/basic-concepts/structured-outputs.md b/website/docs/user-guide/basic-concepts/structured-outputs.mdx similarity index 98% rename from website/docs/user-guide/basic-concepts/structured-outputs.md rename to website/docs/user-guide/basic-concepts/structured-outputs.mdx index 23bce7d05c..f87de8b7d4 100644 --- a/website/docs/user-guide/basic-concepts/structured-outputs.md +++ b/website/docs/user-guide/basic-concepts/structured-outputs.mdx @@ -1,4 +1,6 @@ -# Structured outputs +--- +title: Structured outputs +--- Working with freefrom text from LLMs isn't optimal when you know how you want the reply formatted. @@ -66,8 +68,8 @@ print(json.dumps(lesson_plan_json, indent=2)) "script": "Introduction (10 minutes):\nBegin the class by asking students what they already know about the solar system. Write their responses on the board. \n\nIntroduce the topic by explaining that today they will be learning about the solar system, which includes the Sun, planets, moons, and other celestial objects.\n\nDirect Instruction (20 minutes):\nUse a visual aid (such as a poster or video) to show the solar system's structure. \n\nDiscuss the eight planets: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune. \n\nFor each planet, mention:\n- Its position from the Sun.\n- Key characteristics (e.g., size, color, temperature).\n- Any notable features (e.g., rings, atmosphere). \n\nInteractive Activity (15 minutes):\nSplit the class into small groups. Give each group a set of planet cards that include pictures and information. Have them work together to put the planets in order from the Sun. Each group will present their order and one interesting fact about each planet they discussed." } ``` -::tip + Add a `format` function to the LessonPlan class in the example to convert the returned value into a string. [Example here](https://docs.ag2.ai/notebooks/agentchat_structured_outputs#define-the-reasoning-model-2). -:: + Next > ending-a-chat.md diff --git a/website/docs/user-guide/basic-concepts/swarm.md b/website/docs/user-guide/basic-concepts/swarm.mdx similarity index 99% rename from website/docs/user-guide/basic-concepts/swarm.md rename to website/docs/user-guide/basic-concepts/swarm.mdx index 77e9e9bd09..809ee1dea8 100644 --- a/website/docs/user-guide/basic-concepts/swarm.md +++ b/website/docs/user-guide/basic-concepts/swarm.mdx @@ -1,4 +1,6 @@ -## Swarm +--- +title: Swarm +--- Swarms provide controllable flows between agents that are determined at the agent-level. You define hand-off, post-tool, and post-work transitions from an agent to another agent (or to end the swarm). diff --git a/website/docs/user-guide/basic-concepts/tools.md b/website/docs/user-guide/basic-concepts/tools.mdx similarity index 97% rename from website/docs/user-guide/basic-concepts/tools.md rename to website/docs/user-guide/basic-concepts/tools.mdx index 1a3a8ecd54..4c12d36a42 100644 --- a/website/docs/user-guide/basic-concepts/tools.md +++ b/website/docs/user-guide/basic-concepts/tools.mdx @@ -1,12 +1,12 @@ -# Tools +--- +title: Tools +--- Agents gain significant utility through tools as they provide access to external data, APIs, and functionality. In AG2, using tools is done in two parts, an agent *suggests* which tools to use (via their LLM) and another *executes* the tool. -::note -In a conversation the executor agent must follow the agent that suggests a tool. -:: +In a conversation the executor agent must follow the agent that suggests a tool. In the swarm example above, we attached tools to our agents and, as part of the swarm, AG2 created a tool executor agent to run recommended tools. Typically, you'll create two agents, one to decide which tool to use and another to execute it. diff --git a/website/mint-json-template.json.jinja b/website/mint-json-template.json.jinja index 9ac85d718e..356cf0652d 100644 --- a/website/mint-json-template.json.jinja +++ b/website/mint-json-template.json.jinja @@ -66,18 +66,6 @@ { "name": "Ecosystem", "url": "ecosystem" - }, - { - "name": "Examples", - "url": "notebooks" - }, - { - "name": "Blog", - "url": "blog" - }, - { - "name": "Community Talks", - "url": "talks" } ], "anchors": [], @@ -100,7 +88,16 @@ { "group": "Basic Concepts", "pages": [ - "user-guide/openai-assistant/gpt_assistant_agent" + "docs/user-guide/basic-concepts/installing-ag2", + "docs/user-guide/basic-concepts/llm-configuration", + "docs/user-guide/basic-concepts/conversable-agent", + "docs/user-guide/basic-concepts/human-in-the-loop", + "docs/user-guide/basic-concepts/orchestrations", + "docs/user-guide/basic-concepts/groupchat", + "docs/user-guide/basic-concepts/swarm", + "docs/user-guide/basic-concepts/tools", + "docs/user-guide/basic-concepts/structured-outputs", + "docs/user-guide/basic-concepts/ending-a-chat" ] } ]