@@ -55,15 +55,17 @@ def __init__(
55
55
GroupChatReset ,
56
56
],
57
57
)
58
- self ._name = name
59
- self ._group_topic_type = group_topic_type
60
- self ._output_topic_type = output_topic_type
58
+ if max_turns is not None and max_turns <= 0 :
59
+ raise ValueError ("The maximum number of turns must be greater than 0." )
61
60
if len (participant_topic_types ) != len (participant_descriptions ):
62
61
raise ValueError ("The number of participant topic types, agent types, and descriptions must be the same." )
63
62
if len (set (participant_topic_types )) != len (participant_topic_types ):
64
63
raise ValueError ("The participant topic types must be unique." )
65
64
if group_topic_type in participant_topic_types :
66
65
raise ValueError ("The group topic type must not be in the participant topic types." )
66
+ self ._name = name
67
+ self ._group_topic_type = group_topic_type
68
+ self ._output_topic_type = output_topic_type
67
69
self ._participant_names = participant_names
68
70
self ._participant_name_to_topic_type = {
69
71
name : topic_type for name , topic_type in zip (participant_names , participant_topic_types , strict = True )
@@ -72,8 +74,6 @@ def __init__(
72
74
self ._message_thread : List [BaseAgentEvent | BaseChatMessage ] = []
73
75
self ._output_message_queue = output_message_queue
74
76
self ._termination_condition = termination_condition
75
- if max_turns is not None and max_turns <= 0 :
76
- raise ValueError ("The maximum number of turns must be greater than 0." )
77
77
self ._max_turns = max_turns
78
78
self ._current_turn = 0
79
79
self ._message_factory = message_factory
0 commit comments