pub struct ParallelExecutor { /* private fields */ }Expand description
Executes tools in parallel by grouping calls by tool name and using Tool::call_batch
§How it works
- Groups tool calls by tool name
- Executes each group in parallel using
Tool::call_batch - Flattens and returns all results
§Example
Given tool calls:
[
ToolCall { id: "1", function: { name: "weather", ... } },
ToolCall { id: "2", function: { name: "search", ... } },
ToolCall { id: "3", function: { name: "weather", ... } },
]The executor will:
- Group by name:
{ "weather": [call1, call3], "search": [call2] } - Execute in parallel:
weather_tool.call_batch([call1, call3])(runs concurrently)search_tool.call_batch([call2])(runs concurrently)
- Return flattened results:
[result1, result3, result2]
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParallelExecutor
impl !RefUnwindSafe for ParallelExecutor
impl !Send for ParallelExecutor
impl Sync for ParallelExecutor
impl Unpin for ParallelExecutor
impl !UnwindSafe for ParallelExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more