toParallelToolCalls
inline fun <TArgsData, TResult> Flow<TArgsData>.toParallelToolCalls(safeTool: SafeToolFromCallable<TResult>, concurrency: Int = 16): Flow<SafeToolFromCallable.Result<TResult>>(source)
Transforms a flow of argument data into a flow of parallel tool call results using the provided SafeToolFromCallable
.
This function executes the provided tool in parallel with a specified degree of concurrency, mapping input argument data to tool parameters as necessary. Each result encapsulates the outcome of the tool execution (success or failure).
Return
A flow emitting SafeToolFromCallable.Result
representing the outcome of each tool execution.
Parameters
TArgsData
The type of the input argument data emitted by the flow.
TResult
The type of the resulting data produced by the tool calls.
safeTool
An instance of SafeToolFromCallable
wrapping the tool function to be executed.
concurrency
An optional parameter specifying the maximum number of concurrent tool executions. Defaults to 16.