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

Make AgentChat Team Config Serializable #5071

Merged
merged 13 commits into from
Jan 24, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fomating updates
victordibia committed Jan 23, 2025
commit 9764d1617ccf5d3d18e0f1bf3949afedf31f3dff
Original file line number Diff line number Diff line change
@@ -2,11 +2,12 @@

from autogen_core import CancellationToken, Component, ComponentModel
from autogen_core.models import ChatCompletionClient, LLMMessage, SystemMessage, UserMessage
from pydantic import BaseModel
from typing_extensions import Self

from autogen_agentchat.base import Response
from autogen_agentchat.state import SocietyOfMindAgentState
from typing_extensions import Self
from pydantic import BaseModel

from ..base import TaskResult, Team
from ..messages import (
AgentEvent,
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Any, Mapping
from abc import ABC, abstractmethod
from ._task import TaskRunner
from pydantic import BaseModel
from typing import Any, Mapping

from autogen_core import ComponentBase
from pydantic import BaseModel

from ._task import TaskRunner


class Team(ABC, TaskRunner, ComponentBase[BaseModel]):
Original file line number Diff line number Diff line change
@@ -11,10 +11,10 @@
AgentType,
CancellationToken,
ClosureAgent,
ComponentBase,
MessageContext,
SingleThreadedAgentRuntime,
TypeSubscription,
ComponentBase,
)
from autogen_core._closure_agent import ClosureContext
from pydantic import BaseModel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import logging
from typing import Callable, List
from typing_extensions import Self
from pydantic import BaseModel

from autogen_core.models import ChatCompletionClient
from autogen_core import Component, ComponentModel
from autogen_core.models import ChatCompletionClient
from pydantic import BaseModel
from typing_extensions import Self

from .... import EVENT_LOGGER_NAME, TRACE_LOGGER_NAME
from ....base import ChatAgent, TerminationCondition
from .._base_group_chat import BaseGroupChat
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from typing import Any, Callable, List, Mapping

from autogen_core import Component, ComponentModel
from pydantic import BaseModel
from typing_extensions import Self

from ...base import ChatAgent, TerminationCondition
from ...messages import AgentEvent, ChatMessage
from ...state import RoundRobinManagerState
from ._base_group_chat import BaseGroupChat
from ._base_group_chat_manager import BaseGroupChatManager
from autogen_core import ComponentModel, Component
from typing_extensions import Self


class RoundRobinGroupChatManager(BaseGroupChatManager):
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import logging
import re
from typing import Any, Callable, Dict, List, Mapping, Sequence

from autogen_core import Component, ComponentModel
from autogen_core.models import ChatCompletionClient, SystemMessage
from pydantic import BaseModel
from typing_extensions import Self
from autogen_core.models import ChatCompletionClient, SystemMessage
from autogen_core import Component, ComponentModel

from ... import TRACE_LOGGER_NAME
from ...agents import BaseChatAgent
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from typing import Any, Callable, List, Mapping

from autogen_core import Component, ComponentModel
from pydantic import BaseModel

from ...base import ChatAgent, TerminationCondition
from ...messages import AgentEvent, ChatMessage, HandoffMessage
from ...state import SwarmManagerState
from ._base_group_chat import BaseGroupChat
from ._base_group_chat_manager import BaseGroupChatManager
from autogen_core import ComponentModel, Component


class SwarmGroupChatManager(BaseGroupChatManager):
2 changes: 1 addition & 1 deletion python/packages/autogen-agentchat/tests/test_group_chat.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
ToolCallRequestEvent,
ToolCallSummaryMessage,
)
from autogen_agentchat.teams import RoundRobinGroupChat, SelectorGroupChat, Swarm, MagenticOneGroupChat
from autogen_agentchat.teams import MagenticOneGroupChat, RoundRobinGroupChat, SelectorGroupChat, Swarm
from autogen_agentchat.teams._group_chat._round_robin_group_chat import RoundRobinGroupChatManager
from autogen_agentchat.teams._group_chat._selector_group_chat import SelectorGroupChatManager
from autogen_agentchat.teams._group_chat._swarm_group_chat import SwarmGroupChatManager
Original file line number Diff line number Diff line change
@@ -170,9 +170,9 @@
],
"source": [
"from autogen_agentchat.agents import AssistantAgent, UserProxyAgent\n",
"from autogen_agentchat.conditions import MaxMessageTermination\n",
"from autogen_agentchat.teams import RoundRobinGroupChat\n",
"from autogen_ext.models.openai import OpenAIChatCompletionClient\n",
"from autogen_agentchat.conditions import MaxMessageTermination\n",
"\n",
"# Create an agent that uses the OpenAI GPT-4o model.\n",
"model_client = OpenAIChatCompletionClient(\n",
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from enum import Enum
from typing import Any, Dict, List, Union
from abc import ABC, abstractmethod

from pydantic import BaseModel, ConfigDict

1 change: 1 addition & 0 deletions python/packages/autogen-core/tests/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any

import pytest
from autogen_core import CancellationToken
from autogen_core.memory import (