Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits committed Jan 11, 2025
1 parent a73b201 commit 33e2428
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import warnings
from typing import List
from typing import Awaitable, Callable, List, Optional, Union

Check warning on line 2 in python/packages/autogen-ext/src/autogen_ext/teams/magentic_one.py

View check run for this annotation

Codecov / codecov/patch

python/packages/autogen-ext/src/autogen_ext/teams/magentic_one.py#L2

Added line #L2 was not covered by tests

from autogen_agentchat.agents import CodeExecutorAgent, UserProxyAgent
from autogen_agentchat.base import ChatAgent
from autogen_agentchat.teams import MagenticOneGroupChat
from autogen_core import CancellationToken

Check warning on line 7 in python/packages/autogen-ext/src/autogen_ext/teams/magentic_one.py

View check run for this annotation

Codecov / codecov/patch

python/packages/autogen-ext/src/autogen_ext/teams/magentic_one.py#L7

Added line #L7 was not covered by tests
from autogen_core.models import ChatCompletionClient

from autogen_ext.agents.file_surfer import FileSurfer
Expand All @@ -12,6 +13,10 @@
from autogen_ext.code_executors.local import LocalCommandLineCodeExecutor
from autogen_ext.models.openai._openai_client import BaseOpenAIChatCompletionClient

SyncInputFunc = Callable[[str], str]
AsyncInputFunc = Callable[[str, Optional[CancellationToken]], Awaitable[str]]
InputFuncType = Union[SyncInputFunc, AsyncInputFunc]

Check warning on line 18 in python/packages/autogen-ext/src/autogen_ext/teams/magentic_one.py

View check run for this annotation

Codecov / codecov/patch

python/packages/autogen-ext/src/autogen_ext/teams/magentic_one.py#L16-L18

Added lines #L16 - L18 were not covered by tests


class MagenticOne(MagenticOneGroupChat):
"""
Expand Down Expand Up @@ -120,7 +125,7 @@ def __init__(
self,
client: ChatCompletionClient,
hil_mode: bool = False,
input_func: UserProxyAgent.InputFuncType | None = None,
input_func: InputFuncType | None = None,
):
self.client = client
self._validate_client_capabilities(client)
Expand Down
8 changes: 3 additions & 5 deletions python/packages/magentic-one-cli/src/magentic_one_cli/_m1.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import argparse
import asyncio
from typing import Optional
import warnings
from typing import Optional

from autogen_agentchat.ui import Console
from autogen_agentchat.ui import UserInputManager
from aioconsole import ainput # type: ignore
from autogen_agentchat.ui import Console, UserInputManager
from autogen_core import CancellationToken
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.teams.magentic_one import MagenticOne
Expand All @@ -13,8 +13,6 @@
warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning)




async def cancellable_input(prompt: str, cancellation_token: Optional[CancellationToken]) -> str:
task: asyncio.Task[str] = asyncio.create_task(ainput(prompt)) # type: ignore
if cancellation_token is not None:
Expand Down

0 comments on commit 33e2428

Please sign in to comment.