Skip to content

Commit 114a102

Browse files
make orchestrator example more clear
1 parent bddd80d commit 114a102

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

atomic-examples/orchestration-agent/orchestration_agent/orchestrator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ class OrchestratorInputSchema(BaseIOSchema):
3131

3232

3333
class OrchestratorOutputSchema(BaseIOSchema):
34-
"""Combined output schema for the Orchestrator Agent. Contains the tool to use and its parameters."""
34+
"""Combined output schema for the Orchestrator Agent. Contains the tool parameters."""
3535

36-
tool: str = Field(..., description="The tool to use: 'search' or 'calculator'")
3736
tool_parameters: Union[SearXNGSearchToolInputSchema, CalculatorToolInputSchema] = Field(
3837
..., description="The parameters for the selected tool"
3938
)
@@ -99,12 +98,12 @@ def get_info(self) -> str:
9998
def execute_tool(
10099
searxng_tool: SearXNGSearchTool, calculator_tool: CalculatorTool, orchestrator_output: OrchestratorOutputSchema
101100
) -> Union[SearXNGSearchToolOutputSchema, CalculatorToolOutputSchema]:
102-
if orchestrator_output.tool == "search":
101+
if isinstance(orchestrator_output.tool_parameters, SearXNGSearchToolInputSchema):
103102
return searxng_tool.run(orchestrator_output.tool_parameters)
104-
elif orchestrator_output.tool == "calculator":
103+
elif isinstance(orchestrator_output.tool_parameters, CalculatorToolInputSchema):
105104
return calculator_tool.run(orchestrator_output.tool_parameters)
106105
else:
107-
raise ValueError(f"Unknown tool: {orchestrator_output.tool}")
106+
raise ValueError(f"Unknown tool parameters type: {type(orchestrator_output.tool_parameters)}")
108107

109108

110109
#################

0 commit comments

Comments
 (0)