diff --git a/python/packages/agbench/benchmarks/AssistantBench/Templates/MagenticOne/scenario.py b/python/packages/agbench/benchmarks/AssistantBench/Templates/MagenticOne/scenario.py index 3d79a16614a4..17d9125195d1 100644 --- a/python/packages/agbench/benchmarks/AssistantBench/Templates/MagenticOne/scenario.py +++ b/python/packages/agbench/benchmarks/AssistantBench/Templates/MagenticOne/scenario.py @@ -12,9 +12,7 @@ from autogen_core.application import SingleThreadedAgentRuntime from autogen_core.application.logging import EVENT_LOGGER_NAME from autogen_core.components.models import ( - AzureOpenAIChatCompletionClient, ChatCompletionClient, - ModelCapabilities, UserMessage, LLMMessage, ) diff --git a/python/packages/agbench/benchmarks/GAIA/Templates/MagenticOne/scenario.py b/python/packages/agbench/benchmarks/GAIA/Templates/MagenticOne/scenario.py index 4058d75f3971..6c7f8ab763a5 100644 --- a/python/packages/agbench/benchmarks/GAIA/Templates/MagenticOne/scenario.py +++ b/python/packages/agbench/benchmarks/GAIA/Templates/MagenticOne/scenario.py @@ -12,7 +12,6 @@ from autogen_core.application import SingleThreadedAgentRuntime from autogen_core.application.logging import EVENT_LOGGER_NAME from autogen_core.components.models import ( - AzureOpenAIChatCompletionClient, ChatCompletionClient, ModelCapabilities, UserMessage, diff --git a/python/packages/agbench/benchmarks/HumanEval/Templates/MagenticOne/scenario.py b/python/packages/agbench/benchmarks/HumanEval/Templates/MagenticOne/scenario.py index 3229eba12589..a9b62a1e38e1 100644 --- a/python/packages/agbench/benchmarks/HumanEval/Templates/MagenticOne/scenario.py +++ b/python/packages/agbench/benchmarks/HumanEval/Templates/MagenticOne/scenario.py @@ -7,8 +7,6 @@ from autogen_core.components import DefaultSubscription, DefaultTopicId from autogen_core.components.code_executor import LocalCommandLineCodeExecutor from autogen_core.components.models import ( - AzureOpenAIChatCompletionClient, - ModelCapabilities, UserMessage, ) diff --git a/python/packages/agbench/benchmarks/WebArena/Templates/MagenticOne/scenario.py b/python/packages/agbench/benchmarks/WebArena/Templates/MagenticOne/scenario.py index 79a36862f9d2..5cbf5c4c2134 100644 --- a/python/packages/agbench/benchmarks/WebArena/Templates/MagenticOne/scenario.py +++ b/python/packages/agbench/benchmarks/WebArena/Templates/MagenticOne/scenario.py @@ -13,9 +13,7 @@ from autogen_core.components import DefaultSubscription, DefaultTopicId from autogen_core.components.code_executor import LocalCommandLineCodeExecutor from autogen_core.components.models import ( - AzureOpenAIChatCompletionClient, ChatCompletionClient, - ModelCapabilities, UserMessage, SystemMessage, LLMMessage, diff --git a/python/packages/autogen-agentchat/tests/test_group_chat.py b/python/packages/autogen-agentchat/tests/test_group_chat.py index e297c8fd5100..21fb2ad4082c 100644 --- a/python/packages/autogen-agentchat/tests/test_group_chat.py +++ b/python/packages/autogen-agentchat/tests/test_group_chat.py @@ -24,8 +24,9 @@ from autogen_core.base import CancellationToken from autogen_core.components import FunctionCall from autogen_core.components.code_executor import LocalCommandLineCodeExecutor -from autogen_core.components.models import FunctionExecutionResult, OpenAIChatCompletionClient +from autogen_core.components.models import FunctionExecutionResult from autogen_core.components.tools import FunctionTool +from autogen_ext.models import OpenAIChatCompletionClient from openai.resources.chat.completions import AsyncCompletions from openai.types.chat.chat_completion import ChatCompletion, Choice from openai.types.chat.chat_completion_chunk import ChatCompletionChunk diff --git a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/azure-openai-with-aad-auth.md b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/azure-openai-with-aad-auth.md index a40cf0475c5d..c8e4b632bd03 100644 --- a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/azure-openai-with-aad-auth.md +++ b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/azure-openai-with-aad-auth.md @@ -15,7 +15,7 @@ pip install azure-identity ## Using the Model Client ```python -from autogen_core.components.models import AzureOpenAIChatCompletionClient +from autogen_ext.models import AzureOpenAIChatCompletionClient from azure.identity import DefaultAzureCredential, get_bearer_token_provider # Create the token provider diff --git a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/structured-output-agent.ipynb b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/structured-output-agent.ipynb index 17b9141c5ae7..fa50d6da2797 100644 --- a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/structured-output-agent.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/structured-output-agent.ipynb @@ -65,7 +65,8 @@ "import os\n", "from typing import Optional\n", "\n", - "from autogen_core.components.models import AzureOpenAIChatCompletionClient, UserMessage\n", + "from autogen_core.components.models import UserMessage\n", + "from autogen_ext.models import AzureOpenAIChatCompletionClient\n", "\n", "\n", "# Function to get environment variable and ensure it is not None\n", diff --git a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/tool-use-with-intervention.ipynb b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/tool-use-with-intervention.ipynb index 44f9978e59ef..e7c41c41feb4 100644 --- a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/tool-use-with-intervention.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/tool-use-with-intervention.ipynb @@ -26,13 +26,13 @@ "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, ToolException, tool_agent_caller_loop\n", "from autogen_core.components.tools import PythonCodeExecutionTool, ToolSchema\n", - "from autogen_ext.code_executors import DockerCommandLineCodeExecutor" + "from autogen_ext.code_executors import DockerCommandLineCodeExecutor\n", + "from autogen_ext.models import OpenAIChatCompletionClient" ] }, { diff --git a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/group-chat.ipynb b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/group-chat.ipynb index 14dc6d2e9fef..3238656c426b 100644 --- a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/group-chat.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/group-chat.ipynb @@ -86,11 +86,11 @@ " AssistantMessage,\n", " ChatCompletionClient,\n", " LLMMessage,\n", - " OpenAIChatCompletionClient,\n", " SystemMessage,\n", " UserMessage,\n", ")\n", "from autogen_core.components.tools import FunctionTool\n", + "from autogen_ext.models import OpenAIChatCompletionClient\n", "from IPython.display import display # type: ignore\n", "from pydantic import BaseModel\n", "from rich.console import Console\n", diff --git a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/handoffs.ipynb b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/handoffs.ipynb index 6a952c6e3961..6fb9f71782b0 100644 --- a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/handoffs.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/design-patterns/handoffs.ipynb @@ -65,11 +65,11 @@ " FunctionExecutionResult,\n", " FunctionExecutionResultMessage,\n", " LLMMessage,\n", - " OpenAIChatCompletionClient,\n", " SystemMessage,\n", " UserMessage,\n", ")\n", "from autogen_core.components.tools import FunctionTool, Tool\n", + "from autogen_ext.models import OpenAIChatCompletionClient\n", "from pydantic import BaseModel" ] }, diff --git a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/model-clients.ipynb b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/model-clients.ipynb index 237b68ae0d33..b2b60be1458b 100644 --- a/python/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/model-clients.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/model-clients.ipynb @@ -184,7 +184,7 @@ "metadata": {}, "outputs": [], "source": [ - "from autogen_core.components.models import AzureOpenAIChatCompletionClient\n", + "from autogen_ext.models import AzureOpenAIChatCompletionClient\n", "from azure.identity import DefaultAzureCredential, get_bearer_token_provider\n", "\n", "# Create the token provider\n", diff --git a/python/packages/autogen-ext/tests/models/test_openai_model_client.py b/python/packages/autogen-ext/tests/models/test_openai_model_client.py index c09e5654cd6d..f712ef75c5b2 100644 --- a/python/packages/autogen-ext/tests/models/test_openai_model_client.py +++ b/python/packages/autogen-ext/tests/models/test_openai_model_client.py @@ -165,7 +165,7 @@ def tool2(test1: int, test2: List[int]) -> str: mockcalculate_vision_tokens = MagicMock() monkeypatch.setattr( - "autogen_core.components.models._openai_client.calculate_vision_tokens", mockcalculate_vision_tokens + "autogen_ext.models._openai._openai_client.calculate_vision_tokens", mockcalculate_vision_tokens ) num_tokens = client.count_tokens(messages, tools=tools) diff --git a/python/packages/autogen-magentic-one/pyproject.toml b/python/packages/autogen-magentic-one/pyproject.toml index 72f6ef6f4033..a82de9bd6141 100644 --- a/python/packages/autogen-magentic-one/pyproject.toml +++ b/python/packages/autogen-magentic-one/pyproject.toml @@ -18,6 +18,7 @@ classifiers = [ dependencies = [ "autogen-core", + "autogen-ext", "beautifulsoup4", "aiofiles", "requests", diff --git a/python/packages/autogen-magentic-one/src/autogen_magentic_one/utils.py b/python/packages/autogen-magentic-one/src/autogen_magentic_one/utils.py index e47b24b25816..c7b15fe89e65 100644 --- a/python/packages/autogen-magentic-one/src/autogen_magentic_one/utils.py +++ b/python/packages/autogen-magentic-one/src/autogen_magentic_one/utils.py @@ -8,11 +8,10 @@ from autogen_core.application.logging.events import LLMCallEvent from autogen_core.components import Image from autogen_core.components.models import ( - AzureOpenAIChatCompletionClient, ChatCompletionClient, ModelCapabilities, - OpenAIChatCompletionClient, ) +from autogen_ext.models import AzureOpenAIChatCompletionClient, OpenAIChatCompletionClient from .messages import ( AgentEvent, diff --git a/python/uv.lock b/python/uv.lock index a880003cce3e..d50453065b0f 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -522,6 +522,7 @@ source = { editable = "packages/autogen-magentic-one" } dependencies = [ { name = "aiofiles" }, { name = "autogen-core" }, + { name = "autogen-ext" }, { name = "beautifulsoup4" }, { name = "mammoth" }, { name = "markdownify" }, @@ -554,6 +555,7 @@ dev = [ requires-dist = [ { name = "aiofiles" }, { name = "autogen-core", editable = "packages/autogen-core" }, + { name = "autogen-ext", editable = "packages/autogen-ext" }, { name = "beautifulsoup4" }, { name = "mammoth" }, { name = "markdownify" },