def test_update_tool_calls_multiple_parallel():
    """Test handling multiple parallel tool calls."""
    tool_calls = [
        {
            "id": "call_1",
            "type": "function",
            "index": 0,
            "function": {"name": "func1", "arguments": "{"},
        },
        {
            "id": "call_2",
            "type": "function",
            "index": 1,
            "function": {"name": "func2", "arguments": "{"},
        },
    ]

    deltas = [
        ChatCompletionDeltaToolCall(index=0, function={"arguments": '"a":1}'}),
        ChatCompletionDeltaToolCall(index=1, function={"arguments": '"b":2}'}),
    ]

    result = update_tool_calls(tool_calls, deltas)
    assert len(result) == 2
    assert result[0]["function"]["arguments"] == '{"a":1}'
    assert result[1]["function"]["arguments"] == '{"b":2}'
Test handling multiple parallel tool calls.
llama-index-integrations/llms/llama-index-llms-litellm/tests/test_utils.py