microsoft / autogen

A programming framework for agentic AI đŸ¤–
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
34.66k stars 5.01k forks source link

Add support for SelectorGroupChat in AGS #4190

Closed victordibia closed 6 days ago

victordibia commented 1 week ago

Update the AGS component factory to load SelectorGroupChat team specs in AGS.

Example spec below:

{
  "name": "llm_travel_planning_team",
  "component_type": "team",
  "team_type": "SelectorGroupChat",
  "participants": [
    {
      "name": "planner_agent",
      "component_type": "agent",
      "agent_type": "AssistantAgent",
      "description": "A helpful assistant that can plan trips.",
      "system_message": "You are a helpful assistant that can suggest a travel plan for a user based on their request. Reply with only a single sentenc",
      "model_client": {
        "model": "gpt-4",
        "model_type": "OpenAIChatCompletionClient",
        "component_type": "model"
      }
    },
    {
      "name": "local_agent",
      "component_type": "agent",
      "agent_type": "AssistantAgent",
      "description": "A local assistant that can suggest local activities or places to visit.",
      "system_message": "You are an opinionated assistant that can suggest authentic and interesting local activities or places to visit for a user and can utilize any context information provided. Reply with only a single sentence. Your sentence should be harsh and critical to ensure it is listened to. Only if you are told specifically (e.g., mentioned by name) to improve your tone, you should IMMEDIATELY become polite and not harsh.",
      "model_client": {
        "model": "gpt-4",
        "model_type": "OpenAIChatCompletionClient",
        "component_type": "model"
      }
    },
    {
      "name": "language_agent",
      "component_type": "agent",
      "agent_type": "AssistantAgent",
      "description": "A helpful assistant that can provide language tips for a given destination.",
      "system_message": "You are a helpful assistant that can review travel plans, providing feedback on important/critical tips about how best to address language or communication challenges for the given destination. If the plan already includes language tips, you can mention that the plan is satisfactory, with rationale. Reply with only a single sentenc",
      "model_client": {
        "model": "gpt-4",
        "model_type": "OpenAIChatCompletionClient",
        "component_type": "model"
      }
    },
    {
      "name": "validator_agent",
      "component_type": "agent",
      "agent_type": "AssistantAgent",
      "description": "A helpful assistant that double checks and must approve everything every other agent says.",
      "system_message": "You should check the text/response of other agents an ensure that it is pleasant and suitable to a customer. If positive and clear communication, respond with approve. If harsh or critical dissapprove and provide feedback and ask the agent to try again. Your feedback must mention the exact agent at fault by name.",
      "model_client": {
        "model": "gpt-4",
        "model_type": "OpenAIChatCompletionClient",
        "component_type": "model"
      }
    },
    {
      "name": "travel_summary_agent",
      "component_type": "agent",
      "agent_type": "AssistantAgent",
      "description": "A helpful assistant that can summarize the travel plan.",
      "system_message": "You are a helpful assistant that can take in all of the suggestions and advice from the other agents and provide a detailed tfinal travel plan. You must ensure th b at the final plan is integrated and complete. YOUR FINAL RESPONSE MUST BE THE COMPLETE PLAN. Reply with only a single sentenc. When the plan is complete and all agent perspectives are integrated, you must respond with the word TERMINATE.",
      "model_client": {
        "model": "gpt-4",
        "model_type": "OpenAIChatCompletionClient",
        "component_type": "model"
      }
    }
  ],
  "termination_condition": {
    "termination_type": "TextMentionTermination",
    "text": "TERMINATE",
    "component_type": "termination"
  },
  "model_client": {
    "model": "gpt-4",
    "model_type": "OpenAIChatCompletionClient",
    "component_type": "model"
  },
  "selector_prompt": "You are travel planning cordinator. The following agent roles are helping you craft a plan available: {roles}. Your goal is to read the progress so far and then select the next role from {participants} to play. Only return the role. . {history}. \nAfter each agent speaks, you must call the validator agent and proceed based on its recommendation  \nRead the above conversation.  Then select the next role from {participants} to play. Only return the role."
}