|
|
|
@ -2,7 +2,7 @@ import concurrent.futures
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import traceback
|
|
|
|
import traceback
|
|
|
|
from typing import Any, Callable, Dict, List, Literal, Optional, Union
|
|
|
|
from typing import Any, Callable, Dict, List, Literal, Optional, Union, get_args
|
|
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
|
@ -46,6 +46,7 @@ SwarmType = Literal[
|
|
|
|
"CouncilAsAJudge",
|
|
|
|
"CouncilAsAJudge",
|
|
|
|
"InteractiveGroupChat",
|
|
|
|
"InteractiveGroupChat",
|
|
|
|
"HeavySwarm",
|
|
|
|
"HeavySwarm",
|
|
|
|
|
|
|
|
"BatchedGridWorkflow",
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -273,23 +274,7 @@ class SwarmRouter:
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Validate swarm type is a valid string
|
|
|
|
# Validate swarm type is a valid string
|
|
|
|
valid_swarm_types = [
|
|
|
|
valid_swarm_types = get_args(SwarmType)
|
|
|
|
"AgentRearrange",
|
|
|
|
|
|
|
|
"MixtureOfAgents",
|
|
|
|
|
|
|
|
"SequentialWorkflow",
|
|
|
|
|
|
|
|
"ConcurrentWorkflow",
|
|
|
|
|
|
|
|
"GroupChat",
|
|
|
|
|
|
|
|
"MultiAgentRouter",
|
|
|
|
|
|
|
|
"AutoSwarmBuilder",
|
|
|
|
|
|
|
|
"HiearchicalSwarm",
|
|
|
|
|
|
|
|
"auto",
|
|
|
|
|
|
|
|
"MajorityVoting",
|
|
|
|
|
|
|
|
"MALT",
|
|
|
|
|
|
|
|
"CouncilAsAJudge",
|
|
|
|
|
|
|
|
"InteractiveGroupChat",
|
|
|
|
|
|
|
|
"HeavySwarm",
|
|
|
|
|
|
|
|
"BatchedGridWorkflow",
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not isinstance(self.swarm_type, str):
|
|
|
|
if not isinstance(self.swarm_type, str):
|
|
|
|
raise SwarmRouterConfigError(
|
|
|
|
raise SwarmRouterConfigError(
|
|
|
|
|