mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
organize core submodule (#27)
This commit is contained in:
@@ -2,10 +2,8 @@ import asyncio
|
||||
from dataclasses import dataclass
|
||||
|
||||
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
|
||||
from agnext.application_components.single_threaded_agent_runtime import SingleThreadedAgentRuntime
|
||||
from agnext.core.agent import Agent
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.application_components import SingleThreadedAgentRuntime
|
||||
from agnext.core import Agent, AgentRuntime, CancellationToken
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
|
||||
import openai
|
||||
from agnext.agent_components.model_client import OpenAI
|
||||
from agnext.application_components.single_threaded_agent_runtime import (
|
||||
from agnext.application_components import (
|
||||
SingleThreadedAgentRuntime,
|
||||
)
|
||||
from agnext.chat.agents.oai_assistant import OpenAIAssistantAgent
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
from typing import Any, Callable, Coroutine, Dict, NoReturn, Sequence, Type, TypeVar
|
||||
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.base_agent import BaseAgent
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core import AgentRuntime, BaseAgent, CancellationToken
|
||||
from agnext.core.exceptions import CantHandleException
|
||||
|
||||
ReceivesT = TypeVar("ReceivesT")
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
The :mod:`agnext.application_components` module provides implementations of core components that are used to compose an application
|
||||
"""
|
||||
|
||||
from ._single_threaded_agent_runtime import SingleThreadedAgentRuntime
|
||||
|
||||
__all__ = ["SingleThreadedAgentRuntime"]
|
||||
|
||||
@@ -3,12 +3,9 @@ from asyncio import Future
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Awaitable, Dict, List, Set
|
||||
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core.exceptions import MessageDroppedException
|
||||
from agnext.core.intervention import DropMessage, InterventionHandler
|
||||
|
||||
from ..core.agent import Agent
|
||||
from ..core.agent_runtime import AgentRuntime
|
||||
from ..core import Agent, AgentRuntime, CancellationToken
|
||||
from ..core.exceptions import MessageDroppedException
|
||||
from ..core.intervention import DropMessage, InterventionHandler
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
@@ -1,5 +1,4 @@
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.base_agent import BaseAgent
|
||||
from agnext.core import AgentRuntime, BaseAgent
|
||||
|
||||
|
||||
class BaseChatAgent(BaseAgent):
|
||||
|
||||
@@ -3,8 +3,7 @@ import openai
|
||||
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
|
||||
from agnext.chat.agents.base import BaseChatAgent
|
||||
from agnext.chat.types import Reset, RespondNow, TextMessage
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core import AgentRuntime, CancellationToken
|
||||
|
||||
|
||||
class OpenAIAssistantAgent(BaseChatAgent, TypeRoutedAgent):
|
||||
|
||||
@@ -2,7 +2,7 @@ import random
|
||||
|
||||
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
|
||||
from agnext.chat.types import RespondNow, TextMessage
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core import CancellationToken
|
||||
|
||||
from ..agents.base import BaseChatAgent
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ from typing import Any, List, Protocol, Sequence
|
||||
|
||||
from agnext.chat.types import Reset, RespondNow
|
||||
|
||||
from ...core.agent_runtime import AgentRuntime
|
||||
from ...core.cancellation_token import CancellationToken
|
||||
from ...core import AgentRuntime, CancellationToken
|
||||
from ..agents.base import BaseChatAgent
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ from typing import Any, List, Sequence, Tuple
|
||||
from ...agent_components.model_client import ModelClient
|
||||
from ...agent_components.type_routed_agent import TypeRoutedAgent, message_handler
|
||||
from ...agent_components.types import AssistantMessage, LLMMessage, UserMessage
|
||||
from ...core.agent_runtime import AgentRuntime
|
||||
from ...core.cancellation_token import CancellationToken
|
||||
from ...core import AgentRuntime, CancellationToken
|
||||
from ..agents.base import BaseChatAgent
|
||||
from ..messages import ChatMessage
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
"""
|
||||
The :mod:`agnext.core` module provides the foundational generic interfaces upon which all else is built. This module must not depend on any other module.
|
||||
"""
|
||||
|
||||
from ._agent import Agent
|
||||
from ._agent_runtime import AgentRuntime
|
||||
from ._base_agent import BaseAgent
|
||||
from ._cancellation_token import CancellationToken
|
||||
|
||||
__all__ = ["Agent", "AgentRuntime", "BaseAgent", "CancellationToken"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Protocol, Sequence, runtime_checkable
|
||||
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core._cancellation_token import CancellationToken
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
@@ -1,8 +1,8 @@
|
||||
from asyncio import Future
|
||||
from typing import Any, Protocol
|
||||
|
||||
from agnext.core.agent import Agent
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core._agent import Agent
|
||||
from agnext.core._cancellation_token import CancellationToken
|
||||
|
||||
# Undeliverable - error
|
||||
|
||||
@@ -2,10 +2,10 @@ from abc import ABC, abstractmethod
|
||||
from asyncio import Future
|
||||
from typing import Any, Sequence, TypeVar
|
||||
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.core._agent_runtime import AgentRuntime
|
||||
from agnext.core._cancellation_token import CancellationToken
|
||||
|
||||
from .agent import Agent
|
||||
from ._agent import Agent
|
||||
|
||||
ConsumesT = TypeVar("ConsumesT")
|
||||
ProducesT = TypeVar("ProducesT", covariant=True)
|
||||
@@ -1,3 +1,10 @@
|
||||
__all__ = [
|
||||
"CantHandleException",
|
||||
"UndeliverableException",
|
||||
"MessageDroppedException",
|
||||
]
|
||||
|
||||
|
||||
class CantHandleException(Exception):
|
||||
"""Raised when a handler can't handle the exception."""
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
from typing import Any, Awaitable, Callable, Protocol, Sequence, final
|
||||
|
||||
from agnext.core.agent import Agent
|
||||
from agnext.core import Agent
|
||||
|
||||
__all__ = [
|
||||
"DropMessage",
|
||||
"InterventionFunction",
|
||||
"InterventionHandler",
|
||||
"DefaultInterventionHandler",
|
||||
]
|
||||
|
||||
|
||||
@final
|
||||
|
||||
@@ -3,10 +3,10 @@ import pytest
|
||||
from dataclasses import dataclass
|
||||
|
||||
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
|
||||
from agnext.application_components.single_threaded_agent_runtime import SingleThreadedAgentRuntime
|
||||
from agnext.core.agent import Agent
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.application_components import SingleThreadedAgentRuntime
|
||||
from agnext.core import Agent
|
||||
from agnext.core import AgentRuntime
|
||||
from agnext.core import CancellationToken
|
||||
|
||||
@dataclass
|
||||
class MessageType:
|
||||
|
||||
@@ -2,10 +2,10 @@ import pytest
|
||||
from dataclasses import dataclass
|
||||
|
||||
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
|
||||
from agnext.application_components.single_threaded_agent_runtime import SingleThreadedAgentRuntime
|
||||
from agnext.core.agent import Agent
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.application_components import SingleThreadedAgentRuntime
|
||||
from agnext.core import Agent
|
||||
from agnext.core import AgentRuntime
|
||||
from agnext.core import CancellationToken
|
||||
from agnext.core.exceptions import MessageDroppedException
|
||||
from agnext.core.intervention import DefaultInterventionHandler, DropMessage
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from typing import Any, Sequence
|
||||
import pytest
|
||||
|
||||
from agnext.application_components.single_threaded_agent_runtime import SingleThreadedAgentRuntime
|
||||
from agnext.core.agent_runtime import AgentRuntime
|
||||
from agnext.core.base_agent import BaseAgent
|
||||
from agnext.core.cancellation_token import CancellationToken
|
||||
from agnext.application_components import SingleThreadedAgentRuntime
|
||||
from agnext.core import AgentRuntime
|
||||
from agnext.core import BaseAgent
|
||||
from agnext.core import CancellationToken
|
||||
|
||||
class NoopAgent(BaseAgent):
|
||||
def __init__(self, name: str, router: AgentRuntime) -> None:
|
||||
|
||||
Reference in New Issue
Block a user