The API itself cannot do this. There’s only a single function invocation in each of the choices – there’s no way to return more than one invocation.
What you can do, though, is break this into multiple sections. Have the first section in fer how many separate requests there are, and then separately invoke the model for each of the sections:
What are the individual commands in the follwing text? Respond with a brief bulleted markdown list:
Open Spotify for me and play the song XYZ
* Open Spotify for me
* play the song XYZ
Now, extract the bulleted items, and execute each one with function calling turned on:
In the context of the previous request, execute the following command:
* Open Spotify for me
-> function call: open_app("name":"Spotify")
In the context of the previous request, execute the following command:
* play song XYZ
-> function call: play_song_in_app("Spotify", "XYZ")