Skip to content

Building AI agents, atomically

Refactor orchestrator notebook to handle different response schemas

KennyVaneetvelde9d29a93443f9
diff --git a/examples/notebooks/orchestrator.ipynb b/examples/notebooks/orchestrator.ipynb
index c77a6d0..1ad4c5a 100644
--- a/examples/notebooks/orchestrator.ipynb
+++ b/examples/notebooks/orchestrator.ipynb
@@ -335,7 +335,16 @@
" break\n",
"\n",
" response = agent.run(user_input)\n",
- " console.print(f'Agent: {response}')"
+ " \n",
+ " # Check the type of the response schema\n",
+ " if isinstance(response.chosen_schema, SerperSearchToolSchema):\n",
+ " output = search_tool.run(response.chosen_schema)\n",
+ " elif isinstance(response.chosen_schema, CalculatorToolSchema):\n",
+ " output = calculator_tool.run(response.chosen_schema)\n",
+ " else:\n",
+ " output = response.chosen_schema\n",
+ " \n",
+ " console.print(f'Agent: {output}')"
]
}
],