Possible to force calling multiple functions in parallel?

I am trying to leverage the new parallel function calling by forcing two functions to be called in one request.

However, the tool_choice param only seems to accept one function name at a time.

tool_choice={
  "type": "function",
  "function": { "name": "function1" },
}

Does that mean that only the same function can be run multiples times in parallel as in the provided example? Or it is possibly somehow to force it to call two different functions?

1 Like

Only way I found so far was using tool_choice="auto" and asking in prompt to execute both functions.

You just leave it auto (default when there are tools) and let it decide. Are you trying to get it to call the same function, or different functions? From my tests it will call the same function in parallel but not different functions. To get it to call another function you have to pass the results of the first back in.

2 different functions at once in parallel. (Example: function_1 and function_2)

Setting auto works but may be unreliable. Ideally I would like to force the function calls:

tool_choice={
  "type": "function",
  "function": [ { "name": "function_1" }, { "name": "function_2" } ],
}
2 Likes