pub trait PortableTool:
Sized
+ WasmCompatSend
+ WasmCompatSync {
type Args: for<'de> Deserialize<'de> + WasmCompatSend + WasmCompatSync;
type Output: IntoToolOutput + WasmCompatSend;
type Error: Error + WasmCompatSend + WasmCompatSync + 'static;
const NAME: &'static str;
// Required methods
fn description(&self) -> String;
fn parameters(&self) -> Value;
fn call(
&self,
arguments: Self::Args,
) -> impl Future<Output = Result<Self::Output, Self::Error>> + WasmCompatSend;
// Provided method
fn map_error(&self, error: Self::Error) -> ToolExecutionError { ... }
}Expand description
A context-free typed tool that can be executed by any Rig runtime.
Required Associated Constants§
Required Associated Types§
Sourcetype Args: for<'de> Deserialize<'de> + WasmCompatSend + WasmCompatSync
type Args: for<'de> Deserialize<'de> + WasmCompatSend + WasmCompatSync
Owned JSON arguments.
Sourcetype Output: IntoToolOutput + WasmCompatSend
type Output: IntoToolOutput + WasmCompatSend
Canonical model-visible output.
Sourcetype Error: Error + WasmCompatSend + WasmCompatSync + 'static
type Error: Error + WasmCompatSend + WasmCompatSync + 'static
Concrete author-facing failure.
Required Methods§
Sourcefn description(&self) -> String
fn description(&self) -> String
Model-facing description.
Sourcefn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for arguments.
Provided Methods§
Sourcefn map_error(&self, error: Self::Error) -> ToolExecutionError
fn map_error(&self, error: Self::Error) -> ToolExecutionError
Normalize a concrete failure at the runtime effect boundary.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".