pub struct Runtime { /* private fields */ }Expand description
The runtime for executing tools.
The Runtime orchestrates the execution of tools, using an Executor
to run the tool’s code in a controlled Sandbox with a prepared
Environment.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub async fn execute_tool(
&self,
tool: &Tool,
args: Value,
) -> Result<ExecutionResult>
pub async fn execute_tool( &self, tool: &Tool, args: Value, ) -> Result<ExecutionResult>
Executes a tool with the given arguments.
§Arguments
tool- The tool to execute.args- The arguments for the tool, as a JSON value.
Sourcepub async fn execute_function_call(
&self,
call: &FunctionCall,
registry: &Registry,
) -> Result<ExecutionResult>
pub async fn execute_function_call( &self, call: &FunctionCall, registry: &Registry, ) -> Result<ExecutionResult>
Executes a function call request.
This is a convenience method that looks up the tool in the registry
and then calls execute_tool.
§Arguments
call- TheFunctionCallrequest.registry- TheRegistryto look up the tool in.
Auto Trait Implementations§
impl Freeze for Runtime
impl RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnwindSafe for Runtime
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more