in google/generativeai/responder.py [0:0]
def _make_tools(tools: ToolsType) -> list[Tool]:
if isinstance(tools, Iterable) and not isinstance(tools, Mapping):
tools = [_make_tool(t) for t in tools]
if len(tools) > 1 and all(len(t.function_declarations) == 1 for t in tools):
# flatten into a single tool.
tools = [_make_tool([t.function_declarations[0] for t in tools])]
return tools
else:
tool = tools
return [_make_tool(tool)]