A programming framework for agentic AI
Fix type issues in exception_utils.py (#1972)
Jack Gerrits24418bd5d2f3
diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.ymlindex 498337c61..ee790d8d5 100644--- a/.github/workflows/type-check.yml+++ b/.github/workflows/type-check.yml@@ -19,4 +19,7 @@ jobs:- uses: actions/setup-python@v4- run: pip install ".[jupyter-executor]" mypy# As more modules are type check clean, add them here- - run: mypy --install-types --non-interactive autogen/logger+ - run: |+ mypy --install-types --non-interactive \+ autogen/logger \+ autogen/exception_utils.pydiff --git a/autogen/exception_utils.py b/autogen/exception_utils.pyindex 5685a7769..a5353f1f8 100644--- a/autogen/exception_utils.py+++ b/autogen/exception_utils.py@@ -1,12 +1,15 @@+from typing import Any++class AgentNameConflict(Exception):- def __init__(self, msg="Found multiple agents with the same name.", *args, **kwargs):+ def __init__(self, msg: str = "Found multiple agents with the same name.", *args: Any, **kwargs: Any):super().__init__(msg, *args, **kwargs)class NoEligibleSpeaker(Exception):"""Exception raised for early termination of a GroupChat."""- def __init__(self, message="No eligible speakers."):+ def __init__(self, message: str = "No eligible speakers."):self.message = messagesuper().__init__(self.message)@@ -14,7 +17,7 @@ class NoEligibleSpeaker(Exception):class SenderRequired(Exception):"""Exception raised when the sender is required but not provided."""- def __init__(self, message="Sender is required but not provided."):+ def __init__(self, message: str = "Sender is required but not provided."):self.message = messagesuper().__init__(self.message)@@ -23,7 +26,7 @@ class InvalidCarryOverType(Exception):"""Exception raised when the carryover type is invalid."""def __init__(- self, message="Carryover should be a string or a list of strings. Not adding carryover to the message."+ self, message: str = "Carryover should be a string or a list of strings. Not adding carryover to the message."):self.message = messagesuper().__init__(self.message)@@ -32,6 +35,6 @@ class InvalidCarryOverType(Exception):class UndefinedNextAgent(Exception):"""Exception raised when the provided next agents list does not overlap with agents in the group."""- def __init__(self, message="The provided agents list does not overlap with agents in the group."):+ def __init__(self, message: str = "The provided agents list does not overlap with agents in the group."):self.message = messagesuper().__init__(self.message)