pub enum ToolExecutionMode {
Standard,
Background {
formatter: Option<Arc<dyn ResultFormatter>>,
scheduling: Option<FunctionResponseScheduling>,
},
}Expand description
Execution mode for a tool.
Standard: the tool runs inline and the model waits for the result before continuing.Background: the tool is spawned as a background task. An immediate “running” acknowledgment is sent to the model, and the final result is delivered asynchronously when the task completes.
§With the L2 Fluent API
ⓘ
Live::builder()
.tools(dispatcher)
.tool_background("search_kb") // uses DefaultResultFormatter
.tool_background_with_formatter( // custom formatter
"analyze",
Arc::new(MyFormatter),
)
.connect_vertex(project, location, token)
.await?;§With the L1 Builder
ⓘ
LiveSessionBuilder::new(config)
.dispatcher(dispatcher)
.tool_execution_mode("search_kb", ToolExecutionMode::Background {
formatter: None,
})
.connect()
.await?;Variants§
Standard
The tool runs inline (blocking the model turn until complete).
Background
The tool runs in the background.
An optional ResultFormatter controls how acknowledgment, result,
and cancellation messages are shaped. When None, the
DefaultResultFormatter is used.
The scheduling field controls how the model handles async results:
Interrupt: halts current output, immediately reports the resultWhenIdle: waits until current output finishes before handlingSilent: integrates the result without notifying the user
Trait Implementations§
Source§impl Clone for ToolExecutionMode
impl Clone for ToolExecutionMode
Source§fn clone(&self) -> ToolExecutionMode
fn clone(&self) -> ToolExecutionMode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolExecutionMode
impl Debug for ToolExecutionMode
Source§impl Default for ToolExecutionMode
impl Default for ToolExecutionMode
Source§fn default() -> ToolExecutionMode
fn default() -> ToolExecutionMode
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ToolExecutionMode
impl !RefUnwindSafe for ToolExecutionMode
impl Send for ToolExecutionMode
impl Sync for ToolExecutionMode
impl Unpin for ToolExecutionMode
impl !UnwindSafe for ToolExecutionMode
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