def execute_tool_call()

in 01-agents/7_orchestration.py [0:0]


def execute_tool_call(tool_call, tools_map):
    """指定されたツール呼び出しを実行します。

    Args:
        tool_call (dict): 呼び出すツールの詳細。
        tools_map (dict): ツール名と関数のマッピング。

    Returns:
        any: ツールの実行結果。"""
    name = tool_call.function.name
    args = json.loads(tool_call.function.arguments)

    print(color("Assistant:", "yellow"), color(f"{name}({args})", "magenta"))

    # 指定された引数で対応する関数を呼び出す
    return tools_map[name](**args)