Example notebook for parallel function calling in workflow
Example notebook for parallel function calling in workflow
At a glance
The community members are discussing parallel function calling in a workflow. One community member suggests that if functions are properly implemented with async, they can be executed concurrently. If not, they can use asyncio.to_thread(..) to make them async and then execute them in an asyncio.gather() call.
Another community member is specifically interested in setting allow_parallel_tool_calls = True for a function calling a Large Language Model (LLM), and how that works alongside parallel execution via increasing the num_workers in a workflow step and gathering tool calls. They are looking at Anthropic specifically.
The community members discuss that if there is a step for calling tools, you can emit a number of events to trigger that step, and num_workers will control how many can run at a given time. However, the caveat is that this is async, not multiprocessing, so if something blocks the event loop, it will run sequentially. They suggest using asyncio.to_thread(..) if the tools are not async.
In this case I actually just mean setting allow_parallel_tool_calls = True for a function calling LLM, curious how that works alongside parallel execution via increasing the num_workers in a workflow step and gathering tool calls
yea, for example if you have a step for specifically calling tools, you can emit X number of events to trigger that step, and num_workers will control how many can run at a given time