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

Delete autogen-ext refactor deprecations #4305

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"from autogen_agentchat.logging import ConsoleLogHandler\n",
"from autogen_agentchat.task import MaxMessageTermination, TextMentionTermination\n",
"from autogen_agentchat.teams import RoundRobinGroupChat\n",
"from autogen_core.components.models import OpenAIChatCompletionClient\n",
"from autogen_ext.models import OpenAIChatCompletionClient\n",
"\n",
"logger = logging.getLogger(EVENT_LOGGER_NAME)\n",
"logger.addHandler(ConsoleLogHandler())\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
"from autogen_core.components.models import (\n",
" AssistantMessage,\n",
" ChatCompletionClient,\n",
" OpenAIChatCompletionClient,\n",
" SystemMessage,\n",
" UserMessage,\n",
")"
")\n",
"from autogen_ext.models import OpenAIChatCompletionClient"
]
},
{
Expand All @@ -65,7 +65,7 @@
"metadata": {},
"outputs": [],
"source": [
"def get_model_client() -> OpenAIChatCompletionClient:\n",
"def get_model_client() -> OpenAIChatCompletionClient: # type: ignore\n",
jackgerrits marked this conversation as resolved.
Show resolved Hide resolved
" \"Mimic OpenAI API using Local LLM Server.\"\n",
" return OpenAIChatCompletionClient(\n",
" model=\"gpt-4o\", # Need to use one of the OpenAI models as a placeholder for now.\n",
Expand Down Expand Up @@ -233,7 +233,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"from autogen_core.application import SingleThreadedAgentRuntime\n",
"from autogen_core.base import AgentId, MessageContext\n",
"from autogen_core.components import RoutedAgent, message_handler\n",
"from autogen_core.components.models import ChatCompletionClient, OpenAIChatCompletionClient, SystemMessage, UserMessage"
"from autogen_core.components.models import ChatCompletionClient, SystemMessage, UserMessage\n",
"from autogen_ext.models import OpenAIChatCompletionClient"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
" AssistantMessage,\n",
" ChatCompletionClient,\n",
" LLMMessage,\n",
" OpenAIChatCompletionClient,\n",
" SystemMessage,\n",
" UserMessage,\n",
")"
")\n",
"from autogen_ext.models import OpenAIChatCompletionClient"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@
"from autogen_core.components.models import (\n",
" ChatCompletionClient,\n",
" LLMMessage,\n",
" OpenAIChatCompletionClient,\n",
" SystemMessage,\n",
" UserMessage,\n",
")\n",
"from autogen_core.components.tool_agent import ToolAgent, tool_agent_caller_loop\n",
"from autogen_core.components.tools import FunctionTool, Tool, ToolSchema\n",
"from autogen_ext.models import OpenAIChatCompletionClient\n",
"\n",
"\n",
"@dataclass\n",
Expand Down
3 changes: 1 addition & 2 deletions python/packages/autogen-core/samples/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

from autogen_core.components.models import (
AssistantMessage,
AzureOpenAIChatCompletionClient,
ChatCompletionClient,
FunctionExecutionResult,
FunctionExecutionResultMessage,
LLMMessage,
OpenAIChatCompletionClient,
UserMessage,
)
from autogen_ext.models import AzureOpenAIChatCompletionClient, OpenAIChatCompletionClient
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from typing_extensions import Literal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from autogen_core.components.models import (
LLMMessage,
)
from autogen_core.components.models.config import AzureOpenAIClientConfiguration
from autogen_ext.models import AzureOpenAIClientConfiguration
from pydantic import BaseModel


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import yaml
from _types import AppConfig
from autogen_core.base import MessageSerializer, try_get_known_serializers_for_type
from autogen_core.components.models.config import AzureOpenAIClientConfiguration
from autogen_ext.models import AzureOpenAIClientConfiguration
from azure.identity import DefaultAzureCredential, get_bearer_token_provider


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import importlib
import warnings
from typing import TYPE_CHECKING, Any

from ._model_client import ChatCompletionClient, ModelCapabilities
from ._types import (
AssistantMessage,
Expand All @@ -17,13 +13,7 @@
UserMessage,
)

if TYPE_CHECKING:
from ._openai_client import AzureOpenAIChatCompletionClient, OpenAIChatCompletionClient


__all__ = [
"AzureOpenAIChatCompletionClient",
"OpenAIChatCompletionClient",
"ModelCapabilities",
"ChatCompletionClient",
"SystemMessage",
Expand All @@ -38,23 +28,3 @@
"TopLogprob",
"ChatCompletionTokenLogprob",
]


def __getattr__(name: str) -> Any:
deprecated_classes = {
"AzureOpenAIChatCompletionClient": "autogen_ext.models.AzureOpenAIChatCompletionClient",
"OpenAIChatCompletionClient": "autogen_ext.modelsChatCompletionClient",
}
if name in deprecated_classes:
warnings.warn(
f"{name} moved to autogen_ext. " f"Please import it from {deprecated_classes[name]}.",
FutureWarning,
stacklevel=2,
)
# Dynamically import the class from the current module
module = importlib.import_module("._openai_client", __name__)
attr = getattr(module, name)
# Cache the attribute in the module's global namespace
globals()[name] = attr
return attr
raise AttributeError(f"module {__name__} has no attribute {name}")
Loading
Loading