forked from microsoft/autogen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exception_utils.py
40 lines (26 loc) · 1.32 KB
/
exception_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from typing import Any
class AgentNameConflict(Exception):
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: str = "No eligible speakers."):
self.message = message
super().__init__(self.message)
class SenderRequired(Exception):
"""Exception raised when the sender is required but not provided."""
def __init__(self, message: str = "Sender is required but not provided."):
self.message = message
super().__init__(self.message)
class InvalidCarryOverType(Exception):
"""Exception raised when the carryover type is invalid."""
def __init__(
self, message: str = "Carryover should be a string or a list of strings. Not adding carryover to the message."
):
self.message = message
super().__init__(self.message)
class UndefinedNextAgent(Exception):
"""Exception raised when the provided next 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 = message
super().__init__(self.message)